CS2223 PROGRAMMING ASSIGNMENT #1 DOUBLE TROUBLE Solved

35.00 $

Category: Tags: , , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (6 votes)

In class we played a game called “Double Trouble”, which consists of:

  • Three (3) green markers,
  • Seven (7) yellow markers, and
  • Five (5) orange markers.

Two players take turns removing as many markers of a single color as they wish. The player who removes the last marker wins.

  1. “Double Trouble” is really a particular instantiation of the fundamental combinatorial game. What is the real name of the game, who “solved” it, and when? Where does it show up in popular culture? [2 bonus points]
  2. Write a C++ program to play “Double Trouble”. Your program should containthe input/output functionality necessary to have the user decide who goes first and enter (only!) legal moves in alternation with the computer. The computer need not play well but should declare a winner when appropriate and then should terminate correctly. [10 points]
  3. Write the necessary C++ code that will allow the computer to make a winningmove whenever such a move is available to it. You may do this in any way you wish. It can be a stand-alone function or internal to the main You may use built-in operators or design your own routine. [5 points]
  4. Put it all together into a coherent package. The computer should win when ithas a winning strategy and should make random moves when it does not. Also, the random moves should be independent from one run of the game to another. That is, if you play in such a way that you win, the computer should not lose the same way each time. [15 points]

Also, feel free to personalize your game. Have it play a best-of-(2n + 1) tournament, alternating who moves first or randomly deciding who moves first. Have your program celebrate in victory or whimper in defeat. It may not cheat, however. No springs, honest weight!

1

                2                                              THIRTY POINTS DUE: OCTOBER 30, 2019 11:59 PM

The overall purpose here is to get you to dig in to C++ and get familiar with whatever IDE (Integrated Development Environment) you/we choose to use.

The first part requires basic setup (#include, variable definition, etc.), input/output statements, branching (if ), and looping (for, while), perhaps. The concepts transfer easily from Java, but they require a little attention.

The second part requires computations, procedures, and functions (perhaps).

The third part requires the rand() and srand() functions (perhaps) and some additional setup to make them work.

Strategy recap:

  • hw1-4-yj0ss0.zip