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

Metadata

Source
C2LC-247
Type
Task
Priority
N/A
Status
Done
Resolution
N/A
Assignee
N/A
Reporter
Created
2020-11-03T15:13:03.882-0500
Updated
2020-11-12T12:01:59.990-0500
Versions
N/A
Fixed Versions
  1. Coding Env 0.5
Component
  1. Coding Environment

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