Question

I'm trying to make a small IA32 game(AT&T), the problem I'm facing at the moment is I don't know how/where to store the snakes body and the "apples" to be able to check for collisions. The snakes size is constantly increasing so the container should be dynamically allocated?

In a high level language I'd use a 2d vector/array/linked list or similar to store the coordinates and then compare after a move is made.

any suggestions are welcome.

(Looked at similar questions but didn't get my question answered)

Was it helpful?

Solution

The snake can't be longer than the field, so allocate the suitable amount of memory statically or dynamically - it is up to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top