Base Rules of the game(2 Player Game) :-
- One player writes down a random number between 0-6.
- The other player tries to guess the same number as that of the other player.
- If both the number matches then the player who is on bat gets out.
- Else the player who is on bat scores the run which he chooses at each turn until they both have a match of the same number.
- The player who scores more runs wins the game in a limited number > of tries.
Assume Program to be Player 2
- The program should asks the user for number of overs in the game
- The program generates a random score ranging between [ 0 to Number of overs * 36 ] . This is the score for the computer. The user must reach this goal.
- The program now generates a random number between 0 and 6 for each turn
- Then it takes input from the user. Based on input a. If the number matches, the player is declared out b. Else the runs scored gets added to the scorecard
- The game goes on until - a. The number of overs are completed b. The batting player gets out c. The players scores more than computer
- At the end of the game, the program should display which team(Computer/ User) won the game by how many runs.
- Program must be fully function based.
- Code should not be plagiarized.
- Input must be between 1& 6 for the player when he/she bats
Enter number of overs : 1 (Player input) Computer has scored 13 runs. Your target 14 runs
Over 1 Ball 1 Enter number to bat : 3 (Player input) Computer’s number : 5 Total Runs : 3
Over 1 Ball 2 Enter number to bat : 4 (Player input) Computer’s number : 1 Total Runs : 7
Over 1 Ball 3 Enter number to bat : 3 (Player input) Computer’s number : 3 Total Runs : 7
You are Out
Computer Won the gam