Skip to content

Cannibals & Missionaries Problem Solution with A* Algorithm in Java

Notifications You must be signed in to change notification settings

Kyriakos-Bekas/cannibals-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cannibals & Missionaries Problem

Introduction

This algorithm was created as a project for the course Artificial Intelligence of the Athens University of Economics and business. The algorithm finds a solution to the Cannibals & Missionaries problem.

Problem Explanation

In the Cannibals & Missionaries problem, 3 missionaries and 3 cannibals want to cross from the left bank of a river to the right bank of the river. However, if the cannibals ever outnumber the missionaries on either bank, the cannibals will eat the missionaries. In this case, our algorithm solves the problem for n amount of cannibals and missionaries.

Algorithm

The problem is solved using the A* Algorithm. For more information about the A* Algorithm click here.

Understanding the Code

Each file has carefully written comments that will help you understand the structure and use of the code in it. That way, you can see read about what is happenning where it is happening.

Access the Code

You can access the content of this repository by

  1. Cloning the repository
git clone https://github.com/Kyriakos-Bekas/cannibals-ai.git
  1. Downloading the code by clicking : Code > Download ZIP

Download Code as ZIP Visual Instructions

How to use

Open the command prompt/ integrated terminal and navigate to the path.

In order to execute the program, simply type the following commands:

javac Main.java SpaceSearcher.java State.java
java Main

After that, fill in the prompts with the data that you want to examine and wait for the result.

Credit

This algorithm was created by Alexandros Alexiou, Ioannis Skoufoulas and Kyriakos Bekas.

If you found that this repository was valuable to you, consider giving it a star ⭐

Licencing

Free for use in all personal, public and commercial projects.

About

Cannibals & Missionaries Problem Solution with A* Algorithm in Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages