Artificial Intelligence Python codes for solving puzzles and problems.
NOTE
This repository was created solely to discuss the various Artificial Intelligence codes in Python that can be used to solve puzzles and problems. If you have any idea or algorithm, please feel free to update this repository as it will help all of us to grow as a community.
1. TIC-TAC-TOE (TWO USERS)
- A basic two user playable Tic-Tac-Toe game that uses your numpad as the position markers.
- Players take turn by turn to position their mark.
- The game does not have a GUI as of now. It is a console version.
More can be found inside its corresponding folder
2. TIC-TAC-TOE (USER vs AI)
- Instead of another user, the machine will play against you.
- Developed using basic algorithm and some Tic-Tac-Toe tricks
- I have played against it a thousand times and the highest I have gone is a DRAW.
- GIVE IT A TRY. CAN YOU BEAT IT?
More can be found inside its corresponding folder
3. 8 - PUZZLE PROBLEM
-
There are 9 cells arranged in a 3x3 grid. Eight of them are numbered from 1 - 8 and one is left blank (in my case, I have numbered it to 0).
-
The rule of this game is to swap the blank cell with its adjacent cell and arrange the cells in ascending order (with the blank space in the last cell).
That is, convert this...

To this...

More can be found inside its corresponding folder
4. 8 - PUZZLE PROBLEM SOLVER (AI)
- Uses BEST FIRST SEARCH to find the optimum solution.
- Heuristic function used is MANHATTAN DISTANCE
- Feed the 8 - puzzle problem board values and it will spit out the steps.
- Solves the problem blazing fast!
More can be found inside its corresponding folder
5. WATER JUG PROBLEM SOLVER (AI)
- There are two water jugs :- Jug1 and Jug2 with their own volumes.
- Water can be poured into these Jugs. You cannot pour more water into the Jugs than the permitted volumes. But you can fill less.
- Initially both the Jugs are emtpy.
- A final state for the Jugs are decided. That is, how much water should be stored in Jug1 and how much in Jug2.
- Our goal is to achieve the final state by using only the following permitted operations:-
- Fill Jug1 completely
- Fill Jug2 Completely
- Empty Jug1
- Empty Jug2
- Transfer water from Jug1 to Jug2
- Transfer water from Jug2 to Jug1
- At any given time, only one operation is allowed.
- Jugs can be filled and emptied any number of times. There is no limit.
More can be found inside its corresponding folder