Like Leibniz, we can now cry "calculemus!" using the power of SWI-Prolog.
The dork muses: "Not sure if she likes me, or she's just a nice person." She shows the dork affection, but what more can he infer? His problem is that nice people show affection to everybody.
In Prolog we write:
shows_affection(girl,dork).Y will get successively bound to anyone X shows affection to. When we run a query as to whether the girl is nice, this is what we get:
nice(X) :- shows_affection(X,Y).
But .. if someone likes you, they show affection to you and are (or ought to be) indifferent to others. So the dork needs to check whether the girl is indifferent to all others. Suppose she is, then we write:
likes(X,Y) :- shows_affection(X,Y), indifferent(X,Z), Z\=Y.
We run the query: does the girl like the dork?
?- likes(girl,dork).So under these assumptions the dork gets lucky ,, but he has to check.
I tagged this post as humour, and joke. Prolog adds very little except as a check on assumptions, but the tiniest bit of thought is needed to address the dilemma of the cartoon.