[ad_1]
Recreation Growth Stack Change is a query and reply web site for skilled and unbiased sport builders. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
The most effective solutions are voted up and rise to the highest
Requested
Seen
22 instances
I used to be excited about find out how to implement snake at the moment, particularly, how to make sure the snake strikes optimally from one goal to the subsequent.
This looks as if a shortest path downside, however it is a bit difficult as a result of you must maintain observe of the snake’s physique positions for each node within the BFS traversal, which may take up plenty of reminiscence. Is there a greater method than what I am envisioning right here?
atl123 is a brand new contributor to this web site. Take care in asking for clarification, commenting, and answering.
Try our Code of Conduct.
$endgroup$
0
For each node occupied by the snake, you’ll be able to compute in what number of steps it is going to be freed. So in the event you maintain observe of what number of steps you might be doing in your path search, you’ll be able to examine that to know if the node can be occupied when the snake reaches it.
Addendum: You could be anxious about nodes occupied by future motion of the snake, but when your attain algorithm doesn’t create paths that repeat nodes to start with, then that’s not a priority.
$endgroup$
5
You will need to log in to reply this query.
Not the reply you are on the lookout for? Browse different questions tagged .
default
[ad_2]