Skip to content

This is a game AI project for the course "Artificial Intelligence" at the University of Calabria, Italy.

License

Notifications You must be signed in to change notification settings

EttoreCaputo/hadron-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hadron Game AI

made-with-python License: MIT python-version

This is a game AI project for the course "Artificial Intelligence" at the University of Calabria, Italy.

I made this project with my colleague Pasquale Mirko Aprigliano.

The project consists in the implementation of a game AI for the game "Hadron" designed by Mark Steere, here is the original rule paper. You can also find the rules in the root folder of the project, in the file "Hadron_rules.pdf".

Quick Hadron introduction:

Hadron is a two player game played on a 5x5 (or 7x7...) square board, initially empty.

The two players, Red and Blue, take turns adding their own tiles to the board, one tile per turn, starting with Red. If you have a placement available, you must make one. Passing is not allowed. Draws cannot occur in Hadron

The game ends when one player has no more tiles to place. The player that play last wins.

No draws are possible in Hadron.

How to run the project:

In the tests folder there are some files starts with "test_", these are the test files, you can run them to test the project.

For example, if you want to play a game against the AI, you can run the file "test_human_vs_ai.py".

Project structure:

The project is structured in this way:

  • hadron folder: contains the files game.py and board.py that are taken from the aimacode GitHub repository. There are also an implementation of the game Hadron in the file hadron.py and the file hadron_graphic_module.py contains the graphic implementation of the game with PyGame.

  • tests folder: contains the test files that you can run at first.

  • players folder: contains some player implementations, like the simplest HumanPlayer and the RandomPlayer. In this folder are also two AI players, the MonteCarloPlayer and the CarloAnalphabetaPlayer.

  • dql folder: contains the implementation of the Deep Q-Learning algorithm for the game Hadron. But this implementation is not complete, it's just a test, so it doesn't work properly.

  • search_algorithms.py file: contains the implementation of some search algorithms like MinMax, AlphaBeta, MonteCarlo and others. The implementations of these algorithms are taken from the aimacode GitHub repository

Carlo the analphabeta:

CarloAnalphabeta's player is the best Hadron player that we've made. It uses a combination of the AlphaBeta search and MonteCarlo search algorithms with some optimizations. In the file carlo_analphabeta_player.py you can find the implementation of this player. This player makes a MonteCarlo search until the number of move still remains is greater than 6, then it uses the AlphaBeta search with a depth of 12 in combination with a heuristic function.

Issues:

Feel free to open an issue.

License:

This project is licensed under the terms of the MIT license.


Enjoy!