This repository contains the algorithms used for an hex-playing agent.
First, make sure you are using Python 3.11.
Clone the repository and move into the project directory:
git clone <repository_url>
cd <repository_name>Create a virtual environment named hex-dev:
python -m venv hex-devAcivate the environment:
source hex-dev/bin/activate # On Linux/macOS
.\hex-dev\Scripts\Activate.ps1 # On WindowsFinally, install the required dependencies:
pip install -r requirements.txtTo launch an Hex game, use the following commands from the root directory:
python src/main_hex.py -t human_vs_humanpython src/main_hex.py -t human_vs_computer src/agents/<agent_file_name>All the possible agents can be find in src/agents/
python src/main_hex.py -t local src/agents/<first_agent_file_name> src/agents/<second_agent_file_name>Use the challenge_agent scripts to collect data from matches between a specfic agent and all
other existing agents :
./task/challenge_agent.sh <player_name> # On Linux/macOS To play against an agent from another group:
- On the hosting machine, run:
python src/main_hex.py -t host_game -a <ip_address> src/agents/<agent_file_name>- On the opponent's machine, connect to the host's IP:
python main_hex.py -t host_game -a <ip_address> <agent_file_name>The first player uses the red stones, while the second player uses the blue stones.
- The red player must connect the top and bottom sides of the board with a continuous path.
- The blue player must connect the left and right sides instead.
On each turn, a player places one stone of their color on an empty hex cell.
To upload an agent on Abyss, a zip file with the following structure must be used
2200476_2206192.zip # Directory
├── my_player.py # Contains the implementation of the MyPlayer class that enhirits from PlayerHex
├── requirements.txt # Contains all the necessary libraries
├── src_2200476_2206192 # Contains all the other files
│ ├──(file 1)
│ ├──(file 2)
│ ├──(...)If the src_2200476_2206192 folder is necessary, make sure that the relative paths between files are the right ones and that
the agent works in this architecture. All files should be named without spaces, nor special characters.