1. Login system:

Password for the game is set to "21DiceGame21" and your program should randomly ask for 3 letters in random positions(position start from 1 and not 0) for example

Type the character in position 4: i
Type the character in position 6: e
Type the character in position 8: a

If all three letters match the letters in those positions then display as correct password and start the game otherwise continue to repeat the step for asking 3 random letters in random positions.

2. Dice game play:

This is a two-player dice game.

The player rolls two 6-sided dice once in each round and there will be a maximum of 5 rounds.

Point for the rounds are calculated as follows:

If we consider dice1 and dice2 as values of first and second 6-sided dice then

  • For different dice1 and dice2 values points will be the addition of the dice1 and dice2 values.
  • For similar values of dice 1 and dice 2 follow these rules for calculating points

Dice1 Dice2 Points
1 1 75 points added to their score
2 2 Subtract 50 points from their score
3 3 100 points added to their score
4 4 Subtract 75 points from their score
5 5 Points will be set to 0
6 6 Lucky! 300 points added to their score

Cumulative points(Addition of points from all 5 rounds) for each player must be displayed after every round.

Game for a player should only be stopped under the following circumstances:

  • If the player reaches 300 points in any of the 5 rounds.
  • If the player reaches a score below 0 in any of the 5 rounds.
  • If the player's cumulative points reach either 300 or below 0 (For example round1=50 and round2=250 points will be 300 after 2 rounds)
  • After 5 rounds.

Winner of the game:

1. Player with the overall highest points should be displayed as a winner along with their points after 5 rounds.

2. If both the players' points are equal, then the players have to play 2 tiebreaker rounds to find the winner. Both the players points will start from 0 for the tie-breaker rounds. If the result from tie-breaker rounds end up in a tie then display the final result as draw otherwise display the winner with the highest points in tiebreaker rounds i.e. addition of points in tie-breaker round1 and round2.

Sample Output 1: see image.

Sample Output 2: When both the players score a negative value. see image.

Sample output3: Output for tiebreaker round results. see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.