Assignment:the algorithm which generates stars and bars - Comb() (comb.txt), sha
ID: 3673444 • Letter: A
Question
Assignment:the algorithm which generates stars and bars - Comb() (comb.txt), shall be provided. Do not hard code the combination sequences. The stars and bars will be generated for 4 stages of the game: 6 combination 5 (stage 1), 6 combination 4 (stage 2), 6 combination 3 (stage 3) and 6 combination 2 (stage 4).
Task is to implement a “guess the next sequence” game. Given a sequence of stars and bars, the user should guess the next sequence. The user has total of three guesses, but if they get the third guess sequence wrong they move on to the next available guess, but show the user the correction. However, if the guess sequence is correct, the user is presented with another sequence to guess and only moves on to the next stage if the number of incorrect guess is less than 1/2 of the total number of guesses.
Consider the following restrictions:
1. The number of guesses must be between 2 1/2 of the total number of combination; for example, for 6 combinations 2 (15 possibilities), The total number of guesses should be a random number between 2& 7 (inclusive).
2. The first 2 combinations shall not be included as part of the guess game
3. If the total number of incorrect user guesses exceeds 1/2 of the total number of guesses, game over. Else the user moves on to the next level.
4. At the end of each stage, notify the user about the transition to the next stage. At the end of the game, show the user number of incorrect guesses.
Explanation / Answer
template std::vector multichoose(int k, std::vector& objects) { std::vector choices; int j,j_1,q,r; r = objects.size() - 1; std::vector a, b; // combination indexes for (int i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.