Best Prolog Program EVER
As part of a few lectures on Prolog (an obscure but interesting logic-based programming language) Southern Man assigned his students to download SWI-Prolog and write a simple program. One submitted this gem. You don't have to be a computer science geek to appreciate it.
witch(X) :- burns(X), female(X).It's a fair cop...
burns(X) :- madeOfWood(X).
madeOfWood(X) :- floats(X).
floats(X) :- sameWeight(duck, X).
female(girl).
sameWeight(duck, girl).
-? witch(girl)
true
0 Comments:
Post a Comment
<< Home