This repository contains my player solution for EDA GAME, a lightweight strategy game developed as part of the EDA (Estructures de Dades i Algorismes) course at the FIB - UPC. The project, written in C++, focuses on implementing custom data structures and algorithms to manage game logic efficiently.
- Game: Main executable for running matches between AI players.
- AI.cc / AI.o**: Source/object files for different AI player implementations.
- Structs.cc/h, Settings.cc/h, State.cc/h, etc.: Core game logic, data structures, and utilities.
- Makefile: Build system for compiling the project and managing dependencies.
- GameTest.sh: Bash script to automate running multiple matches and aggregate results.
- default.cnf: Default configuration file for the game.
- README.md: This documentation file.
- Modular AI player system: easily add or swap AI strategies.
- Custom data structures for efficient game state management.
- Batch testing and result aggregation via shell script.
- Configurable game parameters and random seeds for reproducibility.
-
AIINVICTUS.cc is the final and most refined version of my AI player for the EDA Game project. This is the version I used in the Grand Final, where it earned an impressive 2nd place out of 150 participants.
-
Along the journey to this final version, I developed several other strong contenders, including:
- AIMareNostrum.cc
- AITerminator.cc
- AISkynet.cc
- AIChatGPT.cc
-
In addition, I experimented with a variety of compiled object files shared by fellow participants during this edition of the game. These iterations helped shape and optimize my final strategy.
-
Requirements:
- C++11 compatible compiler (e.g., g++)
- Bash (for running GameTest.sh)
- Make
-
Build the project:
Open a terminal in the project directory and run:makeThis will generate the
Gameexecutable.
To run a match between four AI players, use:
./Game PLAYER1 PLAYER2 PLAYER3 PLAYER4 -s SEED -i default.cnf -o output.res
- Replace
PLAYER1...PLAYER4with the names of the AI player files (without the.oextension). -s SEEDsets the random seed (use any integer).-i default.cnfspecifies the configuration file.-o output.resspecifies the output file for results.
Example:
./Game Jugador toasty1 Dummy Terminator -s 42 -i default.cnf -o match1.res
- The output file (e.g.,
match1.res) contains the match results. - The terminal output shows the progress and winner.
- For more detailed logs, check the output redirected by the shell script (see below).
The GameTest.sh script automates running multiple matches and summarizes the results.
Usage:
bash GameTest.sh PLAYER1 PLAYER2 PLAYER3 PLAYER4 NUM_MATCHES
- Replace
PLAYER1...PLAYER4with the AI player names. NUM_MATCHESis the number of matches to run.
Example:
bash GameTest.sh Jugador toasty1 Dummy Terminator 10
- The script will run 10 matches with random seeds, print the winner of each match, and display the total wins for each player at the end.
- Temporary output and result files are cleaned up automatically.
To add a new AI player:
- Implement your AI logic in a new file named
AIYourName.cc. - Copy the
AIDemo.cccode toAIYourName.cc. It can serve as a template to start with. - Add the object file to the
EXTRA_OBJvariable in the Makefile if needed. - Rebuild the project with
make. - Run matches including your AI as described above.
This project is for educational purposes as part of the EDA course at FIB - UPC.
Feel free to open issues or submit pull requests for improvements!