Route Planning Task
Report
First, we put all the point of tables in an array. For example: [table1, table2, ......].
In a while loop, it starts at picking the first element(point) in the array and calculating the distance between the agent and the point, and choose the smallest distance of four directions(left, right, up, down). Then move to that direction. (Here is a special condition - we do not allow the agent to go back to previous point. If agent can go back, it will cause a infinate loop somethings.)
If the agent arrive the destination(means the agent and the table are at the same point), then the table in array will be deleted. And the agent will go back to kitchen.
When agent arrive the ketchen, the loop will iterate again to the next table until all the tables are visited.