SE1012 PM Assignment 2024
SE1012 PM Assignment 2024
In this assignment, you will implement a simplified version of the classic dice game Yahtzee in
C. The game will be a two-player version where the human player competes against the
computer. The computer will be programmed to play optimally, making the best decisions based
on the game state. The game will consist of multiple rounds where both players roll dice, make
strategic decisions, and accumulate scores based on predefined categories.
What is Yahtzee?
Yahtzee is a classic dice game that challenges players to score points by rolling five dice to make
specific combinations. The game is typically played over 13 rounds, and in each round, players
can roll the dice up to three times. After each roll, they can choose to keep or re-roll any number
of dice in an attempt to achieve a higher score in one of several scoring categories.
The goal is to achieve the highest score by the end of the game.
Before you begin implementing your Yahtzee game, it's important to understand the rules and
gameplay thoroughly. You can play Yahtzee online to get a feel for the game and its mechanics.
Here are two free online versions you can try:
- [CardGames.io Yahtzee](https://cardgames.io/yahtzee/)
- [Solitaired Yahtzee](https://solitaired.com/yahtzee/)
Spend some time playing these versions to familiarize yourself with how Yahtzee works before
starting your coding project.
Assignment Objectives
• Understand the game mechanics of Yahtzee.
• Implement a two-player Yahtzee game where the human player competes against the
computer.
• Apply strategic decision-making by programming the computer to make optimal choices.
• Develop skills in handling arrays, control structures, functions, and game logic in C.
Assignment Specifications
1. Game Setup:
o The game consists of 13 rounds.
o Each player (human and computer) takes turns rolling five dice.
o In each turn, the player can roll the dice up to three times. After each roll, the
player can choose which dice to keep and which to re-roll.
2. Scoring Categories:
Implement the following scoring categories:
o Ones, Twos, Threes, Fours, Fives, Sixes
o Three of a Kind
o Four of a Kind
o Full House
o Small Straight
o Large Straight
o Yahtzee
o Chance
3. Computer Player:
o The computer player will always choose the best available option to maximize its
score.
o The computer will analyze the current state of the dice after each roll and decide
whether to keep or re-roll certain dice to achieve the highest possible score in a
category.
o The computer will automatically select the optimal category for scoring after the
final roll in each round.
4. Human Player:
o The human player will manually choose which dice to keep or re-roll after each
roll.
o The human player will also select the category in which to score their roll after
their final roll in each round.
5. Game Flow:
o At the beginning of each round, both players will roll their dice.
o The human player will be prompted to choose which dice to re-roll (if any).
o The computer will automatically decide which dice to re-roll based on its optimal
strategy.
o After the third roll or after both players choose to keep their dice, the game will
move to the scoring phase.
o The round score will be calculated based on the chosen category for each player.
o The game continues for 13 rounds.
Deliverables
1. Code Submission:
o Submit your C source code implementing the two-player Yahtzee game. Ensure
the code is well-commented and modular, with functions handling game logic,
scoring, and AI decisions.
o Include a report (2-3 pages) explaining:
▪ The strategy used for the computer player.
▪ Challenges you faced during implementation and how you addressed
them.
▪ Any features that were not implemented.
2. In-Person Demonstration & Viva:
o A 10-15 minute in-person demonstration and viva will be conducted between Nov
2nd - 8th, 2024. During this session, you will be asked to:
▪ Demonstrate your working game.
▪ Explain your implementation, strategy, and problem-solving approach.
▪ Answer questions related to the code and logic.
Grading Criteria
• Report (20%):
o Clarity in explaining the strategy for the computer player.
o Explanation of challenges and their solutions.
o Depth of reflection on what was or wasn’t implemented.
• In-Person Demonstration and Viva (80%):
o Functionality (50%): The program must correctly implement all game
mechanics, including dice rolls, scoring, and handling multiple rounds.
o Computer AI (20%): The computer player should make optimal decisions based
on the game state.
o Code Structure (20%): Code should be modular, well-commented, and easy to
follow.
o User Experience (10%): The game should have clear prompts and outputs,
making it easy for the human player to interact with.
Submission Instructions
1. Deadline: Submit your code and report by November 15th, 2024, 11:59 PM.
2. Submission Platform: Submit your .c source code and report as a ZIP file via
CourseWeb Submission portal.
3. Viva Dates: In-person demonstrations and viva will be scheduled between November
20th - 27th, 2024.