A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter13: Decision Making Under Uncertainty
Section13.4: Decision Trees
Problem 9P
icon
Related questions
Question

A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins.

For example:

  • number of passes = 1 and number of players   = 5, the order of elimination is 2, 4, 1, 5.   

Write a program for general values of X and N.

  • Ask a user for the number of people and number of passes
  • To speed up the input and debugging, you may wish to store the names of the people in a file. Make sure no two names start the same letter ( Alex and  Ana are not OK). Alternatively, you can number the players.
  • Output number and/or the name of a person being eliminated
  • Output number and the name of the winner
  • Do not expect a user to do the right thing, error check the user input; among other things, what do you think a reasonable minimum number of players would be?
  • Allow user to play the game as many times as the user wants
  • Node and List must be classes
    • classes must adhere to best practices and standards
    • if any part of an object is a pointer or dynamically allocated, follow the rule of three
  • use try/catch to check dynamic memory allocation C++ Dynamic Memory Allocation Supplement Download C++ Dynamic Memory Allocation Supplement
  • Make sure each function has a description, post, and pre-conditions
 
 
 
PreviousNext
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole