A Prolog program to solve Snape's potion puzzle from the first Harry Potter book.
I used the SWI-Prolog environment during the implementation.
- Ensure SWI-Prolog is installed. SWI-Prolog is a package on most major Linux distributions.
- Run
swipl -f main.pl
- Get the solution
?- solution(X).
X = [poison, wine, ahead, poison, poison, wine, back] .
As solving the riddle relies on seeing the bottles, and the book doesn't disclose enough information, this solver relies on the drawing included in the Pottermore game.