
I need a program created in python
- or -
Post a project like this2597
£20(approx. $27)
- Posted:
- Proposals: 3
- Remote
- #1915943
- Awarded
Description
Experience Level: Entry
I need a program in python that will play the NIM game. This is a 2 player game where a randomly sized set of straws is used. Each player will take turns to remove 1-3 straws from the pile at each turn. The player that removes the final straw loses.
I need two modes. The first mode is Human vs Computer novice mode. The specification is:
The program will first generate a random number in the range 10 – 20 inclusive to represent the number of straws
The two players alternate in turns with the computer going first.
Each turn, the current player must remove 1 – 3 straws. The program then displays the
number of straws remaining on the screen.
The game continues until all straws have been removed. The player that removes the last
straw loses.
Once the game is complete, a message will appear on the screen saying who won (human or
computer) then the user will be asked If they wish to play again and if so the game should
begin again.
The strategy for the computer player should be to simply generate a random number in the
range 1-3 inclusive and remove that many straws.
The second mode is Human vs computer expert mode. Specification is:
If the number of straws remaining is one more than a multiple of four the computer will pick just up one straw
If the number of straw is not a multiple the four the computer will pick up the number of straws that leaves one more than a multiple of four if that is possible (only a maximum of 3 straws is allowed)
If number of straw smaller or equal to 4 just the compute will aim to leave one straw
If none of the above rules can be applied the computer will pick up a random number
between 1 and 3 of straws
The game should be modified so the user will select which mode the computer should play novice or expert.
I need two modes. The first mode is Human vs Computer novice mode. The specification is:
The program will first generate a random number in the range 10 – 20 inclusive to represent the number of straws
The two players alternate in turns with the computer going first.
Each turn, the current player must remove 1 – 3 straws. The program then displays the
number of straws remaining on the screen.
The game continues until all straws have been removed. The player that removes the last
straw loses.
Once the game is complete, a message will appear on the screen saying who won (human or
computer) then the user will be asked If they wish to play again and if so the game should
begin again.
The strategy for the computer player should be to simply generate a random number in the
range 1-3 inclusive and remove that many straws.
The second mode is Human vs computer expert mode. Specification is:
If the number of straws remaining is one more than a multiple of four the computer will pick just up one straw
If the number of straw is not a multiple the four the computer will pick up the number of straws that leaves one more than a multiple of four if that is possible (only a maximum of 3 straws is allowed)
If number of straw smaller or equal to 4 just the compute will aim to leave one straw
If none of the above rules can be applied the computer will pick up a random number
between 1 and 3 of straws
The game should be modified so the user will select which mode the computer should play novice or expert.

Frank P.
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
1 Mar 2018
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies