This project utilizes the declarative paradigm of Prolog to solve the classic "Farmer, Fox, Chicken, and Corn" logic puzzle. Instead of a step-by-step algorithm, the program is built on a set of logical rules that define the puzzle's constraints. Prolog's inference engine then uses these rules to find a valid solution path on its own.
Language: Prolog
Skills: Logic Programming, Declarative Programming, State-Space Search, Constraint Satisfaction, Recursion.
Logic-Based Problem Solving: Solved by defining "safe" states and valid moves as a series of logical rules.
State-Space Representation: Models the puzzle's state using a Prolog structure state(Farmer, Fox, Chicken, Corn).
Constraint Checking: Uses safe/1 rules to prevent the engine from exploring invalid states (e.g., the fox cannot be left with the chicken).
Recursive Pathfinding: A recursive predicate performs a depth-first search to find a valid solution path.