Level representation - wladekpal/The-Lazy-Snek GitHub Wiki

Level is being represented by dictionary containing following elements:

  • level_name - string,
  • level_creator - string,
  • level_tags - list containing simple tags describing level,
  • block_placement - matrix of numbers (block IDs) that represents 2d board,
  • block_additional_data - matrix of dictionaries, that can contain additional data necessary for the corresponding block. Data can differ within different block types,
  • snakeData - list of dictionaries, each containing one snake's data. Snake data contains:
    • name - string,
    • type - integer,
    • color - string,
    • placement - list of pairs (coordinates) of snake body parts from tail to head,
    • direction - direction in which snake will continue to move (N, S, E, W).
  • available_blocks - list of pairs, each pair contains block id and information how many are available to use
{
"level_name": "example level",
"level_creator": "don shakadeemaz",
"level_tags": ["simple", "tricky"],
"block_placement": [
    [1, 2, 3],
    [2, 4, 4],
    [2, 2, 2]
],
"block_additional_data": [
    [{"below": [1, 1], [1, 2](/wladekpal/The-Lazy-Snek/wiki/1,-1],-[1,-2)}, {}, {}],
    [{}, {"above": [0, 0]}, {"above": [0, 0]}],
    [{}, {}, {}]
],
"snake_data": [
    {"name": "blue_snake", "type": 0, "color": "blue", "placement": [2, 2], [2, 3](/wladekpal/The-Lazy-Snek/wiki/2,-2],-[2,-3), "direction": "N"},
    {"name": "red_snake", "type": 1, "color": "red", "placement": [1, 2], [1, 3](/wladekpal/The-Lazy-Snek/wiki/1,-2],-[1,-3), "direction": "W"}
],
"available_blocks": [
    [1, 1]
]
}