# File karel/tk_robot_world.rb, line 46
  def update(robot, action, state)
    # sleep 0.5
    return unless state
    if action == MOVE_ACTION
      register_robot(robot, state)
      if $window
        sleep(@@delay / 100.0)
        $window.move_robot(@@graphical_robots[robot])
      end
    elsif action == CREATE_ACTION
       # puts 'create'
      register_robot(robot, state)
      if $window
           street, avenue, direction = state[0], state[1], state[2] #robot._street, robot._avenue robot._direction
           @@graphical_robots[robot] = $window.add_robot(street, avenue, direction)

      end
    elsif action == TURN_LEFT_ACTION
      # puts 'turn'
      if $window
        sleep(@@delay / 100.0)
        $window.turn_left_robot(@@graphical_robots[robot])
        # @@graphical_robots[robot].rotate()
      end
    elsif action == TURN_OFF_ACTION
       sleep(@@delay / 200.0)
      $window.turn_off_robot(@@graphical_robots[robot])
    elsif action == PICK_BEEPER_ACTION
      #nothing.
    elsif action == PUT_BEEPER_ACTION
      #nothing
    else
      #nothing
    end
    @robots[robot] = state
  end