Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

278 Commits

Folders and files

Repository files navigation

INF8175-hex-agent

This repository contains the algorithms used for an hex-playing agent.

1. Environment setup

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-dev

Acivate the environment:

source hex-dev/bin/activate # On Linux/macOS
.\hex-dev\Scripts\Activate.ps1 # On Windows

Finally, install the required dependencies:

pip install -r requirements.txt

2. Code execution

To launch an Hex game, use the following commands from the root directory:

2.1 Human VS Human

python src/main_hex.py -t human_vs_human

2.2 Human VS Agent

python src/main_hex.py -t human_vs_computer src/agents/<agent_file_name>

All the possible agents can be find in src/agents/

2.3 Agent VS Agent (local)

python src/main_hex.py -t local src/agents/<first_agent_file_name> src/agents/<second_agent_file_name>

2.4 Agent VS a series of agents (local)

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 

2.5 Agent vs Agent (remote)

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>

3. Game Rules

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.

4. Abyss file format

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.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages