Using Python Program Defines Prints Couple States State Defined Monster Munchkin Count Lef Q43819069
******************THIS SHOULD BE USINGPYTHON

The program defines and prints a couple of states. A state isdefined by the monster and munchkin count on the left river bank,and the side the boat is on.
Define and test two boolean methods:
goal(s) returns True if s is a goal state (allmonsters and munchkins on right river bank).
and
legal(s) which returns True if s is legal(meets the conditions described in the puzzle).
Note that the state tuple stores how many Munchkins, Monstersare on the left bank. Subtracting these numbers from the totalcount gives the number on the right bank. In the program thevariables munchkin_count andmonster_count store the total counts.
if s is a state 3 tuple:
left_bank_munchkin_count = s[0]
right_bank_munchkin_count = munchkin_count -left_bank_munchkin_count
left_bank_monster_count = s[1]
right_bank_monster_count = monster_count -left_bank_monster_count
A legal state must meet the conditions:
left_bank_munchkin_count is between 0 and munchkin_count(this ensures the right bank is ok also)
left bank monsters cannot out number left bank munchkinsand
right bank monsters cannot out number right bankmunchkins
Note that it is not enough to just testleft_bank_munchkin_count >=left_bank_monster_count
because there can be as any number of monsters on a river bankif there are no munchkins.
The state (2, 3, 1) us not legal, too many monsters on leftbank.
(0, 3, 1) is legal.
(2, 1, 1) is not legal as there will be 1 munchkin and 2monsters on the right river bank.
The last number is the boat side and it does not matter forchecking legality, we will use it later when computing statechanges.
******************THIS SHOULD BE USINGPYTHON
Use Recursive Backytacking Search to solve River applying Puzzle: There are 3 monsters and 3 munchkins on the left river bank. A boat is available to move all 6 creatures to the right river bank. A maximum of two creatures are allowed in the boat for each applying The munchkins must never be outnumbered by the monsters. The boat will not move if there is no creature in it. Created on Sat Oct 12 22:26:17 2019 @author: rutkowsk + index number into state List mun = 0 mon=1 boat = 2 # boat side left = -1 right = 1 munchkin_count = 3 monster_count = 3 boat_capacity = 3 # state stores the state of the puzzle as a 3-tuple, # state[mun) = number of munchkins on left bank #state[mon) = number of monsters on left bank # state[boat] = boat side start_state = (munchkin_count, monster_count, left) prints a state def print_state(s): print(.. print(‘Munchkinst’str(s[mun])+’ttMunchkins t’estr (munchkin_count-s(mun))) print(“Monsterst’str(s[mon])+”ttMonsterst’str(monster_count-s[mon])) print(s[boat] tttt Boat) print(‘– print_state(start_state) state2 = (munchkin_count – 1, monster_count, right) print_state(state2) Show transcribed image text Use Recursive Backytacking Search to solve River applying Puzzle: There are 3 monsters and 3 munchkins on the left river bank. A boat is available to move all 6 creatures to the right river bank. A maximum of two creatures are allowed in the boat for each applying The munchkins must never be outnumbered by the monsters. The boat will not move if there is no creature in it. Created on Sat Oct 12 22:26:17 2019 @author: rutkowsk + index number into state List mun = 0 mon=1 boat = 2 # boat side left = -1 right = 1 munchkin_count = 3 monster_count = 3 boat_capacity = 3 # state stores the state of the puzzle as a 3-tuple, # state[mun) = number of munchkins on left bank #state[mon) = number of monsters on left bank # state[boat] = boat side start_state = (munchkin_count, monster_count, left) prints a state def print_state(s): print(.. print(‘Munchkinst’str(s[mun])+’ttMunchkins t’estr (munchkin_count-s(mun))) print(“Monsterst’str(s[mon])+”ttMonsterst’str(monster_count-s[mon])) print(s[boat] tttt Boat) print(‘– print_state(start_state) state2 = (munchkin_count – 1, monster_count, right) print_state(state2)
Expert Answer
Answer to ******************THIS SHOULD BE USING PYTHON The program defines and prints a couple of states. A state is defined by t…
OR