|
1 | | -# Practical Work - Algorithms and Data Structures |
| 1 | +# Practical work - Algorithms and Data Structures |
2 | 2 |
|
3 | | -TODO |
| 3 | +## Submission modality |
| 4 | + |
| 5 | +The submission is done in groups of 4 people. |
| 6 | +If all necessary groups are formed and there are still students without a group, they will be assigned by the instructors to pre-formed groups, forming groups of **5 people**. |
| 7 | + |
| 8 | +Groups must be formed and notified via the [MIeL](https://miel.unlam.edu.ar/) forum by 11:59 PM on Tuesday, February 4, 2025, as comments in the following post: |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +Respecting the group formation deadline is a requirement to pass the practical work. |
| 13 | + |
| 14 | +Each group's name must be a single word and must not be repeated by any other group. The group name must be a word listed in the [RAE dictionary](https://dle.rae.es/). |
| 15 | + |
| 16 | +The group name must consist of letters whose ASCII value is between `0x41` and `0x5A` (inclusive). This implies that spaces, lowercase letters, accents, numbers, etc., are not allowed. |
| 17 | + |
| 18 | +### Examples of names that will be rejected: |
| 19 | + |
| 20 | +| Word | Reason for Rejection | |
| 21 | +| :--------- | :---------------------------------------------------------- | |
| 22 | +| LOS PIOJOS | Contains a space (`0x20`). | |
| 23 | +| La Renga | Contains a space and lowercase letters. | |
| 24 | +| ASDF | The word `asdf` is not in the dictionary. | |
| 25 | +| C++ | The ASCII for `+` is `0x2b`, not within the required range. | |
| 26 | + |
| 27 | +### Example of a valid name: |
| 28 | + |
| 29 | +| Word | Reason for Acceptance | |
| 30 | +| :-------- | :------------------------------------------------------------------------------------------------------------ | |
| 31 | +| INVISIBLE | It consists of valid characters, and according to the RAE its definition is: _"1. adj. That cannot be seen."_ | |
| 32 | + |
| 33 | +The submission must be a file with the following format: `TP_ALGORITMOS_2024_3C_{GROUP_NAME}.zip`. |
| 34 | + |
| 35 | +For example: If the group's name was `INVISIBLE` _-and its members were Spinetta, Pomo, Machi, and Gubitsch-_ the file should be named `TP_ALGORITMOS_2024_3C_INVISIBLE.zip`. |
| 36 | + |
| 37 | +The file format is a reason for rejection of the practical work. As with any system, the requested format must be respected. |
| 38 | + |
| 39 | +### Examples of files that will be considered incorrect: |
| 40 | + |
| 41 | +| File Name | Reason for Rejection | |
| 42 | +| :--------------------------------------- | :------------------------------------ | |
| 43 | +| `TP_ALGORITMOS_2024_3c_INVISIBLE.zip` | Contains a lowercase `c` in the name. | |
| 44 | +| `TP_ALGORITMOS_2024_3C_INVISIBLE(1).zip` | Contains `1` in the name. | |
| 45 | +| `TP_ALGORITMOS_2024_2C_INVISIBLE.zip` | Incorrect semester. | |
| 46 | +| `TP_ALGORITMOS_2024_3C_INVISIBLE.rar` | Incorrect file format. | |
| 47 | + |
| 48 | +The class schedule lists the submission and defense dates for the practical work. The defense is an evaluation instance for the course. |
| 49 | + |
| 50 | +## requirement |
| 51 | + |
| 52 | +A group of developers is creating an interactive kiosk for entertainment in supermarkets. As part of the project, they want to include a [Tic-Tac-Toe](https://en.wikipedia.org/wiki/Tic-tac-toe) minigame where users can play against a basic artificial intelligence. Each game will be recorded on a remote server through an [API](https://simple.wikipedia.org/wiki/Application_programming_interface) to analyze the results and improve the AI in future versions. |
| 53 | + |
| 54 | +The game must be implemented in **C**, allowing users to play individual games against the machine, record the results via an [API](https://simple.wikipedia.org/wiki/Application_programming_interface), and generate a local report with statistics. |
| 55 | + |
| 56 | +## Game rules |
| 57 | + |
| 58 | +At the beginning of each game: |
| 59 | + |
| 60 | +1. Players' names will be entered. |
| 61 | +2. The order of players will be randomly determined. |
| 62 | + |
| 63 | +The game rules are as follows: |
| 64 | + |
| 65 | +- **Alternating Turns:** The user and the machine take turns on a **3x3** board. |
| 66 | +- **Victory Conditions:** |
| 67 | + - A player wins by placing three of their symbols in a horizontal, vertical, or diagonal line. |
| 68 | + - If the board fills up without a winner, the game is considered a draw. |
| 69 | +- **Machine Strategy:** The machine will play with a predefined strategy, such as: |
| 70 | + - Choosing randomly if there is no clear move. |
| 71 | + - Blocking the player’s victory if possible. |
| 72 | + - Winning on the next move if it has the opportunity. |
| 73 | + |
| 74 | +## assignment |
| 75 | + |
| 76 | +Implement the [Tic-Tac-Toe](https://en.wikipedia.org/wiki/Tic-tac-toe) game in **C** with the following features: |
| 77 | + |
| 78 | +Upon starting the program, there should be a menu with 3 options: |
| 79 | + |
| 80 | +- [A] Play. |
| 81 | +- [B] View team ranking. |
| 82 | +- [C] Exit. |
| 83 | + |
| 84 | +If someone chooses `Play`, they will first be asked to enter the names of the players. They can enter as many names as they want. |
| 85 | + |
| 86 | +Once the names are entered, the player order (randomly determined) will be displayed on the screen, and the first player will be asked if they are ready. If they confirm, the game starts. |
| 87 | + |
| 88 | +Each player will play a certain number of games (determined by the configuration file). In each game, they will randomly be assigned either `X` or `O`. The board will be displayed, and the player must enter their move. The machine responds with its move. The process repeats until one of them wins or it’s a draw. |
| 89 | + |
| 90 | +When the player finishes their games, the next player will take their turn, and so on until all games for all players are completed. For each completed game, 3 points will be awarded if the player wins, 2 points for a draw with the machine, and 1 point will be deducted if the player loses. |
| 91 | + |
| 92 | +Once the games are completed, a report will be generated with the details of each game (final board state), the winner, the score for each game, the total score for each player, and the final result, indicating which player(s) obtained the highest score. The file name must contain the current date and time in the following format: `YYYY-MM-DD-HH-mm`. Example file name: `game-report_2024-02-01-12-20.txt`. Additionally, the players' results will be sent to an [API](https://simple.wikipedia.org/wiki/Application_programming_interface) in the following format: |
| 93 | + |
| 94 | +```json |
| 95 | +{ |
| 96 | + "codigoGrupo": "ASD123", |
| 97 | + "jugadores": [ |
| 98 | + { |
| 99 | + "nombre": "Juan", |
| 100 | + "puntos": 10 |
| 101 | + } |
| 102 | + ] |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +The [API](https://simple.wikipedia.org/wiki/Application_programming_interface) configurations and the number of games per player will be read from a `.txt` file with the following format: |
| 107 | + |
| 108 | +```plaintext |
| 109 | +API URL | Group identifier code |
| 110 | +Number of games |
| 111 | +``` |
| 112 | + |
| 113 | +```plaintext |
| 114 | +https://api.com | ASD123 |
| 115 | +3 |
| 116 | +``` |
| 117 | + |
| 118 | +Additionally, the code must be uploaded to a repository on [GitHub](https://github.com/). The repository must include a [README.MD](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes) that explains how to play the game and what to do if the game configurations need to be changed. |
| 119 | + |
| 120 | +The repository must also contain a document with different test cases in the following format: |
| 121 | + |
| 122 | +| Description | Expected Output | Actual Output | |
| 123 | +| :------------------------- | :--------------------- | :------------------------- | |
| 124 | +| Testing what happens if... | It is expected that... | The output obtained was... | |
| 125 | + |
| 126 | +A minimum of 8 test cases must be documented, with screenshots of the obtained output. |
| 127 | + |
| 128 | +## Basic conditions for approval |
| 129 | + |
| 130 | +- 0 errors and 0 warnings. |
| 131 | +- Neat and well-structured code divided into functions. |
| 132 | +- Functions should be as generic as possible. |
| 133 | +- Meaningful variable names. |
| 134 | +- It should work for at least all the documented test cases. |
0 commit comments