Question: Write a program with the specified below: - Size of the field: the program reads a line of input specifying the number of rows (
Write a program with the specified below:
Size of the field: the program reads a line of input specifying the number of rows and columns in the field
The field contains jewels that are these uppercase letters and only these letters be use: S T V W X Y Z
The game starts in either one of two situations: with an empty field, or with specifying the contents of the field in the input. Empty field, the word EMPTY will appear alone on the next line of input. Specify the contents of the field in the input, the word CONTENTS will appear alone on the next line of input. Given that there are r rows and c columns in the field, then there r lines of input, each of which will contain exactly c characters; characters represent the contents of each of the field's cells to start with: for a cell that should contain a jewel of some color, an uppercase letter describing each color will be used; for a cell that should be empty, a space will be used instead; note that when we're specifying the contents of the field explicitly, the spaces will always be present in the input for every cell that's empty; the program should expect to read exactly the correct number of characters.
Game begin, the program repeatedly does things: display the field and then read a command from the user
The rules: given field has r rows, the field will be displayed as a total of r lines of output. The first r will correspond to the r rows of the field, which each row displayed like this: The vertical bar character followed by three characters for each of the c columns in that row, followed by another vertical bar character For each column in that row, the three characters will be: Three spaces if the cell is empty; A space, followed by an uppercase letter, followed by another space if the cell contains a jewel that has been frozen; A left bracket character followed by an uppercase letter, followed by a right bracket character if the cell contains a jewel that is part of the faller if any; A vertical bar character followed by an uppercase letter, followed by another vertical bar character if the cell contains a jewel that is part of a faller that has landed but not yet frozen; An asterisk character followed by an uppercase letter, followed by another asterisk character if the cell contains a jewel that has frozen and has been recognized as a match. After the last row of the field, a space, followed by c dashes, followed by another space is displayed.
The commands would read are: A blank line, which is a crude representation of the passage of time if there is a faller present, it falls; if there faller landed and has not been moved so that it is no longer in a landed position it freezes; and so onF followed by an integer of column number, followed by three uppercase letters representing colors each of these things separated by spaces ex:F S T V command has no effect if there is a faller that has not already been frozen. R for rotates the faller, if there is one. If there is no faller currently, command has no effect. for moves the faller one column to the left, if there is one and if it not blocked by jewels already frozen on the field or by the edge of the field If no faller or the faller can't be moved to the left, command has no effect. Note, though, that it is possible to move a faller that has landed but not yet frozen, which can take it out of its "landed" status if it moves to a column with nothing underneath it for moves the faller one column to the right, if there is one and if it not blocked by jewels already frozen on the field or by the edge of the field If no faller or the faller can't be moved to the right, command has no effect. Q to quit the program, ways for the program to end are Aif the user specifies the command Q the program ends, no output printed; Bwhen a faller freezes without all three of its jewels being visible in the field ex: if it lands on a jewel that's two rows below the top and then freezes the game ends, so the program ends, as well. In that case, print GAME OVER before ending the program. Note that matching can keep the game from ending in this case ie if the freezing faller triggers matching that causes it to fit after jewels disappear, the game doesn't end; C when a faller is created in a column that is already filled with frozen jewels
Please have module: game mechanics, user interface, and test case using unittest module musthave Use sample input and must have output exactly the same as expected output provided last image Meet the features as much as possible. Please have brief explanations of how functions work, thank you.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
