Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help me solve this progrem in python. PROBLEM: ACSL Tiles is a one - person game played with rectangular tiles. Each tile has a single
Help me solve this progrem in python. PROBLEM: ACSL Tiles is a oneperson game played with rectangular tiles. Each tile has a singledigit number, at each end. At the start of the game, there are rows, each with a singledigit number from ; thus the number represents the starting numbers Tiles can be reoriented; thus, the tiles and are the same tile. Tiles, called the hand, are given to the player, and other tiles are put into a draw pile. The initial number of tiles in your hand and in the draw pile varies from game to game. The goal of the game is to build rows by placing a tile from your hand at the right end of a row whose last number matches one of the numbers on the tile. If no tiles in your hand can be placed, tiles are added to the end of your hand from the draw pile, until a tile from the draw pile can be placed. More specifically, on each turn, try to match your tiles starting with the first one in your hand. See if any can be added to one of the rows, starting with the row after the one where the last tile was placed, rotating back to Row if necessary. Start looking at Row when the game starts. However, if the last tile placed was a double ie both numbers are the same another tile must be placed on that row before any other match can be considered. If you cannot place any tiles in your hand, add tiles from the draw pile to your hand until a tile can be placed. The game ends when you've placed all tiles in your hand OR you cannot place any of the tiles in your hand and you've exhausted the draw pile. At that point, find the sum of the singledigit numbers that are still in your hand. Row : Row : Row : Row : The tile is placed on Row ; the tile is placed on Row ; the tile is placed on Row note that it's rotated, so that the matches; the tile is kept in your hand; and the tile is placed on Row The is a double, so the next tile to be placed must match a None of the tiles in your hand match, so is added to your hand from the draw pile. That tile cannot be placed, so it stays in your hand. Next the is drawn; it can be placed on Row Your hand is now and the draw pile is The following moves are made: on Row rotated on Row on Row on Row rotated on Row on Row on Row Here is what the board looks like: Row : Row : begintabularllhline & hline endtabularbegintabularllhline & hline endtabular Row : Row : The tiles left in your hand are and ; neither can be placed, so draw it cannot be placed then it cannot be placed and then The can be placed on Row Your hand is now and the draw pile is empty. The tile can be placed and then the game is over. The final board is as follows: Your hand is so the sum of the singledigit numbers on those tiles is INPUT: Input an integer, between and inclusive, that gives the initial numbers from Row to Row It is followed by two strings of numbers, from to inclusive, each separated by a single space. The first string has the tiles in your hand; the second string has the tiles in the draw pile. The numbers in each string represent the two numbers on each tile; a singledigit number indicates that at least one of the numbers on the tile is a OUTPUT: After placing the tiles using the rules above, output the sum of the singledigit numbers on the tiles left in your hand. If you've placed all of your tiles, then you'll output a SA MPI F INPITT: SAMPLE OUTPUT: TEST OUTPUT:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started