Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. The game is Pick Up Sticks. Below is the pseudo code for the problem. Implement the problem using Python code. Set maximum number of

2. The game is Pick Up Sticks. Below is the pseudo code for the problem. Implement the problem using Python code.

Set maximum number of sticks a player can take to 4

Set minimum number of sticks a player can take to 1

Set total number of sticks to 13

Set current player to player 1

Display game instructions

While there are still sticks in pile

Ask current player how many sticks he or she wants

While current player asks to take more than number of sticks left or more than maximum or less than minimum

Ask current player how many sticks he or she wants

Reduce number of sticks in pile by number of sticks current player asked to take

If no sticks left

Current player wins

Make current player other player

Challenge: Dont announce the number of sticks left at the end of each turn, and make the players guess the exact number to end the game. If the player guesses wrong, the turn goes back to the other player. See the figure below. image text in transcribed

7Python Shell File Edit Shell Debug Options Windows Help Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v. 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license ("for more information. Welcome to Pick Up Sticks! Each player takes turns picking up from 1 to 4 sticks from a pile of 13 sticks. Whoever picks up the last stick wins. There are 13 stick(s) left. Player 1 - how many sticks will you take? 4 There are 9 stick(s) left. Player 2 - how many sticks will you take? 4 There are 5 stick(s) left. Player 1 - how many sticks will you take? 4 There are 1 stick(s) left. Player 2 - how many sticks will you take? 4 You can' t take 4 sticks Hou many will you take? 4 You can' t take 4 sticks Hou many will you take? 5 You can' t take 5 sticks Hou many will you take? 1 Player 2 wins! Press the enter key to exit. Ln: 40 Col: 4

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 Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

5. Have you stressed the topics relevance to your audience?

Answered: 1 week ago