// Customise AB run parameters (optional).
// The following 3 parameters can be customised. (They have default values.)
AB.clockTick = int;
// Speed of run: Step every n milliseconds. Default 100.
AB.maxSteps = int;
// Length of run: Maximum length of run in steps. Default 1000.
AB.screenshotStep = int;
// For automatic generation of World images.
// Take screenshot on this step. (All resources should have finished loading.) Default 50.
function World() {
// Optional declaration:
// If endCondition is declared, runs will check for endCondition true and then terminate.
// If not declared, runs will make no such check.
this.endCondition = false;
// Optional functions:
// The following 5 function declarations are optional.
// If not declared, either nothing happens, or, if a return is expected, return is taken as 0.
this.newRun = function()
{
// Code for initial graphics drawing of objects.
// Canvas setup:
threeworld.init ( arguments );
// To draw on canvas:
var ctx = threeworld.getContext ( type ); // type = "2d" or "webgl"
};
this.getState = function()
{
return ( state ); // State format defined by this World.
};
this.takeAction = function ( action ) // Action format defined by this World.
{
// Code for graphics re-drawing of objects.
// To draw on canvas, see threeworld.getContext as above.
if ( some condition ) // Optional: Check for condition that will end the run early.
{
this.endCondition = true; // This will end the run.
}
};
this.endRun = function()
{
};
this.getScore = function()
{
return ( float );
};
}