Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The first parameter represents the game state, the second parameter is the section number of the section to be changed, and the third parameter is
The first parameter represents the game state, the second parameter is the section number of the section to be changed, and the third parameter is the move to be applied to the string. The move will be one of SWAP or ROTATE. change_state (str, int, str) -> str This function should return a new string that reflects the updated game state after applying the given move to the specified section. For example, if the section length is 4, and this function is called change_state('wrdokoclgmae', 2, 'S'), then the function should return 'wrdolockgmae'. In this function only, you may assume a fixed section length of 3. The first parameter represents a game state, and the second parameter represents the number of a section in the game state that is not yet unscrambled. This function should return a move (either SWAP or ROTATE) that will help the player rearrange the specified section correctly. get_move_hint (str, int) -> str Use your creativity here, but make sure to give hints that if used in progression, should never produce the same game state twice. For example, always telling the user to play SWAP on a section 'ATC' each round will cause that section of the game state to go back and forth between 'ATC' and 'CTA' and never to get to the answer('CAT'). If a player repeatedly follows your hints, they should be guaranteed to end up solving the game. Hint: Consider the cases in which SWAP is a bad move to make. Note that this function may not work if SECTION_LENGTH is anything other than The first parameter represents the game state, the second parameter is the section number of the section to be changed, and the third parameter is the move to be applied to the string. The move will be one of SWAP or ROTATE. change_state (str, int, str) -> str This function should return a new string that reflects the updated game state after applying the given move to the specified section. For example, if the section length is 4, and this function is called change_state('wrdokoclgmae', 2, 'S'), then the function should return 'wrdolockgmae'. In this function only, you may assume a fixed section length of 3. The first parameter represents a game state, and the second parameter represents the number of a section in the game state that is not yet unscrambled. This function should return a move (either SWAP or ROTATE) that will help the player rearrange the specified section correctly. get_move_hint (str, int) -> str Use your creativity here, but make sure to give hints that if used in progression, should never produce the same game state twice. For example, always telling the user to play SWAP on a section 'ATC' each round will cause that section of the game state to go back and forth between 'ATC' and 'CTA' and never to get to the answer('CAT'). If a player repeatedly follows your hints, they should be guaranteed to end up solving the game. Hint: Consider the cases in which SWAP is a bad move to make. Note that this function may not work if SECTION_LENGTH is anything other than
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