Skip to main content
Engineering LibreTexts

10.5: The “Game State” Data Structure

  • Page ID
    13622
  • The game state object will be a dictionary with three keys: 'player', 'stepCounter', and 'stars'.

    • The value at the 'player' key will be a tuple of two integers for the current XY position of the player.
    • The value at the 'stepCounter' key will be an integer that tracks how many moves the player has made in this level (so the player can try to solve the puzzle in the future with fewer steps).
    • The value at the 'stars' key is a list of two-integer tuples of XY values for each of the stars on the current level.
    • Was this article helpful?