Question: Python: HW #3 Jumping frogs puzzle https://primefactorisation.com/frogpuzzle/ X X X Rules: Send all frogs X's to the right hand side of the pond, and all
Python:



HW #3 Jumping frogs puzzle https://primefactorisation.com/frogpuzzle/ X X X Rules: Send all frogs X's to the right hand side of the pond, and all Y's to the left. Frogs move (forward only) by hopping over a frog or sliding onto the empty spot (lily pad). * Solution: Generate all possible senarios to move frogs and pick up the solutions. * For example, assume we have two frogs z's and two frogs A's on each side of the empty lily pad. First, define "state" as the positions of frogs with a string of Z's, A's and "-" denoting the empty lipy pad. Starting from the initial state (ZZ-AA) Enumerate all unique states from each state at current step. Repeat the above step until the target state (AA-ZZ) is reached. Use the backgtrace technique to find all sequences of moves from the start state to the final state.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
