Skip to content

Is the nesting in parse_match - players intended? #119

@denniske

Description

@denniske

Hi, I just wanted to check whether the nesting of the player array is intended or if it is a bug?

If it is intended I will flatmap over the teams then to get a player list.

with open('recs/' + filename, 'rb') as h:
    match = parse_match(h)
    print(json.dumps(serialize(match)))
{
  ...,
  "players": [
    {
      "number": 1,
      "name": "Zweistein",
      "color": "Purple",
      "color_id": 5,
      "civilization": "Vikings",
      "civilization_id": 11,
      "position": {
        "x": 49.0,
        "y": 28.0
      },
      "objects": [...],
      "profile_id": 3146184,
      "prefer_random": false,
      "team": [
        1,
        {
          "number": 3,
          "name": "Baratticus",
          "color": "Red",
          "color_id": 1,
          "civilization": "Mongols",
          "civilization_id": 12,
          "position": {
            "x": 37.0,
            "y": 91.0
          },
          "objects": [...],
          "profile_id": 336655,
          "prefer_random": false,
          "team": [
            1,
            3,
            {
              "number": 5,
              "name": "Sihing Mo",
              "color": "Yellow",
              "color_id": 3,
              "civilization": "Magyars",
              "civilization_id": 22,
              "position": {
                "x": 26.0,
                "y": 58.0
              },
              "objects": [...],
              "profile_id": 223576,
              "prefer_random": false,
              "team": [
                1,
                3,
                5
              ],
              "team_id": [
                1,
                3,
                5
              ],
              "winner": true,
              "eapm": 45,
              "rate_snapshot": 1315
            }
          ],
          "team_id": [
            1,
            3,
            5
          ],
          "winner": true,
          "eapm": 41,
          "rate_snapshot": 1353
        },
        5
      ],
      "team_id": [
        1,
        3,
        5
      ],
      "winner": true,
      "eapm": 24,
      "rate_snapshot": 1113
    },
    {
      "number": 2,
      "name": "the Puchu",
      "color": "Blue",
      "color_id": 0,
      "civilization": "Mayans",
      "civilization_id": 16,
      "position": {
        "x": 80.0,
        "y": 98.0
      },
      "objects": [...],
      "profile_id": 9487416,
      "prefer_random": false,
      "team": [
        2,
        {
          "number": 4,
          "name": "GingerSnap57",
          "color": "Green",
          "color_id": 2,
          "civilization": "Gurjaras",
          "civilization_id": 42,
          "position": {
            "x": 101.0,
            "y": 69.0
          },
          "objects": [...],
          "profile_id": 277575,
          "prefer_random": true,
          "team": [
            2,
            4,
            {
              "number": 6,
              "name": "zhien",
              "color": "Teal",
              "color_id": 4,
              "civilization": "Malay",
              "civilization_id": 29,
              "position": {
                "x": 86.0,
                "y": 33.0
              },
              "objects": [...],
              "profile_id": 4672195,
              "prefer_random": false,
              "team": [
                2,
                4,
                6
              ],
              "team_id": [
                2,
                4,
                6
              ],
              "winner": false,
              "eapm": 37,
              "rate_snapshot": 1892
            }
          ],
          "team_id": [
            2,
            4,
            6
          ],
          "winner": false,
          "eapm": 44,
          "rate_snapshot": 1245
        },
        6
      ],
      "team_id": [
        2,
        4,
        6
      ],
      "winner": false,
      "eapm": 43,
      "rate_snapshot": 1183
    },
    3,
    4,
    5,
    6
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions