Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C++ and add comments. You have time until Jan 3, so please take your time, thank you. NIM Nim is a simple game

Please use C++ and add comments. You have time until Jan 3, so please take your time, thank you.

image text in transcribed

NIM Nim is a simple game that can be played with matchsticks. Two players, in turn, remove a number of matchsticks from the board. The player who left with the last matchstick losses the game. In the board of Nim, the matchsticks are arranged in multiple rows having 2n+1 matchsticks in each row. An example of the board in a 4-line configuration is given below. I III IIIII IIIIIII The rules of the game are as follows The game is played in turns, The player can remove matchsticks from only single row in their turn. They can remove any numbers of matchstick from the selected row. How- ever, they cannot remove matchsticks from multiple rows in one turn. The player who removes the last matchstick losses the game. Mathematically, it is possible to make an unbeatable computer as long as the opponent starts the game. QUESTION Write a C++ application for Nim game. 1. (25 point) Prepare the functionality for showing the current status of the board. 2. (25 point) Prepare the functionality for playing the game, i.e. getting inputs from the user to remove matchsticks until the game ends. 3. (25 point) Prepare the functionality for making the computer unbeatable. 4. (25 point) Prepare an user interactive interface (in console) for the game, e.g. start game, play in two players, play against computer etc

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Prove Equation (5.22).

Answered: 1 week ago