 
     reset: =>
         @codeEditor.resetEditor()
+        @gameState = new MapGameState this, @visual, @config.visual.characters
+        @commandMap = new MapGameCommands @gameState
         @visual.startGame @config.visual
         return
 

    #       v
    constructor: (@gameManager, @gameVisual, characterLoadconfig) ->
        # @config ?= { x: 4, y: 4, direction: 0, maxX:9, maxY:9, traps: [[2,4],[9,9]], targets: [[5,5]], targetCount : 0}
        @config = @gameManager.config.game
        @score = 0
        @stars = 0
        @protagonist = {

        return

    turnRight: ->
        @turn ((@protagonist.dir + 1) % 4)
        return

    turnLeft: ->
        @turn ((@protagonist.dir + 3) % 4)
        return

    turn: (dir) ->
        if dir == 4
            alert "Danger, Mr Robinson Dir is 4!"
        @protagonist.dir = dir
        @gameVisual.charFace @protagonist.index, @protagonist.dir
        return
