C2LC-247: Persist the contents of the scene in the URL

Description

  • Serialize the contents of the scene: character position, character direction, path segments drawn
  • Create a CharacterStateSerializer
    • serialize(characterState: CharacterState): string
    • deserialize(text: string): CharacterState
  • Representation:
    • <xPos><yPos><direction><path segments>
    • Where each path segment is a series of 4 characters:
      • <x1><y1><x2><y2>
    • Encoding for positions:
      • 0: 0
      • Positive offset from the origin: lower case letters
      • Negative offset from the origin: upper case letters
      • This enables us to support a grid up to 53x53
    • Encoding for direction:
      • Single character representing eighths of a turn (the internal representation of direction in CharacterState)
      • N: 0
      • NE: a
      • E: b
      • SE: c
      • S: d
      • SW: e
      • W: f
      • NW: g
  • Example:
  • Add a new URL parameter “c” for CharacterState
  • Make the program representation more concise (to reduce the length of the URL)
    • forward1: 1
    • forward2: 2
    • forward3: 3
    • left45: A
    • left90: B
    • left180: D
    • right45: a
    • right90: b
    • right180: d

Comments