Repository for the practical work of the Algorithms and Data Structures course
- UNLaM (National University of La Matanza) -
Summary •
Features •
Installation •
Known issues •
How to play
Application structure •
Team workflow •
Development team •
Additional material
License •
Acknowledgments
This repository contains the practical work for the Algorithms and Data Structures course at the National University of La Matanza (UNLaM). The practical work consists of developing the Tic-Tac-Toe game using the C programming language. The main objective is to integrate the game with an API to record the results and thus improve the artificial intelligence.
- Architecture planning.
- Artificial intelligence (AI).
- Code conventions and standards.
- Code documentation using Doxygen syntax.
- Commits following the Conventional Commits.
- Communication with APIs (GET and POST).
- Continuous integration with GitHub Actions.
- Deployment of releases.
- Dynamic memory.
- Inputs control using validations.
- Local storage of records.
- Singly linked list implementation.
- Team Workflow planning (branches, tags, and releases).
-
Clone the repository to your device and install the CodeBlocks IDE with MinGW.
-
Open the files src.cbp (main project) and libs.cbp (library project) with the CodeBlocks application. These files are located within the cloned repository.
-
Select the libs.cbp project (library project) and compile it in Release mode and Debug mode.
-
Select the src.cbp project (main project), run it in Release mode, and enjoy it.
Issue | Solution |
---|---|
src.cbp (main project) doesn't compile | Select the libs.cbp project (library project) and compile it in Release mode and Debug mode. Then, select the src.cbp project (main project), right-click on it, choose Build Options , and go to the Linker settings tab. There, add the libs.a files located in the libs/bin/Debug and libs/bin/Release folders. Finally, try compiling the main project again. |
-
Start the game
When the program starts, a menu with three options will appear.
- [A] Play Tic-Tac-Toe: Starts a game of Tic-Tac-Toe.
- [B] Show ranking: Displays the current ranking of the group of players.
- [C] Exit: Ends the program.
-
Start a match
- Players are asked to enter their names. Any number of names can be entered.
- The play order is determined randomly and displayed on the screen.
- Each player will be asked if they are ready to start.
-
During the match
- Each player will play a specified number of games, defined in the configuration file.
- In each game, it is randomly assigned whether the player will be
X
orO
. - The 3x3 board will be displayed, and the player must enter the position where they want to place their symbol.
- The AI makes its move strategically:
- Blocks the player's victory if possible.
- Wins if it has the opportunity.
- Plays randomly if there are no clear moves.
- The turn alternates between the player and the AI until someone wins or a tie is declared.
-
End of the match
- Points are assigned for each game as follows:
- If the player wins, they receive 3 points.
- If a tie is declared, the player receives 2 points.
- If the AI wins, the player loses 1 point.
- Once all games are completed, a report is generated with:
- Details of the games (including the final state of the board).
- Winner of each game.
- Total score of each player.
- Final result indicating the players with the highest score.
- The report is saved in a text file with the format
game-report_YYYY-MM-DD-HH-mm.txt
. - The results are sent to an API.
- Points are assigned for each game as follows:
- If it's a draw, the player earn two points.
- If the board is filled without a winner, the result is considered a draw.
- If the player has the
X
form, he makes the first move else the AI. - If the player loses, he loses three points.
- If the player wins, he earn three points.
- The AI plays with a random, blocking or winning strategy, predefined at the start of the game.
- The order of the players is random.
- The player wins if he places three of his symbols in a horizontal, vertical or diagonal line.
How can I change the game configuration?
To change the configuration, open the file configuration.txt.
- To change the API base endpoint, replace
https://algoritmos-api.azurewebsites.net/api/TaCTi
with your desired endpoint. - To change the team name, replace
TABACO
with your preferred team name. - To change the number of games per player, replace
3
with the desired number of games.
If configuration.txt is missing, the program won't start and will throw an error in the console.
N° | Description | Expected result | Received result |
---|---|---|---|
1 | Start the game and select Play Tic-Tac-Toe |
Prompts for player names and starts the game with a random player | Players take turns randomly to play. |
2 | Enter player names | Entered players are registered correctly | Player names are registered and assigned 0 initial points. |
3 | Play a turn and win against the AI | The player receives 3 points | 3 points are added to the points field of the player structure. |
4 | Play a turn and tie against the AI | The player receives 2 points | 2 points are added to the points field of the player structure. |
5 | Play a turn and lose against the AI | The player loses 1 point | 1 point is subtracted from the points field of the player structure. |
6 | Complete all games and generate a report | A .txt file is generated with the total score |
A .txt file is generated with the game statistics. |
7 | Check group ranking | The group ranking is displayed | The API is queried, and the group ranking is displayed. |
8 | End the game | The program ends without errors | The program ends without errors. |
C-Algorithms-Practical-Work-2025/
│
├── .github/
│ └── workflows/
│ └── format-code.yml
│
├── docs/
│ ├── statics/
│ │ └── preview.png
│ │
│ └── translations/
│ ├── en/
│ │ ├── documentation.md
│ │ └── requirements.md
│ │
│ └── es/
│ ├── README.md
│ ├── documentation.md
│ └── requirements.md
│
├── libs/
│ ├── libs.cbp
│ ├── macros.h
│ ├── main.h
│ ├── structs.h
│ │
│ ├── singly-list/
│ └── time/
│
├── src/
│ ├── libcurl-x64.dll
│ ├── macros.h
│ ├── main.c
│ ├── src.cbp
│ │
│ ├── api/
│ ├── configuration/
│ ├── play/
│ ├── player/
│ ├── show-ranking/
│ └── statics/
│
├── .clang-format
├── .gitignore
├── LICENSE
└── README.md
-
.github - Files related to continuous integration.
- workflows - GitHub Actions workflows.
-
docs - Files related to the application documentation.
- statics - Static files (images, videos, diagrams, etc.).
- translations - Translations of
.md
(Markdown) files.
-
libs - Project containing the libraries necessary for the execution of the main application project.
-
src - Main project of the application.
-
libcurl-x64.dll - DLL for execute CUrl.
-
macros.h - File with essential project macros.
-
main.c - Main execution file.
-
src.cbp - Project configuration file.
-
api - APIs module.
-
configuration - Configuration module.
-
play - Play module.
-
player - Player module.
-
show-ranking - Show ranking module.
-
statics - Statics module.
-
-
.clang-format - Configuration file for the clang-format code formatting tool.
-
.gitignore - Git configuration file to avoid tracking unwanted files.
-
LICENSE - Project license.
-
README.md - Markdown file with the general documentation for the application and repository.
%%{init: { 'logLevel': 'debug', 'theme': 'dark', 'gitGraph': {'showBranches': true, 'showCommitLabel': true, 'mainBranchName': 'Master', 'parallelCommits': true}} }%%
gitGraph:
commit
commit tag: "v0.0.1"
branch "Lopez Jorge"
commit
commit
checkout Master
branch "Parra Ignacio"
commit
commit
checkout Master
branch "Hoz Lucas"
commit
commit
checkout Master
branch "Massa Valentin"
commit
commit
checkout Master
branch "Rombola Facundo"
commit
commit
checkout Master
merge "Parra Ignacio"
merge "Lopez Jorge"
merge "Massa Valentin"
merge "Hoz Lucas"
merge "Rombola Facundo" tag: "v1.0.0"
vMAJOR.MINOR.PATCH
: This tag indicates a release of the practical work following Semantic Versioning, and will only be present in theMaster
branch commits.
Master
: Branch containing the development versions of the practical work, where team members will introduce new changes (commits) through pull requests.
Important
Stable versions are only available as releases.
Note
The other branches are fictional and represent individual contributions from each member through pull requests to the Master
branch.
This repository is under the MIT License. For more information about what is permitted with the contents of this repository, visit choosealicense.com.
We would like to thank the teachers from the UNLaM Algorithms and Data Structures course for their support and guidance.