Question: Shaanan starts from the top left corner as before ( will move to the right ) , Yige starts from the top right corner (
Shaanan starts from the top left corner as before will move to the right Yige starts from the top right corner will move downwards Han starts from the bottom right corner will move to the left and Rose starts from the bottom left corner will move upwards No piece of lawn can be repeatedly mowed.
They start mowing at the time step Then at each time step, each of the four people completes one of the three actions with their lawnmower:
Move one step forward without turning ie no change in direction
Turn clockwise and move one step forward. This action will only be selected if:
moving one step forward without turning will result in the person immediately land on a coordinate that has already been mowed, AND
after turning clockwise and move one step forward, the person immediately lands on a coordinate that has not been mowed
Do nothing. Select this action if the other two actions are not possible.
During each time step, Shaanan performs his action first, then Yige, then Han, then Rose.
Your Task
Write a function quadclockwisespiralpathsdimension timestep
Input:
dimension: rowdim, coldim
timestep: a nonnegative int signalling the time step when mowing
Output: The function returns a list containing paths, in the order of Shaanans Yiges Hans and Roses at the timestep given.
Assumptions you can make:
The inputs are wellformatted with the correct type.
For this question, you can assume that in the dimension tuple rowdim, coldim rowdim and coldim are no less than
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
