function
main
(
tick
,
walk
,
turn
,
wait
) {
}
Congratulations on having purchsed your RoboFlop 2000™!
We're sure you'll love this product. Unfortunately due to the nature of its Finite Learning Operational Personalisation™ interface, we cannot offer refunds at this point.
To program your RoboFlop 2000™, simply write and execute a JavaScript main
function as follows. The function will be passed a tick
count, and several functions: walk
, turn
, and wait
.
Please consult the tooltips for information on each function.
Calling one of these functions in main
will dispatch an appropriate command to the robot, which will then act accordingly.
// Walk forward two spaces, then turn anti-clockwise.
walk(tick < 2);
turn(tick === 2 ? -1 : 0);
Please be advised that longer program sources will result in exponentially more signals being sent between this controller and your RoboFlop 2000™. Reduce your code footprint to improve efficiency. Effective utilisation of function return values can help reduce code bloat. FlopCorp® may not be held responsible for any breakages caused by difficult-to-read or erroneous programs.
Warning: Issuing more than one command in a single update causes undefined behaviour. Doing so will void the warranty and may damage the product. We regret that we cannot offer any repair advice in such cases.