Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use helper blocks together into game loop and to provide the player with information using your History table. Basic game loop should look like this:

Use helper blocks together into game loop and to provide the player with information using your History table. Basic game loop should look like this: 1. Program asks Player how many letters the secret code should have, then generates a code of the correct length. The Program should announce the length of the secret code again not the actual code.

2. After the Player makes a guess, the Program should check the validity of the guess. If the guess is of the wrong length or contains letters not in R, O, Y, G, B, V, the guess is invalid. You should create appropriate error messages for the following cases:

a. Guess is too long

b. Guess is too short

c. Guess contains letters not in R, O, Y, G, B, V

This error checking should occur for every guess. If two error messages apply to a guess (e.g. the guess is too short and contains letters not in R, O, Y, G, B, V), then the Program can display just one of the two error messages.

Example: Player: ROY Computer: Guess too short; it has to be exactly 5 letters. Please guess again. Player: ROYGBV Computer: Guess too long; it has to be exactly 5 letters. Please guess again. Player: BJJJC Computer: Guess can only contain the letters ROYGBV. Please guess again. 3. If the guess is valid but incorrect, the Program should then display the following information. Use the blocks you coded in earlier parts of this project to help you calculate: a. Whether the guess was right or wrong b. How many letters were correctly positioned in the code c. How many letters were in the code but out-of-place For example: Player: ROYG Computer: No, but 1 letter is/are "correctly positioned" and 1 is/are "out-of-place".

4. If the guess is valid, the guess, and the number of correctly placed and out-of-place letters should also be stored in the History table. This should be updated with new information after each guess, and cleared for each new game. The History table should not include invalid guesses (that do not pass the error checks). You should create a global variable HISTORY as a list of lists, with column headers as the first row. (The reason this is stylized in all-caps is because this is commonly done in industry programming to differentiate global variables from script variables.) It should look something like this:

5. When the player guesses the correct code, the Program should display how many valid guesses it took for the Player to guess the secret code, and the game should stop.

ALL CUSTOM BLOCKS MUST BE USED TO CREATE GAME.

generate code of length 6 from list R O Y GB V

correctly placed of WOG and GOVG

keep characters of VVOG not at same place in GOVG keep characters of GOVG not at same place in WVOG

occurrences of V in list VVO out-of-place of VVOG and GOVG

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions