 # TODO: these should handle the passage of time? or maybe that is up to
 # stepLevelSimulation?
 moveCommand = (level) ->
-  level.bot.xi += @dir.dx
-  level.bot.yi += @dir.dy
-  level.bot.dir = @dir.theta
+  switch level.mode
+    when levelMode.PLAYING, levelMode.FULLPLAYING
+      level.bot.xi += @dir.dx
+      level.bot.yi += @dir.dy
+      level.bot.dir = @dir.theta
+    when levelMode.REVPLAYING
+      dir = reverseDir(@dir)
+      level.bot.xi += dir.dx
+      level.bot.yi += dir.dy
+      level.bot.dir = dir.theta
 
 noActionCommand = (level) ->
   return
 
 arrowCommandRender = (ctx) ->
   renderArrow(ctx, @dir.theta, inner_command_size)
+
+reverseCommandRender = (ctx) ->
+  ics  = inner_command_size
+
+  ctx.beginPath()
+  ctx.moveTo(-ics*.2, -ics*.3)
+  ctx.lineTo(0, -ics*.3)
+  ctx.arc(0,0,ics*.3, -Math.PI/2, Math.PI/2, false)
+
+  ctx.lineTo(-ics*.2, ics*.3)
+  ctx.lineTo(-ics*.1, ics*.15)
+  ctx.moveTo(-ics*.2, ics*.3)
+  ctx.lineTo(-ics*.1, ics*.45)
+
+  ctx.stroke()
+
+  return
 
 up_arrow_cmd =
   render: arrowCommandRender

  return

stepLevelSimulation = ->

  if @current_command != null && @current_command < @commands.length
    @commands[@current_command].action(this)

    @advanceCurrentCommand()

    # TODO: limitations on movement
    true
  else
    false

setupLevel = (initial_bot_location) ->
  o =

  (x1-x0)*t + x0

animateLevel = (t) ->
  console.log("mode = " + @mode + " animMode = " + @animation_mode)

  if @mode == levelMode.STOPPED or @animation_mode == levelAnimMode.READY
    @show_current_command = @current_command
    @bot.showxi = @bot.xi
    @bot.showyi = @bot.yi
