Create a program to simulate the movement of the head and tail according to the given instructions.
Use a two-dimensional array to represent the grid and keep track of the head and tail positions, or use a single coordinate to represent both positions and a separate variable to keep track of the head’s direction.
Implement the rules for how the tail moves, and make sure that the program follows those rules accurately.
Remember that coordinates can be negative as well as positive
Differences in x and y need to be calculated as absolute values
It may be useful to code a method to view state of your knots
The direction moved is no longer compared to the head
Keep a list of knot positions and iterate through it
Need to determine the difference between the last knot and current and apply original rules