{"id":51057322,"url":"https://github.com/leandroaa01/zombie-dice","last_synced_at":"2026-06-22T22:32:27.061Z","repository":{"id":361294050,"uuid":"1253916972","full_name":"leandroaa01/zombie-dice","owner":"leandroaa01","description":"zdice game you and the other players are zombies trying to collect brains and avoid the very nasty humans who are trying to surprise you with their shotguns","archived":false,"fork":false,"pushed_at":"2026-05-30T00:12:34.000Z","size":1079,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T02:11:02.511Z","etag":null,"topics":["backend","cmake","cpp","game"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leandroaa01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-30T00:09:40.000Z","updated_at":"2026-05-30T00:14:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leandroaa01/zombie-dice","commit_stats":null,"previous_names":["leandroaa01/zombie-dice"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leandroaa01/zombie-dice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroaa01%2Fzombie-dice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroaa01%2Fzombie-dice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroaa01%2Fzombie-dice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroaa01%2Fzombie-dice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandroaa01","download_url":"https://codeload.github.com/leandroaa01/zombie-dice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroaa01%2Fzombie-dice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34668500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","cmake","cpp","game"],"created_at":"2026-06-22T22:32:26.966Z","updated_at":"2026-06-22T22:32:27.054Z","avatar_url":"https://github.com/leandroaa01.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Programming Assignment: Zombie Dice Project\n\n### Table of Contents\n\n1. [Introduction](#introduction)\n2. [Gameplay](#gameplay)\n3. [Input](#input)\n4. [Interface](#interface)\n5. [System Modeling](#system-modeling)\n6. [Output](#output)\n7. [Assignment Grading](#assignment-grading)\n8. [Authorship and Collaboration Policy](#authorship-and-collaboration-policy)\n9. [Work Submission](#work-submission)\n\n## Introduction\n\nIn this programming assignment you must create a version of the\n**Zombie Dice**\u0026copy; to run on a terminal emulator.\n\nThe development process will require the use of Object-Oriented\nModeling with classes, random numbers generation, separate compiling, progressive programming (small\nversions towards the complete version of the program), and data structures.\nYou will develop the game using a software architecture based on the [game-loop\ngame pattern](https://gameprogrammingpatterns.com/game-loop.html).\nYou will also learn how to implement and control an interactive user interface\nrunning on a terminal.\n\n## Gameplay\n\nIn Zombie Dice you and the other players are zombies (🧟) trying to collect brains\nand avoid the very mean humans who are trying to blow you away with their\nshotguns.\nThe player who has the most brains when the game ends will win.\n\nThe game is played over a series of turns following the list of players.\n\n### Rolling the dice in a turn\n\nAt the beginning of a turn you draw three random dice from the **bag of dice** and roll them.\n\nEach die represents a human and there are three possible colors.\nThe green dice (🟩) are weak humans, yellow (🟨) are tougher, and red (🟥) are the strongest humans.\nInitially, the bag of dice has 13 dice: 6 greens, 4 yellows, and 3 reds.\n\nEach die has sides made up of symbols representing\n**brains** (🧠), **shotguns** (💥), and **footprints** (👣).\n\n- Rolling a brain means you ate your victim's brain, which is good; the\n  number of brains you rolled are added to the _brain storage area_ (BSA).\n\n- If you rolled a shotgun it means your victim fought back, and you didn't get\n  their brain; the number of shotguns rolled are added to the _shotgun storage area_ (SSA).\n\n- Footprints mean your victim escaped. This isn't good but at least they didn't\n  shoot you with a shotgun; any footprints rolled are kept in the _dice rolling area_ (DRA).\n\nAfter rolling the dice and sorting them into their corresponding storage areas,\nwe end up with one of two possible outcomes:\n\n1. You have three or more shotguns in the STA, which means\n   you're severely wounded. Your turn immediately ends, and you'll score no points.\n   Then all the dice from the storage areas are returned into the bag.\n   Now the turn passes to the next person in the list of players.\n\n2. You have less than three of these shotgun symbols.\n   You now get to make a choice: (a) stop and score or (b) continue rolling.\n\n### (a) Voluntary stopping and scoring\n\nIf you decide to stop the brains in the BSA are permanently\nadded to your points in the **scoreboard**.\nAfter stopping and scoring your turn ends.\nAll the dice from the storage areas go back into the bag, and\nthe turn is passed on to the next player in the list.\n\n### (b) Continue rolling\n\nBefore you continue to roll, the game must make sure that you always have 3 dice in\nthe DRA to roll.\nIf the number of dice in the DRA is not enough the game gets\nas many new dice as necessary from the bag to complete 3 dice in the DRA.\nRemember that only the footprints dice from previous roll must remain in the DRA;\nthe other dice (brains and shotguns) must remain in their respective storage areas.\n\nAfter a new roll, the game repeats the previous steps to sort the newly rolled dice.\nRecall, however, that anytime you get 3 or more shotguns you score no brains and all the\nthree storage areas are cleared for the next player.\n\n### Types of dice and the bag of dice\n\nAs stated previously, there are three types of dice, each with distinct face configuration, as follows:\n\n1. The green die (🟩): it represents weak humans because it has 3 sides with brains, 1 side with\n   a shotgun, and 2 sides with footprints.\n\n2. The yellow die (🟨): it represents tougher humans because it has 2 sides with brains, 2 sides\n   with shotguns, and 2 sides with footprints.\n\n3. The red die (🟥): it represents the strongest humans because it has 1 side with brain,\n   3 sides with shotguns, and 2 sides with footprints.\n\nHence, each type of die yields different probability of rolling brains.\nThe bag of dice has 13 dice in total, 6 green, 4 yellow, and 3 red.\n\nBefore deciding whether to keep rolling or not the player should consider\n(1) how many brains the player has already rolled, and\n(2) the colors of the dice on the table (i.e. in the BSA, SSA, and DRA) and in the bag, where any new dice would be randomly drawn from.\n\nThe player, however, cannot explicitly see which types of dice are still in the bag.\nOf course, it's possible to deduce that information based on the dice already outside the bag.\n\nIn case the player ever wants to roll again and the number of dice in the bag is not\nenough to complete the required 3 dice in the DRA, all the dice from the BSA must return to the\nbag (the shotguns dice, though, must remain put in the SSA). Of course, the\nplayer gets to keep the number of brains already rolled, so long s/he\ndoes not die during the next rolling actions.\n\nAfter returning these dice to the bag, the player may keep rolling as usual, if s/he wishes so.\nAny new brains rolled are added to the player's previous total.\nSimilarly, any new shotguns are added to the SSA.\n\n### Game over\n\nThe players may continue rolling or stopping like described above until\nsomeone has at least 13 brains in their scored board.\nWhen this happens, the game keeps playing until everyone\nhas had an even number of turns.\n\nThis means that the game does not just end as soon as some player\ngets to 13+ brains.\nAll the other player must complete their rounds so that at the\nend all have played equal amount of turns.\n\nFor instance, suppose we have 3 players in the list.\nIf the Player #1 gets, say, 14 brains by the end of his 5th turn,\nthe game must continue for Player #2, and #3 until they both also\ncomplete 5 turns like Player #1.\nAt this point, the game must indicate that the winner is whoever\ngot more brains, which does not necessary mean the Player #1.\n\n### Breaking a tie\n\nBecause the game must allow all players to finish their turn before\ndeclaring the winner, it is possible that when the last player finishes his final turn,\ntwo or more players have the same amount of 13+ brains.\nIn this case we have a tie.\nThen the tied players, and only those players, must play as many equal\nextra turns as necessary to break the tie.\n\n\u003e [!important]\n\u003e Only the tied player should keep playing to break the tie!\n\u003e Which means you must eliminate the player that are not involved in the tie.\n\nBelow you will find and example of what information you should\ndisplay in the message are in case of a tie.\n\n```\n┌─[ Message area ]────────────────────────┐\n│ We have a tie!                          │\n│ Players in tie break:                   │\n│ \"Marina\" \"Vinicius\"                     │\n│ Press \u003center\u003e to continue.              │\n└─────────────────────────────────────────┘\n🧟\u003e\n```\n\n### Alternative mode of play\n\nThe player may choose an alternative way of controlling the game flow.\nHe or she may define a **max turns** value, which means the game will always\nstop at that fixed number of turns, winning the player with most brains.\n\nOne way of activating this new modality is creating a variable `max_turns` in\nthe config file, under the `[Game]` category.\nIf this value is set to zero, we have the regular modality of playing; otherwise,\nany value greater than zero means the total amount of turns to play, regardless of\nhow many brains each user eats.\n\nAdditionally, you must provide some sort of indication on the interface that the modality\n\"_playing by maximum number of turns_\" has been selected, rather than the\nregular modality of ending a game when one or more players ate 13+ brains.\n\nIn case of tie, the game should follow the _\"Breaking a tie\"_ procedure\ndescribed previously.\n\n## Input\n\nThe primary data input for the program is the list of players identified by their names.\nThis information should be entered soon after the program is run and before the game starts.\n\nAnother input is the configuration file written in [INI](https://en.wikipedia.org/wiki/INI_file) format.\nTherefore, you must write a parser to read the content of the configuration\nfile.\nIn the configuration file, say `zdice.ini`, we set important configuration\naspects of the game, such as:\n\n- The minimal number of brains to win, which is 13 by default.\n- The number of faces and the configuration for the 3 types of dice.\n- The quantity of each of the three types of dice in the bag.\n- The max quantity of players.\n- The max number of turns to play.\n\nHere is an example of a configuration file for the game:\n\n```ini\n[Game]\nweak_dice = 6\nstrong_dice = 4\ntough_dice = 3\nmax_players = 6\nbrains_to_win = 13\nmax_turns = 0 # Value 0 means the game plays without limit of turns.\n\n[Dice]\nweak_die_faces   = \"bbbffs\"\nstrong_die_faces = \"bbffss\"\ntough_die_faces  = \"bffsss\"\n\n```\n\nYour program should receive the path to the configuration file via Command Line Arguments.\nFor instance:\n\n```bash\n./zdice zdice.ini\n```\n\nIf no file is passed to the program or the config file provided is not found, your program should\nassume the default values defined in this document.\n\n## Interface\n\n### The Welcome screen\n\nRunning `zdice` will always display the welcome screen and asks for the list of the players names,\nseparated by commas.\n\nNext, the game must shuffle the player list and indicate which player should start the turn.\nThe shuffled sequence of player will be displayed to the user in the action game screen next.\n\nScreen 01:\n\n```\n$ ./zdice zdice.ini\n\n         ---\u003e Welcome to the Zombi Dice game (v 0.1) \u003c--\n                -- copyright DIMAp/UFRN 2024-2025 --\n\n  The object of the jeopardy dice game Zombie Dice is to be the\n  first to eat 13 or more human brains in a turn.\n  Each player's turn consists of repeatedly rolling 3 dice.\n  A die may produce 3 outcomes: you ate a brain, the human escaped,\n  or you were shot!\n  If you get shot 3 or more times you die and loose all brains you\n  ate in that turn; then the turn goes to the next player.\n  However, if you decide to stop before get shot 3 times, you keep\n  the brains you ate.\n\n  Before we begin, please enter the names of the players\n  in a single line, separated by comma. For example:\n  \u003e\u003e\u003e Jack , Menace, Ultraz, Boris\n\n  Minimum of 2 player, maximum of 6 names.\n  Providing an empty line will end the game.\n  \u003e\u003e\u003e\n```\n\nScreen 02, after the player has entered the names:\n\n```\n  \u003e\u003e\u003e Carvalho, Vinicius,  Marina\n\n  \u003e\u003e\u003e The players of the game are:\n  \"Carvalho\"\n  \"Vinicius\"\n  \"Marina\"\n\n  \u003e\u003e\u003e The player who will start the game is \"Marina\"\n  Press \u003cEnter\u003e to start the match.\n```\n\n\u003e [!note]\n\u003e The contents of the screens above must be modified to reflect the\n\u003e configuration information read from the config file.\n\u003e For instance, if the max of number of dices to play is 5, you\n\u003e must replace 13 by 5 in the Screen 01.\n\u003e\n\u003e Also, in case the player has chosen the modality **max number of turns**,\n\u003e the game should generate a message informing this modality and the maximum\n\u003e number of turns set in the config file.\n\n### The Playing screen\n\nThe play screen may follow the organization below.\n\n\u003cimg src=\"./pics/initial_play.jpg\" width=\"550\"\u003e\n\nThe screen has 5 different regions:\n\n- The title of the game.\n\n\u003cimg src=\"./pics/title.jpg\" width=\"350\"\u003e\n\n- The scoreboard area, which keeps track of how many brains each play has eaten, shows\n  who is the current player (prefix `\u003e`), and how many turns were played.\n\n\u003cimg src=\"./pics/scoreboard.jpg\" width=\"550\"\u003e\n\n- The Dice Rolling Area (DRA) is the table with 3 cells, the Brain Storage Area (BRA) just\n  below the DRA, and the Shotgun Storage Area (SSA), just below the BRA.\n\n\u003cimg src=\"./pics/dra.jpg\" width=\"450\"\u003e\n\n- The message area, which displays proper instructions for the player based on the current game situation.\n\n\u003cimg src=\"./pics/message.jpg\" width=\"450\"\u003e\n\n- The prompt, where the player should enter his/her command.\n\n\u003cimg src=\"./pics/prompt.jpg\" width=\"350\"\u003e\n\nThe next screenshots demonstrate one player rolling the dice 3 times, then deciding\nto hold and keep the brains she ate.\n\n| Screenshots                               | Description                                                                                                                                                                           |\n| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| \u003cimg src=\"./pics/ply_00.jpg\" width=\"350\"\u003e | Marina requested dice roll. Got 2 brains and 1 shotgun.                                                                                                                               |\n| \u003cimg src=\"./pics/ply_01.jpg\" width=\"350\"\u003e | All dice have been sorted to either the BSA or SSA. In this situation we need to get 3 new dice from the bag. Now the player has to choose what to do next.                           |\n| \u003cimg src=\"./pics/ply_02.jpg\" width=\"350\"\u003e | Rolled dice again. In this situation we will need one extra die from the bag.                                                                                                         |\n| \u003cimg src=\"./pics/ply_03.jpg\" width=\"350\"\u003e | Dice sorted to their areas; asked to roll again.                                                                                                                                      |\n| \u003cimg src=\"./pics/ply_04.jpg\" width=\"350\"\u003e | Dice sorted to their areas; choosing to hold.                                                                                                                                         |\n| \u003cimg src=\"./pics/ply_05.jpg\" width=\"350\"\u003e | Main play screen, showing the global score after 1 turn concluded. All brains the player ate were added to the global scoreboard. Next player is shown with the prefix `\u003e`: Carvalho. |\n\n## System Modeling\n\nThe first step is to identify which **entities** might help you model the problem.\nThe second step is to design the Finite State Machine that represents all the possible\ntransitions in the game.\nThen for each state you will have to decide what to read (`process_events()`),\nwhat must change (`update()`), and what to show (`render()`) in each state.\nHere goes some suggestions of entities involved in the problem.\n\n### The `ZDie`\n\nThis entity represents a die in the game.\nIts responsibility is to allow the client to define the number of faces and their values, the type of die (green, yellow, or red) as well\nas to roll the die and yield a random face back to the client.\n\nAll the faces should have the same probability of been selected, i.e. an uniform distribution.\n\n### The `Player`\n\nThis entity represents a single player.\nThe class is primarily responsible for keeping the player's name, and how many brains s/he has eaten so far.\nFeel free to add other attributes or responsibilities to this class, such as how\nmany turns have been played, or even some player state, such as `hungry`, at the beginning of a turn,\nand `satiated`, when the player has eaten enough brains to win.\n\n### The `DiceBag`\n\nThis entity is responsible for storing the dice and providing methods to\nrandomly draw 3 dice and occasionally receive some dice back for future draw.\nIt should also offer method for shuffle the bag, and possible some common access\nmethod to inform, for instance, how many dice are still inside the bag.\n\n### The `GameController`\n\nThis entity represents the game manager and is the most important class in this suggested modeling scheme.\nThe `GameController` is responsible for implementing the [Game-Loop architecture](https://gameprogrammingpatterns.com/game-loop.html) to control the game flow.\nIt is also the entity that \"owns\" the list of players, the dice bag, etc.\n\nIt is also responsibility of this class to keep the overall score, manage turns, resolve ties,\nand inform who is the winner of the game.\n\n## Output\n\nThe output of the program is the sequence of screens showing the game state as the game progresses.\n\nNote that it is no necessary to worry about clearing the screen. Just send the text to the\nstandard output and this will naturally roll the screens up in the terminal.\n\nTo have the best user interface experience while playing, try to resize the terminal window\nwhere the game is running so that it fits perfectly the main playing screen.\n\n### Error Management\n\nThere are just a few situations that may cause an error while playing the game.\nHere is non-exhaustive list of such error situations:\n\n- Providing a configuration file that does not exist. In this case the game assume default values.\n\n- If your program reads any configuration file, it must be validated. Any invalid fields may be ignored.\n\n- The user types in an invalid command while playing. You may ignore invalid commands or print\n  a warning message in the Message area of the interface.\n\n- User entering less or more player names than, respectively, the minimum and maximum allowed. In this case you may\n  ignore any name beyond the maximum. If you have too few names, you have to ask the user to provide\n  the minimum number of player names to continue.\n\n## Assignment Grading\n\nThis assignment has a total of **120 points**. Bellow is a table with the description of the item under consideration and the assigned grade _if the item is totally correct_. Partial grade will be considered if the item is not fully correct.\n\n| Item                                     | Value (points) |\n| ---------------------------------------- | :------------: |\n| The project contains at least 2 classes  |       7        |\n| Show help as requested `-h`              |       4        |\n| Read player names                        |       10       |\n| Show all 5 regions in user interface     |       12       |\n| Keeps overall scores                     |       5        |\n| Keeps bag of dice consistent             |       5        |\n| Handles automatic turn hand over         |       5        |\n| Handles hold requests                    |       5        |\n| Handles roll requests                    |       5        |\n| Handles ties                             |       12       |\n| Move brains dice back to bag when needed |       10       |\n| Manages turns correctly                  |       5        |\n| Reads configuration file                 |       15       |\n| Handles user errors                      |       5        |\n| Show winner correctly                    |       5        |\n| Program working fine                     |       10       |\n\nThe following situations may take credits out of your assignment, if they happen during the evaluation process:\n\n| Item                                              | Value (points) |\n| ------------------------------------------------- | :------------: |\n| Compiling and/or runtime errors                   |       -5       |\n| Missing code documentation in Doxygen style       |      -10       |\n| Memory leak                                       |      -10       |\n| [`author.md`](docs/author.md) file not filled out |      -10       |\n| Program crashes while testing                     |       -5       |\n\nThe [`author.md`](docs/author.md) file should contain a brief description of the project, and how to run it. It also should describe possible errors, limitations, or issues found. Do not forget to include the author name!\n\n## Extra credits\n\nYou may earn extra credits if:\n\n- **[10 points]** Your program offers the possibility of creating a player controlled by an algorithm.\n  The machine player is a piece of code you have to code, and it should be able to choose\n  between _roll_ or _hold_, based on the current game situation.\n  A machine player that only chooses randomly one of the two action will not be considered for extra credit.\n\nAny extra credit will be considered **only** if all the regular items have been implemented.\n\n# Authorship and Collaboration Policy\n\nThis is a pair assignment. You may work in a pair or alone. If you work as a pair, comment both members' names atop every code file, and try to balance evenly the workload.\n\nAny team may be called for an interview. The purpose of the interview is twofold: to confirm the authorship of the assignment and to identify the workload assign to each member. During the interview, any team member should be capable of explaining any piece of code, even if he or she has not written that particular piece of code. After the interview, the assignment's credits may be re-distributed to better reflect the true contribution of each team member.\n\nThe cooperation among students is strongly encouraged. It is accepted the open discussion of ideas or development strategies. Notice, however, that this type of interaction should not be understood as a free permission to copy and use somebody else's code. This is may be interpreted as plagiarism.\n\nAny two (or more) programs deemed as plagiarism will automatically receive **zero** credits, regardless of the real authorship of the programs involved in the case. If your project uses a (small) piece of code from someone else's, please provide proper acknowledgment in the [`author.md`](author.md) file.\n\n# Work Submission\n\nBoth team members must submit a single zip file containing the entire project via SIGAA before the deadline. This should be done only via the proper link in the SIGAA's virtual class.\n**Submission via email shall be ignored!**\n\nThe same project must, also, be commited before the same deadline to the proper GitHub repository created by the GitHub Classroom assignment.\n\nAny commits made after the deadline will make your project be evaluated as a **later submission**. This means that your project's grade will probably be reduced, even if the project is completely correct.\n\nRemember to remove all the executable files (i.e. the `build` folder) from your project before handing in your work.\n\n---\n\n\u0026copy; DIMAp/UFRN 2024-2025.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandroaa01%2Fzombie-dice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandroaa01%2Fzombie-dice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandroaa01%2Fzombie-dice/lists"}