Algorithms
1 Boolean Controllers
2 Bang-Bang Controllers
8.1

Algorithms

Most of the algorithms you will need to complete an awesome virtual robot can be classified into one of two groups

This page will largely focus on controllers, as effectivelly everyone needs them. But if you want to take your robot to the next level though, we definitely suggest creating some predictors! If you don’t know where to start, see our quick discussion on predictors.

1 Boolean Controllers

Boolean controllers refers to any controller that outputs whether or not to perform some action (say shoot a laser, or use a boost).

2 Bang-Bang Controllers

A bang-bang controller is one that makes desicions through a series of conditionals. You are actaully very used to bang-bang controllers in your every day life. For instance your air conditioning will cool the apartment if the temperature is above the desired one, and do nothing otherwise. Similarly, let’s consider the following bang bang contorller for a virtual robot that wanted to go 15 degrees north of east (ie: with angle 15).

(define (go-right)
  (degrees-mode)
  (cond
    [(> (get-robot-angle) 15) (set-motors 1 0.8)]
    [else (set-motors 0.8 1)]))

If you’re curious, try adding this function to a robot, call it from on-tick, and see what it does!

Unfortunately, there’s a pretty big issue with this approach.