Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program that plays Pickup Sticks for 2 human players and call it _sticks.cpp. Create an algorithm for the program before starting to write

Create a program that plays "Pickup Sticks" for 2 human players and call it _sticks.cpp. Create an algorithm for the program before starting to write code.

Your program should behave as follows:

*** Welcome to Pickup Sticks *** Enter name of player 1: David Enter name of player 2: Pam (21) | | | | | | | | | | | | | | | | | | | | | David - How many sticks? 2 (19) | | | | | | | | | | | | | | | | | | | Pam - How many sticks? 3 (16) | | | | | | | | | | | | | | | | David - How many sticks? 4 Sorry David, you must take between 1 and 3 sticks. David - How many sticks? 3 (13) | | | | | | | | | | | | | Pam - How many sticks? 2 
(11) | | | | | | | | | | | David - How many sticks? 3 
(8) | | | | | | | | Pam - How many sticks? 3 (5) | | | | | David - How many sticks? 1 (4) | | | | Pam - How many sticks? 3 (1) | David - How many sticks? 2 Sorry David, only 1 stick(s) left. David - How many sticks? 1 David took the last stick. Pam wins! Play again? y Enter name of player 1: .... Enter name of player 2: .... ... Play again? n *** Thanks for playing Pickup Sticks *** 

Extra credit will be awarded for making the computer play a perfect game... (+3 points).

Be sure to test your program thoroughly so that it behave correctly no matter the number of sticks left or taken.

Document your code thoroughly including block comments at the beginning and in-line comments throughout.

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 Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

Students also viewed these Databases questions