       when 'pause'
         @alg.stop()
       when 'next'
-        this.next()
+        this.to_next()
       when 'prev'
-        this.prev()
+        this.to_prev()
       when 'reset'
         this.to_start()
 

    this.animate()


  # this function is executed on each animation frame
  animate: ->
    now = (new Date()).getTime()


    if @changers[category] then @changers[category].finish()
    @changers[category] = changer

  to_next: ->
    unless @alg.at_end()
      this.add_changer('move', @alg.next_move().show_do(@world3d))

  to_prev: ->
    unless @alg.at_start()
      this.add_changer('move', @alg.prev_move().show_undo(@world3d))

