Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi can you please do the Codes in C++ for both parts? Part 1 and Part 2 please. Write the full code for both and

Hi can you please do the Codes in C++ for both parts?
Part 1 and Part 2 please. Write the full code for both and show the output of the code. as well. Thank you image text in transcribed
Part 1 Normal Mode You are required to develop a simple game using C++ programming where the human player competes against the computer. The game starts with 22 pebbles and a bomb inside a box During each turn, each player is required to remove between 1 to 3 pebbles out of the box. The human player will always take the first turn. The bomb is set to detonate when there are no more pebbles in the box, effectively ending the game by killing whichever player who removed the last pebble. The computer will make a move based on the following logic. If there is 1 pebble remaining the computer will have no choice but to take If there are 2 to 4 pebbles remaining the computer will remove enough pebbles so that only 1 pebble remains in the box If there are more than 4 pebbles remaining, the computer will remove (4 - Y) pebbles, where is the number of pebbles the human player removed from the box in the previous tum. Your program must ensure the player does not take more than the allocated pebbles during each turn or take more pebbles than what is left in the box Your program must also include the use of else", and "case". Use comments to explain the flow of your code res er to 22 de pebbles in the box 16 les et There are 14 peles de the box het ble ta the to ere are 18 esineb were Fok 18 i re Enter reare pebbles in the dre 1.11 There are in the PI les in the the we (b) Fig. 1: Example of a game where the human player is the (a) winner and (b) loser alleman There are ps in TN SOM des Reg. der Fig. 2. Example of an error message whenever the user enters Invalid Input Part 2: Easy Mode Modify your code to create an "Easy mode where the computer wil intentionally let the human win as quickly as possible

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

Develop a program for effectively managing diversity. page 303

Answered: 1 week ago

Question

List the common methods used in selecting human resources. page 239

Answered: 1 week ago