Jump to content
GameDev.net Posting Guidelines (please read before posting)
For Beginners Forum FAQs (please read before posting)
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 08 November 2012 - 07:38 AM
Deltron Zero and Automator.
Posted 08 November 2012 - 08:01 AM
A linked list with head and tail could be appropriate, as each step you could just remove the tail if the snake hasn't grown, and add a new head depending on the direction the snake is facing, I guess. And then use an ordinary list to store the apples on the map and check if the snake's head is on any apple or on any part of its body (by iterating through the linked list - this might not be ideal). At least that's what springs to mind at first - there are possibly better ways to do it.
How to know what data structures and algorithms to use to program Snake.
Edited by Bacterius, 08 November 2012 - 08:11 AM.
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.