Hey there, code explorers! 🌟 Welcome to the mind-blowing world of Tablut, brought to you by the genius minds of University of Bologna's AI course for the mind-bending academic year 2023/2024! 🧠🎓
Our mission? Oh, just to create an AI wizard 🧙 capable of dominating the epic game of Tablut using the jaw-dropping Minimax algorithm with Alpha-Beta pruning. Yeah, we're that ambitious! 🚀
And who's behind this magical project? None other than the fantastic foursome:
Hold on to your hats, folks! This project is pure Python 3.9 sorcery! 🐍 The code? It's organized so neatly, even Marie Kondo would be proud! 🧹 Plus, it's comment city, making it a breeze to understand. Oh, and did we mention we've sprinkled some AIMA Python code magic? Yup, we went all out! 🚀✨
Ready for the magic show? 🎩✨ To dive into the enchanting world of Tablut, simply run the mystical play.py
file. Just toss in these enchanting arguments:
--team
: Choose your team, eitherWHITE
orBLACK
. 🏴☠️🏳️--name
: Declare the name of your agent. ✨--ip
: Provide the IP address of the server. Default islocalhost
. 🌐
Behold the spell to run this enchanting code:
py play.py --team WHITE --name "\tLut" --ip <server_ip>
Oh, and if you're in the Windows realm, use python3
for Linux adventures. 🐧✨
In the implementation of the WHITE player's heuristics, several factors are taken into consideration to evaluate the current state of the Tablut board. These factors contribute to the overall fitness of the position for the WHITE player. The key components of the WHITE heuristics include:
-
Vulnerability to Capture:
- A measure of the risk of WHITE pieces being captured by BLACK pawns.
- Utilizes the concept of clear views to assess potential threats to WHITE pieces.
-
King's Distance and Safety:
- Evaluates the distance of the WHITE king from the corners of the board.
- Incorporates the number of BLACK pieces in each quadrant to assess the safety of the king.
-
External Pawn Distribution:
- Calculates the fitness based on the distribution of WHITE pawns relative to the king.
- Promotes a strategic arrangement of WHITE pieces with respect to the center of the board.
-
King's Defense:
- Considers the ability of BLACK pieces to potentially capture the WHITE king in the next move.
- Applies a strong negative fitness if the king is at risk of capture.
-
King's Movement:
- Evaluates the movement of the WHITE king, promoting a balanced position across the board.
The combination of these factors aims to provide a comprehensive assessment of the Tablut board from the perspective of the WHITE player.
The BLACK player's heuristics focus on evaluating the strategic aspects of the Tablut board, taking into account various factors that influence the overall fitness of the position. The primary considerations in the BLACK heuristics are:
-
Number of BLACK and WHITE Pawns:
- Assigns fitness based on the count of BLACK and WHITE pawns on the board.
-
Proximity of BLACK Pawns to the King:
- Evaluates the number of BLACK pawns within a certain distance of the WHITE king.
- A higher count encourages a more aggressive position.
-
Path to the King:
- Assesses the availability of free paths for BLACK pawns to reach and potentially capture the WHITE king.
-
Encirclement of the King:
- Introduces a coefficient of encirclement, considering the positioning of BLACK pawns around the WHITE king.
The BLACK heuristics aim to capture the strategic advantages, focusing on pawn count, proximity to the king, and the potential to create threats against the WHITE player. These factors collectively contribute to the fitness evaluation for the BLACK player in the Tablut game.
Prepare to be amazed, mortals! 🎩✨