         return false
 
     stopStudentCode: =>
+        ###
+            Event Function (passed in as a callback or bound to a button press)
+
+            Stops running the student's code and resets the visual.
+        ###
         if not @running
             return
         @environment.stats.abortCount +=1
-        @storeStats()  
+        @storeStats()
         if @environment.backEnd == 'doppio'
             @environment.codeland.doppioAPI.abort @showRun
         else

    log = (mesg) -> console.log(mesg)
else
    log = (mesg) -> null
        
log("GameManager log")
if not deepcopy?
    deepcopy = (src) -> $.extend(true, {},src)

class window.GameManager
    #environment is defined in codeland.startGame
    constructor: (@environment) ->
        @config = deepcopy @environment.description
        @gameStateBase = @environment.gameState


        return

    storeStats: ->
        ###
            Internal Function (used only by the code in this file)

            Saves the game statistics to codeland.
        ###
        @environment.codeland.storeGameStats @environment.key, @environment.stats
        return

    setUpGame: ->
        ###
            Internal Function (used only by the code in this file)

            Sets up everything for the game to run.
            That is, the code editor, the game visual and the event listeners.
        ###
        @gameDiv = jQuery @environment.gamediv
        @gameDiv.empty()
