The Game of Nim: The game of Nim starts with a random number of stones between 15 and 30.  Two players alternate turns and on each turn may take either 1, 2, or 3 stones from the pile.  The player forced to take the last stone loses.  The computer player will make random choices during their turn.  Your program must check to make sure that neither the computer nor the human player attempts to take 3 if there are only 1 or 2 stones left.  The computer should only take 1 or 2 stones when 3 are left, and only 1 stone when 2 stones are left.   Make sure you are using functions, importing random, and making it at around grade 10 coding levels, haha!

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Question

The Game of Nim: The game of Nim starts with a random number of stones between 15 and 30.  Two players alternate turns and on each turn may take either 1, 2, or 3 stones from the pile.  The player forced to take the last stone loses.  The computer player will make random choices during their turn.  Your program must check to make sure that neither the computer nor the human player attempts to take 3 if there are only 1 or 2 stones left.  The computer should only take 1 or 2 stones when 3 are left, and only 1 stone when 2 stones are left.   Make sure you are using functions, importing random, and making it at around grade 10 coding levels, haha! 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage