Legacy code

Ancient Brain has changed over time. In older Worlds you will see code from the prototype and earlier versions of Ancient Brain.

As one of our core principles of being backward compatible, this code will always run.

Here is a list of deprecated, but still functional, code.


Global variables

// Old global variable, now points to the new global variable: 
var ABRun = AB; 
// Some APIs used these global variables, which now point to the new global variables:

var threeworld   = ABWorld; 
var threehandler = ABHandler; 


World and Mind definition

We formerly suggested defining World and Mind classes and defining their methods as follows:

function World() 
   this.nextStep = function() { ... };

function Mind() 
   this.getAction = function ( state ) { ... };

That will still work. But now we say it is not necessary to define a class, and you can just go ahead and define methods. So the above is replaced by:

AB.world.nextStep = function() { ... };

AB.mind.getAction = function ( state ) { ... };


Save and restore data

The AB "save and restore data" functions were formerly called with no arguments. They then referred to the following hard-coded AB.world functions. These still work, though the preferred use of the "save and restore data" functions is now not to use these.

AB.world.saveData        = function () { ... };           // Return what object to save to the server   
AB.world.queryDataExists = function ( boolean ) { ... };  // Do something once we find out if data exists  
AB.world.restoreData     = function ( object ) { ... };   // Process the object that was recovered from server  
AB.world.getAllData      = function ( array ) { ... };    // Process the array that was recovered from server  


Small issues

Default values shown.


AB.world.endCondition = false;      // Setting this to true ends the run 

// Some Worlds write direct to areas in the run header instead of using AB.msg():

$("#user_span1").html ( message );