I don't know python and this might be a stupid idea, but I would probably implement the snake as a (cyclic) linked list of coordinates. You remember the pointer to the "head" segment, when you move, you replace the "tail" segment with the new position of the head ("head" + "velocity") and set the head pointer to this new segment. If the snake grows, instead of replacing the tail with the new segment, you will insert the new item before the "head" and set the "head" pointer there.
|