8000 GitHub - nicolardi/aiexp: Esperimenti di AI
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nicolardi/aiexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

aiexp

Experiments with AI

puzzle 8 sample

How to Run

cd puzzle8
python3 puzzle8.py

Run Unit Tests

python3 puzzle8_test.py

Details

The puzzle8.py script can solve the puzzle8 (whenever possible) using one of three algorithms:

  • depth_first_search
  • breadth_first_search
  • best_first_search

The solve method returns the solution. You can print all the moves by calling the printTheSolution method with the returned solution.

You will get something like this:

PUZZLE 8 SOLVER - AI Search State Space algorithms

Current puzzle to solve:

---------
 1  2  3 
 4  0  5 
 6  7  8 
---------

### Search algorithm depth_first_search ###
         -> Solution found in 14 moves with 4923 iterations. Visited nodes: 2937

### Search algorithm breadth_first_search ###
         -> Solution found in 29972 moves with 52786 iterations. Visited nodes: 30772

### Search algorithm best_first_search ###
         -> Solution found in 22 moves with 119 iterations. Visited nodes: 68

### Search algorithm A* ###
         -> Solution found in 14 moves with 189 iterations. Visited nodes: 110

---------
 1  2  3 
 4  0  5 
 6  7  8 
---------

---------
 1  2  3 
 4  5  0 
 6  7  8 
---------

---------
 1  2  3 
 4  5  8 
 6  7  0 
---------

---------
 1  2  3 
 4  5  8 
 6  0  7 
---------

---------
 1  2  3 
 4  5  8 
 0  6  7 
---------

---------
 1  2  3 
 0  5  8 
 4  6  7 
---------

---------
 1  2  3 
 5  0  8 
 4  6  7 
---------

---------
 1  2  3 
 5  6  8 
 4  0  7 
---------

---------
 1  2  3 
 5  6  8 
 4  7  0 
---------

---------
 1  2  3 
 5  6  0 
 4  7  8 
---------

---------
 1  2  3 
 5  0  6 
 4  7  8 
---------

---------
 1  2  3 
 0  5  6 
 4  7  8 
---------

---------
 1  2  3 
 4  5  6 
 0  7  8 
---------

---------
 1  2  3 
 4  5  6 
 7  0  8 
---------

---------
 1  2  3 
 4  5  6 
 7  8  0 
---------

About

Esperimenti di AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0