Skip to content

Githubense/Missionaries-Cannibals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Cannibals and Missionaries Problem Solver in Prolog

Repository Description:

Cannibals and Missionaries Problem Solver in Prolog

This GitHub repository contains a Prolog implementation for solving the classic "Cannibals and Missionaries" problem. The problem involves transporting missionaries and cannibals across a river, adhering to specific rules to avoid missionaries being eaten by cannibals. The Prolog code utilizes logical programming to represent states, valid moves, and safety checks.

Key Features:

Logical Representation: States of the problem, initial and goal states, and valid moves are represented using Prolog terms and predicates. Breadth-First Search: The code employs a breadth-first search strategy to efficiently find a solution path from the initial to the goal state. Safety Checks: The implementation includes safety checks to ensure that the number of cannibals does not exceed the number of missionaries on either side of the river.

Usage:

Clone the repository. Load the Prolog file (missionaries-cannibals.pl) in your Prolog interpreter. Execute the "?- solve." predicate to find and display the solution path for the problem.

About

Cannibals and Missionaries Problem Solver in Prolog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages