| window |
en |
Tk window |
The desktop window that holds the screen and is opened when the game starts. |
BC, SA, PP, MIL |
PY |
| screen |
en |
Screen |
The drawing area that the game sets up (size, colour, title) and on which the snake is shown. |
BC, SA, PP, MIL |
PY |
| snake |
en |
Snake |
The creature the player steers, made of segments. |
BC, SA, PP, MIL |
PY |
| segment |
en |
Turtle |
One square of the snake: light green in the body, dark green with a mouth in the head. |
BC, SA, PP, MIL |
PY |
| head |
en |
head |
The first segment, which leads the snake and is turned by the arrow keys. |
BC, SA, PP, MIL |
PY |
| tail |
en |
segments[1:] |
Every segment behind the head; the snake is reset when the head touches one of them. |
BC, SA, PP, MIL |
PY |
| body |
en |
segments |
All segments of the snake, the head included, in order, the head first. |
BC, SA, PP, MIL |
PY |
| starting position |
en |
STARTING_POSITIONS |
One of the three places at which a segment is drawn when the game starts and after a reset. |
BC, MIL |
PY |
| move |
en |
move |
One pass in which each segment takes the place of the one before it and the head goes forward by the move distance. |
BC, SA, PP, MIL |
PY |
| direction |
en |
heading |
The way the head points: up, down, left or right. |
BC, SA, PP, MIL |
PY |
| reversal |
en |
opposite heading |
A turn by 180 degrees, so that the head would run into the segment behind it. |
BC, SA, PP, MIL |
PY |
| arrow key |
en |
key name "Up", "Down", "Left", "Right" |
One of the four keys with which the player turns the head. |
BC, SA, PP, MIL |
PY |
| animation loop |
en |
while game_is_on loop |
The loop that refreshes the screen, waits and makes one move, again and again. |
BC, PP, MIL |
PY |
| food |
en |
Food |
The small blue circle that the snake eats; it is shown at a random place. |
BC, SA, PP, MIL |
PY |
| refresh |
en |
refresh |
The food moves to a new random place; it happens when the game starts and every time the food is eaten. |
BC, SA, MIL |
PY |
| eat |
en |
FOOD_COLLISION_DISTANCE |
The head comes closer to the food than this distance, which makes the snake grow and the score rise. |
BC, MIL |
PY |
| grow |
en |
extend |
The snake gets one more segment, at the place where its last segment is. |
BC, SA, MIL |
PY |
| score |
en |
score |
The number of foods the snake has eaten since the last reset. |
BC, SA, PP, MIL |
PY |
| high score |
en |
high_score |
The largest score reached in any game so far; it is kept in the data file between games. |
BC, SA, PP, MIL |
PY |
| scoreboard |
en |
Scoreboard |
The text at the top of the screen that shows the score and the high score. |
BC, SA, MIL |
PY |
| wall |
en |
WALL_LIMIT |
The line on every side of the playing field, 280 pixels from the centre; the head must stay inside it. |
BC, SA, PP, MIL |
PY |
| touch |
en |
TAIL_COLLISION_DISTANCE |
The head comes closer to a segment of the tail than this distance. |
BC, MIL |
PY |
| reset |
en |
reset |
The snake and the score go back to their start, and the high score is kept or raised; it happens when the head passes the wall or touches the tail. |
BC, SA, PP, MIL |
PY |
| continuous play |
en |
main flow without game_over |
The game goes on after a reset and does not stop until the window is closed. |
BC, SA, PP, MIL |
PY |
| data file |
en |
HIGH_SCORE_FILE (data.txt) |
The text file that holds the high score between games. |
BC, SA, PP, MIL |
PY |
| read |
en |
open in mode r, then read |
The game gets the high score from the data file as text and converts it to a whole number. |
BC, PP, MIL |
PY |
| write |
en |
open in mode w, then write |
The game replaces the content of the data file with the new high score as text. |
BC, PP, MIL |
PY |
| inheritance |
en |
subclass of Turtle |
A class takes over the attributes and methods of another class; Food and Scoreboard take over those of Turtle. |
BC, SA, MIL |
PY |