Overview
The Game Grammar vocabulary consists of 74 tokens organized into 8 categories. Each token is assigned a unique integer ID from 0 to 73.Token Categories
Structural Tokens (4 tokens)
Control sequence boundaries and timing.BOS- Beginning of sequence (ID: 0)EOS- End of sequence (ID: 1)TICK- Marks a game tick boundary (ID: 2)SNAP- Marks a state snapshot (ID: 3)
Entity Tokens (3 tokens)
Identify game entities in snapshots and events.PLAYER- The snake entity (ID: 4)FOOD- Food entity (ID: 5)WALL- Wall boundary (ID: 6)
Direction Tokens (4 tokens)
Represent snake heading direction.DIR_U- Direction up (ID: 7)DIR_D- Direction down (ID: 8)DIR_L- Direction left (ID: 9)DIR_R- Direction right (ID: 10)
Input Tokens (4 tokens)
Represent player input actions.INPUT_U- Input up (ID: 11)INPUT_D- Input down (ID: 12)INPUT_L- Input left (ID: 13)INPUT_R- Input right (ID: 14)
Position X Tokens (10 tokens)
X-coordinates on the 10×10 grid.X0throughX9(IDs: 15-24)
Position Y Tokens (10 tokens)
Y-coordinates on the 10×10 grid.Y0throughY9(IDs: 25-34)
Event Type Tokens (7 tokens)
Game events and actions.MOVE- Snake moves to new position (ID: 35)EAT- Snake eats food (ID: 36)GROW- Snake grows in length (ID: 37)DIE_WALL- Snake hits wall (ID: 38)DIE_SELF- Snake hits itself (ID: 39)FOOD_SPAWN- Food spawns at new location (ID: 40)SCORE- Score update marker (ID: 41)
Value Tokens (11 tokens)
Numerical values (scores, counts).V0throughV10(IDs: 42-52)- Used for scores 0-10 (capped at V10 for scores > 10)
Length Tokens (21 tokens)
Snake body length.LEN1throughLEN20(IDs: 53-72)LEN_LONG- For lengths > 20 (ID: 73)
Constants
VOCAB
ID_TO_TOKEN
VOCAB_SIZE
Complete Token List
All 74 tokens in order by ID:
