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)

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top