It is intended for this section to help programmers understand BOTSsim code.

1. The program launches the GUI
2. If the user presses TED or new template, TED is launched.
3. If the user presses run, the environment duplicates the world, and starts the run. This button also launches the brain, which sends a ready message when the socket is open.
4. If the user presses pause or stop, that message is passed onto the environment.
5. If the user presses Save run, this message is sent on to TED to save the template, and the environment to save the run info. The GUI saves the Rule Sets of all the robots.
6. During a run, the environment makes passes the sensor information to the brain, which responds with an action.
7. At the end of a generation, the environment passes the fitness levels of all the robots to the brain. The brain analyses these fitness levels, and returns a Robot Environment position




The following is a description of the modules in the data flow diagrams for the GUI.
This is actually a collection of Event Handlers. It handles all of the input from the User and performs actions based upon that input. The User/GUI also controls the overall application.
Controls the opening of all files associated with a single Run.
Opens a saved Environment Template from a file.
Lets the user modify the information which is relevant to this particular run. Both the Environment and Genetic Programming Variables are used in this module.
Controls the saving of all files associated with a single Run.
This module contains all of the routines associated with displaying Environments, Histograms and Bots. This module should actually be broken up further but due to time constraints it is not.
The following is a description of the modules in the data flow diagrams for the TED.
Controls the creation of an Environment Template.
Handles the opening & loading of an existing Environment Template.
Handles the saving of the current Environment Template.
The following is a description of the modules in the data flow diagrams for the Environment.
Receives Run Information, specifically Environment Variables. This module is responsible for starting a Run. This includes the creation of an Evaluation (multiple Environments) and creation of the Bot population as well as setting the initial fitness values for the Bots.
This module's purpose is to manage the many Environments within the simulation. Modification of fitness values as well as animation of the simulation occur in this module.
The basic algorithm for this module is as follows:-
For each robot in world get sensor values send to brain and retrieve actions process actions and move robot end
The basic algorithm for this module is as follows:-
Loop Wait for timestep trigger For each world do RobotSensorEvaluation until set time has elapsed
| Display Info | This tells Display World what the user wants to be displayed, which is either Statistics or a world, or both. The user can look at several worlds at once, as well as the overall statistics. |
| Run Information | This is a combination of a Template, Rule Set, GP Variables, and Environment Info. |
| Template | This is what the environment views the world as. It is made up of a series of Bins, Distribution Areas, Walls and Bots. |
| Rule Set | The set of rules that governs the bot's actions from given inputs. |
| Genetic Programming Variables | Maximum depth for new individuals |
| Maximum depth for individuals after crossover | |
| Maximum depth for new subtrees in mutants | |
| Fitness proportionate reproduction fraction | |
| Crossover at any point fraction | |
| Crossover at function point fraction | |
| Number of factories | |
| Random number seed | |
| Method of selection | |
| Method of generation |
| Environment Variables | Bot Turn Speed |
| Bot Move Speed | |
| Generation Length: How many Time Steps per generation | |
| Start Fitness | |
| Block Pickup Gain | |
| Right Drop Gain | |
| Wrong Drop Loss |
| Pause/Unpause/Abort Run | Tells the Main Generation Loop to either pause, continue, or abort the current generation |
| Open Run | Activates the Load Run module |
| Open Template | Activates the Load Template module |
| Edit Run Information | Activates the Edit Run Information module |
| Save Run | Activates the Save Run module |
| Create/Modify Template | Activates the TED module |
| Get Rule Set | Gets the Rule Set from the Brain |
| Get State | Gets the current state of the environment from the main generation loop |
| Time Step | This activates the Robot Sensor Evaluation module, and is used at regular intervals |
This explains the purpose of the most "important" objects and variables within the GUI and Environment components. These variables are often referred to in multiple modules, and in some cases multiple source files.
This variable provides access to the About BOTSsim Dialogue Box.
This variable provides access to the Bot Properties Dialogue Box.
This variable provides access to the Bot Window.
This variable provides access to the About Colin Dialogue Box.
This variable provides access to the About David Dialogue Box.
This variable provides access to the About Mark Dialogue Box.
This variable provides access to the About Michael Dialogue Box.
This variable provides access to the About Mik Dialogue Box.
This variable provides access to the About Stephen Dialogue Box.
This variable provides access to the Communications Debug Dialogue Box.
This variable stores the number of Bots per Environment (World). This variable saves us from having to call the CountBots function on multiple occasions. This is an important variable because CountBots is an important function that gets called on many occasions within the Evaluation object. By having a variable to store this information we save a lot of processing resources during the execution of a Run.
This variable stores the number of Environments (Worlds) in a Run. This is an important variable because the number of Environments in a Run would be otherwise unavailable. This variable is used in mostly the same places as the BotsPerWorld variable. It's high usage gives it it's importance.
This variable provides access to the Histogram Window.
This variable provides storage for the Histogram itself. The Histogram is an array of dynamic length, hence it is important that we have an easy way to access variables within it. The array construct provides us with this easy way to access the Histogram and display it on the screen.
This variable provides access to the BOTSsim Dialogue, also referred to as the Main Dialogue.
This variable is used to keep track of the progress over a single Generation of the Run.
This variable is used to keep track of the progress of the Run.
This provides access to the Main Evaluation object (this is in fact the only Evaluation object). The Evaluation is perhaps one of the core variables within BOTSsim. Without it we would not be able to perform a Run with multiple Environments, construct the Histograms, or perform any of the other functions that are central to the overall functionality of BOTSsim.
This provides access to the CBEP object. The CBEP object provides communications with the Brain for both the GUI and Environment components. This is an extremely important variable as it encompasses all of the high level communications in the Complex Environment Brain Protocol.
This variable provides access to the Run Information Dialogue, which allows you to configure both the Genetic Programming Variables and the Environment Variables.
This variable is a structure that provides access to the variables that affect the way the Environment works. The structure contains the following fields:-
* BotTurnSpeed
* BotMoveSpeed
* StartFitness
* BlockPickupGain
* RightDropGain
* WrongDropLoss
This variable is a structure that provides access to the variables that affect the way the Genetic Programming algorithms and other constructs work. The structure contains the following fields:-
* MaxDepthForNewIndividuals
* MaxDepthForIndividualsAfterCrossover
* MaxDepthForNewSubtreesInMutants
* FitnessProportionateReproductionFraction
* CrossoverAtAnyPointFraction
* CrossoverAtFunctionPointFraction
* NumberOfFactories
* PopulationSize
* RandomNumberSeed
* MethodOfSelection
This variable provides access to the Show Bot By ID Dialogue Box.
This variable provides access to the TED Window and it's associated functionality.
This variable stores the Camera Zoom Factor within the TED Window. This variable's importance lies in the fact that the user will often wish to change the Zoom Factor while editing a Template.
This variable provides access to the View An Environment Dialogue Box.
This variable provides access to all of the multiple View Environment Windows. This is an array construct that is used for dynamic creation & destruction of View Environment Windows.
This variable provides access to the Template Dimensions Dialogue Box.
This section explains the purpose of BOTSsim's modules, ie: Delphi procedures and functions.
Displays the About Mark Dialogue.
Displays the About Mik Dialogue.
Displays the About Stephen Dialogue.
Displays the About Michael Dialogue.
Displays the About David Dialogue.
Displays the About Colin Dialogue.
Closes the About BOTSsim Dialogue.
Close if the Escape (ASCII 27) key is pressed.
Sets the Bot Box variables.
Changes the colour of the bot.
Updates the bot display.
This is when the form is first created.
Now draw the thing.
This is when the form is first shown. Also gets called by FormActivate when the ID of the bot being shown changes.
Destroys the World in which the default bot lives in.
Closes the bot form.
Displays the Rule set of the current bot in the memo pad.
This is the event that is called when bot form is resized.
This disables the timer when the form is closed.
This displays the window the environment the current bot is in.
If the bot has changed, show the new bot.
Shows the bot and its sensors.
Creates an instance of the TCBEP Object.
Destroys an instance of the TCBEP Object.
Gets the Rule Sets from the Brain.
Sets the Rule set of a bot.
Puts the bots in their worlds.
Sets the GP Variables in the Brain.
Sends sensors to the Brain and receives corresponding actions.
Sends bot fitness values to the Brain.
Initialises bot Rule Sets.
Implements mirroring (see section 3.3 on page 13 of this document.)
Informs the user of an Invalid CBEP Message & Exits BOTSsim.
Creates the rule set trees.
Destroys the rule set trees.
Processes the String if it begins with I
Processes the String if it doesn't begin with I
Determine which wall sensor the string is referring to.
Determine which block sensor the string is referring to.
Determine which Go action the string is referring to.
Determine which turn action the string is referring to.
Determine which bin sensor the string is referring to.
Determine which block sensor the string is referring to.
Determine which bot sensor the string is referring to.
Maps the sensor to an action.
Maps the sensor to an action.
Creates blank trees.
Destroys the current tree.
Destroys all trees.
Displays the rule set of the bot.
Calculates the refined fitness from the raw fitness. The different fitness functions tried are described in section 3.2 on page 11 of this report.
Recalculates & Shows The Updated Hits Histogram.
Handles The Single Click On The Update Histogram Button.
Closes The Hits Histogram Window.
Recalculates The Hits Histogram.
Saves The Current Run's TED, RIF & SEX Files.
Creates A New Run with TED, RIF & SEX Files.
Opens An Existing Run with TED, RIF & SEX Files.
Opens an existing Template via the TED Form.
Switches control to the TED Window.
Switches control to the Run Information Dialogue.
Starts a Run. Clone Worlds, Run Brain, Init Brain, Assign Bots, Evaluate.
Pauses / Unpauses a Run.
Resets The Run.
Opens & switches control to the Hits Histogram Window.
Shows The Communications Debug Dialogue.
Shows the appropriate Environment Display Window.
Shows the appropriate Bot Display Window.
This gets called every time the "Show Bot" menu is displayed.
Shows the Show Bot By ID Dialogue.
This procedure gives the user help on BOTSsim when they press Help à Help Topics
Displays the Help About Box.
Changes to the appropriate directory for BOTSsim. Assigns BOTSsim an appropriate BOTSsim Help File. Disallows the ability to start a Run.
Close The Brain Component As Well.
Animates the Environments.
Sends the Bots' Fitness Levels to the Brain...
Enables the Run Feature.
Disables the Run Feature.
Enables the Start Run Feature.
Disables the Start Run Feature.
Updates the RUN Display on the Status Bar.
Updates the TED Display on the Status Bar.
Updates the TED Display on the Status Bar.
Initialises all of the Run Information Variables so that they
start within their specified ranges before the the initial
Display of the Run Information Dialogue.
Displays all of the desired Run Information values.
Open The Desired Run Information File.
Verify any changes made, save validated changes.
Cancel any changes made & close the dialogue.
Raises the Help Window.
Sets the modified flag to TRUE.
Sets the modified flag to FALSE.
Copies the Run Information Dialogue's Environment Variables over
the Environment Variables used by the actual Environment Component.
Retrieves the Run Information Variables.
Validates the Run Information Variables.
Sets the PopulationSize to the appropriate value.
Saves the Run file.
Saves the rule sets.
Sets the bot window to be the bot selected.
Cancels the change bot number.
Saves a template.
Opens a template.
The Paint Event Gets Handled As A Draw Event.
This procedure closes the form when the uses presses File à Close
This procedure gives the user help on TED when they press Help à Help Topics. NOTE--TED's Help Context ID is 400 in the Help File.
This procedure turns create mode on, and sets the create mode to be a robot.
This procedure turns create mode on, and sets the create mode to be a distribution area.
This is the event handler for mouse down.
Creates The TED Form.
This procedure checks that there are less than 20 bots, and if there are creates a new bot with centre at X,Y. if there are 20 bots already, it gives an error message.
This procedure checks that there are less than 20 distribution areas, and if there are creates a new bot with centre at X,Y. if there are 20 distribution areas already, it gives an error message.
This procedure checks that there are less than 20 bins, and if there are creates a new bot with centre at X,Y. if there are 20 bins already, it gives an error message.
Creates a new wall.
This procedure redraws the world
This procedure returns the distance from StartX,Y to EndX,Y
The mouse up event handler.
This procedure turns create mode on, and sets the create mode to be a wall.
This procedure turns create mode on, and sets the create mode to be a bin.
The mouse move event handler.
Destroys the current object.
This procedure allows you to change the properties of the currently selected Object--colour basically.
Saves The Current Template File.
Saves The Current Template File With The Given Name.
Opens a template.
Creates a new template.
This procedure resizes the template information.
Converts Keystrokes To Events.
Shows The About Box.
Increases the Camer Zoom for the Template.
Decreases the Camer Zoom for the Template.
Updates Display Of The Zoom Level.
This procedure creates the 4 boundary walls
Checks Whether The Template Needs Saving Or Not.
Resizes the Scrool Box with the For.
Redraws The Template.
Returns whether the current Template is valid enough for Running.
Updates The Height, Width & Ranges On The Scroller.
Creates a new Environment Window if any more are allowed.
Closes the Dialogue.
Updates the Prompt Caption when the Dialogue is displayed.
Create The Bitmap For Double Buffering.
Disables The Update Display Timer and Frees This Environment Window.
Sets Values For The Environment Display.
Sets Values For The Environment Display.
A Repaint Message Causes A Redraw Of The Displayed Environment.
Changes The Camera Zoom And Updates The Display.
Shows The Clicked On Bot Or Enables Zooming Changes.
Disables Zooming Changes.
Update The Environment Display.
Updates The Height, Width & Ranges On The Scroller.
Gets the height and the width from the user, and passes them back to TED.
This section contains programmer information about the Brain Component. It is in a form that genetic programmers should be comfortable with.
Purpose: The Brain provides a genetic prograing and program evaluation service to the GUI and Environment components, respectively. It not only optimises the control algorithms of individual simulated robots in the population but executes these control algorithms as well.
Coupling: Coupling is achieved via sockets, counicating using the CBEP protocol.
Defines the BOTS optimisation problem in a way that the gp-kernel can operate on.
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
define-terminal-set-for-BOTS
define-function-set-for-BOTS
if-HasBlock-implementation
if-BlockCollide-implementation
if-WallForward-implementation
if-WallBackward-implementation
if-WallLeft-implementation
if-WallRight-implementation
if-BotForward-implementation
if-BotBackward-implementation
if-BotLeft-implementation
if-BotRight-implementation
if-BlockForward-implementation
if-BlockBackward-implementation
if-BlockLeft-implementation
if-BlockRight-implementation
if-BinForward-implementation
if-BinBackward-implementation
if-BinLeft-implementation
if-BinRight-implementation
if-BlockCollide
if-WallForward
if-WallBackward
if-WallLeft
if-WallRight
if-BotForward
if-BotBackward
if-BotLeft
if-BotRight
if-BlockForward
if-BlockBackward
if-BlockLeft
if-BlockRight
if-BinForward
if-BinBackward
if-BinLeft
if-BinRight
define-fitness-cases-for-BOTS
evaluate-standardized-fitness-for-BOTS
define-parameters-for-BOTS
termination-criteria-for-bots
Define Brain module variables which need to be shared among other modules.
David Formosa
Allegro Common LISP for Windows 3.0.2
*population-size*
*number-of-factories*
*maximum-generations*
*bot-factory-groupings*
Run genetic prograing system as a whole. Create a CBEP socket, and then run the genetic prograing system contained in gp-kernel.lsp
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
brain
place-robots-in-environments
Streamlined function to evaluate simple LISP-like expressions. Used to speed evaluation of the control programs of individual Bots.
John Koza, some additional modification by David Formosa
Allegro Common LISP for Windows 3.0.2
fast-eval-fun
fast-eval
install-pseudo-macro
Share gp-kernel variables among other modules.
David Formosa
Allegro Common LISP for Windows 3.0.2
*number-of-fitness-cases* ^M
*max-depth-for-new-individuals* ^M
*max-depth-for-individuals-after-crossover* ^M
*fitness-proportionate-reproduction-fraction* ^M
*crossover-at-any-point-fraction* ^M
*crossover-at-function-point-fraction* ^M
*max-depth-for-new-subtrees-in-mutants* ^M
*method-of-selection* ^M
*method-of-generation*
*seed*
*best-of-run-individual*
*generation-of-best-of-run-individual*
*sensor-reading*
*terminate-brain*
Provide basic genetic programming facilities, to be used in optimisation.
John Koza, with minor modifications by David Formosa and Mark Greenaway
Allegro Common LISP for Windows 3.0.2
run-genetic-prograing-system
evaluate-fitness-of-population
Setup and close CBEP socket connections.
David Formosa
Allegro Common LISP for Windows 3.0.2
*CBEP-stream*
open-cbep
close-cbep
Parse CBEP protocol messages received and perform the appropriate action as defined in semantics.lsp
David Formosa
Allegro Common LISP for Windows 3.0.2
domessage
parser
test-modules
Perform appropriate actions for CBEP protocol messages, such as setting fitness values etc.
Mark Greenaway, with mirroring support added by David Formosa
Allegro Common LISP for Windows 3.0.2
makecall
sensorcall
fitnesslevelcall
getrulesetcall
setruleset
test-if-valid-variable
SetGPVariablescall
errorcall
closecall
mirrorcall
make-new-tree
Send CBEP protocol messages to the GUI/Environment.
David Formosa
Allegro Common LISP for Windows 3.0.2
send-action
send-RobotEnvironment-message
Define sensor structure used to pass sensor values around the Brain component.
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
| Description: | "Define terminal set for BOTS. " |
| Description: | "Define function set for BOTS. " |
| Description: | "Define fitness cases for BOTS. " |
| Description: | "Evaluate standardized fitness for BOTS individuals. " |
| Description: | "Define problem function for the BOTS system. " |
| Description: | "The size of the population used in the current run. ") |
| Type: | Integer |
| Description: | "The number of factories to be used in evaluation of sub-groups of the population. ") |
| Type: | Integer |
| Description: | "The maximum number of generations that the GP kernel system should continue a run for. ") |
| Type: | Integer |
| Description: | "The way bots are grouped to be put into separate factories for evaluation. probably would..." |
| Type: | Array [1..*number-of-factories*] of lists of bot numbers belonging in that factory |
| Description: | "Main function which runs the Brain component of the BOTS system, using the GP kernel to provide optimisation services for the GUI component." |
| Description: | "Return a list detailing which robots should go into which factories for evaluation purposes. This information is constant for a run." |
| Macro: | fast-eval-fun () |
| Description: | "A code body that does fast evaluation of a functional expression. This is a streamlined verson of the fast-eval it strips out the support for functions outher then thouse haveing 2 arguments. |
| Description: | "A fast evaluator that can be used with the Genetic Prograing Paradigm for the Allegro LISP system." |
| Description: | "Install a pseudo-macro called Name, which is implemented by the function Implementation." |
| Description: | "The sensor reading for the bot currently being evaluated "M |
| Type: | A sensor structure. See below. |
| Description: | "Boolean variable dictating whether we should halt brain execution or not. " |
| Type: | A boolean variable. |
run-genetic-prograing-system
| Description: | "Loops over the individuals in the population evaluating and recording the fitness and hits." |
| Description: | "This is the stream for CBEP coinactions. " |
| Type: | A LISP stream. |
| Description: | "Opens up a CBEP connection. Blocks untill the clinet connects " |
| Description: | "Close the CBEP connection. " |
| Description: | "Read in and procesess messages, exiting if the flow of exiction should continue. " |
| Description: | "Parse a message from the protocol " |
| Description: | "This is a simple test module that tests wether the cepb protocol is working. |
Macro: makecall (funname docstring)
| Description: | "This is stub module generator. It creates stub functions so I don't have to do it." |
| Description: | "Load sensor values into the sensor struct and then call the mapping function" |
| Description: | "Load fitness levels into the Brain and continue with the flow of execution. " |
| Description: | "Get the rule set for a bot." |
This function MUST return a rule set message (as defined in BottsS04) and the argument to this is a bot number.
| Description: | "Set a rule set for a bot" |
| Description: | "Returns true if the variable name contained in (first element) is valid for us the SetGPVariables message. See the BotsS04 standard for further details." |
| Description: | "Set the gp variables and continue with the flow of execution. " |
| Using macro: | makecall ResetBrain() |
| Description: | "Cause orderly shutdown and restart of the Brain. If this is ever implemented I'll be very surprised. " |
| Description: | "Gets called when the parser dosen't parse. " |
| Description: | "Close the connection and cause a semi-orderly shutdown of the brain " |
| Description: | Perform the process known as mirroring to half of the population, and remove the other half of the population. See section 3.3 on page 13 of this document for more information about mirroring. |
| Description: | Take a current individual rule set and return a mirrored individual corresponding to that rule set, with certain functions and terminals swapped as described in the section on mirroring. See section 3.3 on page 13 of this document for more information about mirroring. |
| Description: | "Pseudo send. Perpears a action message from a message. " |
| Description: | "True send. Sends a RobotEnviroment-Message. " |
sensor
Description: A structure to hold the various true or false values corresponding to various sensor readings.
Elements:
Boolean values. The meaning of each is described in the standard BotsS01.
HasBlock
BlockCollide
WallForward
WallBackward
WallLeft
WallRight
BotForward
BotBackward
BotLeft
BotRight
BlockForward
BlockBackward
BlockLeft
BlockRight
BinForward
BinBackward
BinLeft
This section contains programmer information about the Environment Component. It is in a form that object-orientated programmers should be comfortable with. Note that some of the information contained in this section is duplicated in other parts of this document in a more traditional form.
This section is a brainstorm on how the environment component might be structured, as well as how the components might interacts. It is intended mainly to inspire, encourage and indeed offend people. J
For the display of the world, we will need some coupling that isn't too tight, but at the same time doesn't restrict flexibility. The most complicated thing I can think of is to allow dragging of objects to reposition them within the world. This would require knowledge of the object's appearance by the user interface.
Now for general display of the entire world, there could be a camera object in the world which is manipulated by the user. A function would be called to pass what is seen by this camera to the GUI component, possibly as a bitmap, possibly as a series of vectors or lines. This would enable the GUI to display the world without really having to know anything about what's in it.
For dragging of objects, this is what we could do: the GUI could receive a description of the object as seen by the camera, and use that description for dragging and creating. A procedure to get this description would have to be called every time an object is created or moved, since the object as seen by the user depends on the position (i.e. distance) of the camera.
OR, the GUI could have direct access to all the data that is necessary to draw the world and draw each individual object, in any camera position. This would give the entire job of display to the GUI, but will mean rather tight coupling.
In the very simplest terms, the way the artificial intelligence is supposed to `train' the Bots is by `evaluating' a large population of Bots, and picking out the most useful ones. This means the brain component will have to be able to manipulate the Bots, and possibly the environment(s), so as to `train' the large number of Bots necessary. This in turn will mean certain control might have to be given to the brain component This is not much of an issue as yet, but it might result in discrepancies with abstraction and coupling. I'll shut up about it for now...
We want to allow the Bots be as configurable as possible, to give the project the flexibility should we decide to exploit it. It might be useful to be able to add things like control of the Bots' maneuverability and speed, or the positions (or indeed types) of their sensors.
To do this the appropriate information will need to be controlled by the user, and coordinated by the environment. The brain component might want to be able to query the capabilities of its Bot, if the corresponding team decides to pursue implementation of the ability to totally reconfigure sensors at runtime.
This is what could happen: The save and restore commands are in the GUI component. The save procedure save any necessary global settings, and then calls a save procedure in the world component to save the state of the world. The world saves its global settings, and then in turn calls save routines for each object to save their states. The Bot's save routine will call an appropriate routine in the brain component to save necessary state information there. And so the program will traverse a tree of `savable' objects, getting each objects to save its state information as it goes, until eventually everything has been saved. This is what I did with SFXy, and it worked very well.
type TBotAction=(goForward,goBackward,turnLeft,turnRight,getBlock,dropBlock,NoOp);
type TThingClass=classofTSimThing;
type TThingClass=classofTRoundThing;
type TThingArray=array[0..10000]ofTSimThing; type PThingArray=^TThingArray;
This type is used internally by the environment component for the storage of SimThings.
Note that it does NOT simply allocate an array of 10000 SimThings when it is created! Despite the specification of an array size, the type can be, and is, used to allocate a smaller (or larger) array.
Set to the number of sensors that Bots have.
These constants are for indexes into the sensor array of the T B o t object. They can be used to find the values of any sensor of any Bot after a call to T W o r l d . A n i m a t e.
Determines the color of the dotted line that encloses the currently selected Thing.
Block that appear from Distribution Areas get their colour from this variable.
v a r B o t T u r n S p e e d : e x t e n d e d ;
Specifies how fast Bots can turn, in radians per frame.
v a r B o t M o v e S p e e d : e x t e n d e d ;
Specifies how fast Bots can move, in millimetres per frame.
v a r F i t n e s s O n M o v e : e x t e n d e d ;
Determines the amount of fitness that gets added to a Bot's fitness level for each frame it moves or turns.
v a r F i t n e s s O n P i c k U p : e x t e n d e d ;
Determines the amount of fitness that gets added to a Bot's fitness level when it picks up a Block.
v a r F i t n e s s O n F l o o r D r o p : e x t e n d e d ;
Determines the amount of fitness that gets added to a Bot's fitness level when it drops a Block outside a Bin.
v a r F i t n e s s O n B i n D r o p : e x t e n d e d ;
Determines the amount of fitness that gets added to a Bot's fitness level when it drops a Block in the correct Bin.
v a r F i t n e s s O n B a d D r o p : e x t e n d e d ;
Determines the amount of fitness that gets added to a Bot's fitness level when it drops a Block in the wrong Bin.
This variable serves no purpose at present. It will be useful when the Bots are to drop Blocks into Bins of the same colour.
v a r S t a r t F i t n e s s : e x t e n d e d ;
Determines the fitness level that gets assigned to every Bot in the World when the simulation starts (i.e. when the I n i t S i m u l a t i o n method is called).
v a r D e a t h F i t n e s s : e x t e n d e d ;
Determines the fitness level that will cause a Bot to die should its fitness fall below this level. This variable is only useful if the M o r t a l B o t s variable (below) is set to T r u e.
Note that a Bot will not actually be destroyed by a d e s t r o y method call when it reaches this point. It will only cease to be a part of the simulation. This is so that if an application is analyzing this Bot during the simulation (displaying statistics to the user, for example), an exception will not result when the Bot dies.
v a r D e a t h F i t n e s s : e x t e n d e d ;
Determines whether Bots can die.
v a r B o t S i z e : e x t e n d e d ;
Specifies the radius (half of the width) of a Bot. Initially set to 75 millimetres.
v a r B l o c k S i z e : e x t e n d e d ;
Specifies the radius (half of the width) of a Block. Initially set to 50 millimetres.
v a r D i s t A r e a S i z e : e x t e n d e d ;
Specifies the radius (half of the width) of a Distribution Area. Initially set to 60 millimetres.
v a r B i n S i z e : e x t e n d e d ;
Specifies the radius (half of the width) of a Bin. Initially set to 70 millimetres.
v a r T i m e S t e p s P e r G e n e r a t i o n : i n t e g e r ;
Determines how many frames of simulation complete an evaluation. (This should be in e v a l u t a t i o n . p a s)
Tworld
p r o p e r t y D i s p l a y B o t I d s : b o o l e a n ;
This flag is false on creation of a T W o r l d object. If set to true, each Bot in the World will be displayed with its Id property near it, in decimal, to aid in visual identification.
p r o p e r t y C a m e r a X : e x t e n d e d ;
p r o p e r t y C a m e r a Y : e x t e n d e d ;
D e t e r m i n e s w h i c h p a r t o f t h e W o r l d g e t s d i s p l a y e d b y a D r a w m e t h o d . T h e c o o r d i n a t e s r e f e r e n c e d b y t h e s e p r o p e r t i e s w i l l b e m a p p e d t o t h e s c r e e n c o o r d i n a t e s r e f e r e n c e d b y W i n d o w C e n t e r X a n d W i n d o w C e n t e r Y , d e s c r i b e d b e l o w .
p r o p e r t y C a m e r a Z o o m : e x t e n d e d ;
Determines how big everything is, as it is seen by the results of a D r a w method. If C a m e r a Z o o m i s 1 , o n e m i l l i m e t r e m a p s t o o n e p i x e l o n t h e s c r e e n .
p r o p e r t y W i n d o w C e n t e r X : i n t e g e r ;
p r o p e r t y W i n d o w C e n t e r Y : i n t e g e r ;
These values define the point on the Canvas where the camera is directed, for the purpose of drawing. They can be left at the creation-defaults of (0, 0), but zooming will then be centered on the top-left corner of the Canvas, and that will look funky. The application should keep these coordinates at the center of the Canvas, by intercepting resize events.
p r o p e r t y i d : i n t e g e r ;
This property is provided solely for outside use. An application may use this property to give each World a unique number for tracking or identification purposes.
c o n s t r u c t o r C r e a t e ;
C r e a t e s a n e w e m p t y W o r l d . ( S e e G e n e s i s 1 : 1 )
p r o c e d u r e S a v e ( v a r f : t e x t ) ;
Saves the entire World and the positions and properties of all of its SimThings to file f, in a text format interpretable by most unix fetishists.
p r o c e d u r e R e s t o r e ( v a r f : t e x t ) ;
Loads a World's state from a file, saved by the S a v e method described above.
p r o c e d u r e D r a w ( v a r C a n v a s : T C a n v a s ) ;
Draws the World and all its objects onto C a n v a s. Note that the canvas is not initially cleaned--this must be done by the application.
f u n c t i o n M o u s e T o T h i n g ( x , y : i n t e g e r ) : T S i m T h i n g ;
Determines the SimThing that is selected by a mouse click at the screen coordinates passed to the function. Returns N I L if no object was clicked.
p r o c e d u r e R e a l T o S c r e e n ( x , y : i n t e g e r ; v a r n e w x , n e w y : e x t e n d e d ) ;
Converts the screen coordinates at (x, y) to the World's real coordinates, according to the current camera orientation determined by C a m e r a X, C a m e r a Y and C a m e r a Z o o m.
p r o c e d u r e R e a l T o S c r e e n ( x , y : e x t e n d e d ; v a r n e w x , n e w y : i n t e g e r ) ;
Converts the real coordinates (x, y) within the World to screen coordinates, according to the current camera orientation determined by C a m e r a X, C a m e r a Y and C a m e r a Z o o m.
p r o c e d u r e I n i t S i m u l a t i o n ;
Initializes the World and the SimThings contained within it, so that it is ready for a simulation.
p r o c e d u r e A n i m a t e ;
Processes one time frame of the simulation. Each Bot in the World is subsequently processed--its sensor information is calculated, then that information is sent to the Brain component for processing into an action, then the action is processed.
This procedure should be called periodically to affect the simulation proper. The speed of the simulation can be consequently controlled by the application.
This method must NOT be called before the I n i t S i m u l a t i o n method is called.
f u n c t i o n C o u n t B o t s : i n t e g e r ;
Returns the number of Bots in the World. This function's primary use is to determine the size of the array that must be passed to the G e t B o t s method, described below.
p r o c e d u r e G e t B o t s ( v a r B o t A r r a y : a r r a y o f T B o t ) ;
Places the object references of all of the Bots in the World into the array B o t A r r a y.
f u n c t i o n C o u n t B i n s : i n t e g e r ;
Returns the number of Bins in the World.
f u n c t i o n C o u n t D i s t A r e a s : i n t e g e r ;
Returns the number of Distribution Areas in the World.
f u n c t i o n C l o n e : T W o r l d ;
Creates a copy of the World and all of its SimThings. Both Worlds are then independent copies of each other.
f u n c t i o n C l o s e s t T h i n g ( B o t : T B o t ; T h i n g T y p e : T R o u n d T h i n g C l a s s ) : E x t e n d e d ;
Find the distance from B o t to the closest Thing of type T h i n g T y p e, in World units.
p r o c e d u r e C a l c u l a t e F i t n e s s ( v a r B o t : T B o t ) ;
Calculates B o t's fitness and stores it in its Fitness property.
TSimThing
This is the abstract class for the Bots, Walls, Blocks, Distribution Areas and Bins contained in a World. T S i m T h i n g objects should not be created, only subtypes of T S i m T h i n g should be created.
p r o p e r t y C o l o r : i n t e g e r ;
The colour that the SimThing is when it is drawn. For now this serves no other purpose, but later it may be used to allow sorting of different colored Blocks into their corresponding Bins.
p r o p e r t y O w n e r : T W o r l d ;
Read-only. Stores the Owning world of this SimThing.
p r o p e r t y S e l e c t e d : B o o l e a n ;
If this value is set to T r u e when the D r a w method (or the D r a w method of this SimThing's owning world) is called, the SimThing will be drawn with a dashed border around it. This is so that a design program can give the user a distinction between a `current' SimThing and a non-`current' one.
c o n s t r u c t o r C r e a t e ( W o r l d : T W o r l d ) ;
Creates the Thing in W o r l d. The initial position of the Thing is determined by the properties of the particular object being created.
p r o c e d u r e S a v e ( v a r f : f i l e ) ;
Saves the state of the Thing, including its position within the World (but not what World it is in) to file f.
p r o c e d u r e R e s t o r e ( v a r f : f i l e ) ;
Restores the position and state of the Thing from file f.
p r o c e d u r e D r a w ( v a r C a n v a s : T C a n v a s ) ;
Draws the Thing in its position within the World onto C a n v a s.
This routine should only be called when the Thing is created. Otherwise, the World's Draw method should be called.
f u n c t i o n C l i c k e d ( x , y : i n t e g e r ) : b o o l e a n ;
Determines if the SimThing has been clicked. x and y are screen coordinates.
Although this method is public, there should be no need for an application to use it. The T W o r l d . M o u s e T o T h i n g method can be used instead in most cases.
f u n c t i o n B o t C o l l i d e ( B o t : T B o t ) : b o o l e a n ;
Determines if B o t is intersecting this thing in its current position. This method should not be called outside e n v i r o n m e n t . p a s.
Detect(x,y,min,max,radius:extended):boolean;
determines if thus thing is intersecting the sensor perimeter created by x, y, m i n, m a x and r a d i u s. This method should not be called outside e n v i r o n m e n t . p a s.
f u n c t i o n C l o n e ( S o u r c e : T S i m T h i n g ) : b o o l e a n ;
Makes this Thing a 'copy' of S o u r c e, provided this Thing and S o u r c e are of the same class. Returns t r u e if successful.
TSimThing
*TRoundThing
T R o u n d T h i n g is another abstract class, for Things with whose position can be determined by a single x/y coordinate pair and (optionally) a direction.
T R o u n d T h i n g objects should not be created.
p r o p e r t y X : e x t e n d e d ;
p r o p e r t y Y : e x t e n d e d ;
Defines the coordinates of the center of the SimThing.
p r o p e r t y D i r e c t i o n : e x t e n d e d ;
Defines the orientation of the SimThing.
At present, this property is only used by the T B o t object. Other objects act and look the same regardless of the value of this property.
Determines if this Thing is currently being carried. Do NOT modify this property.
No uninherited methods for this object.
TSimThing
*TWall
This object is used to create boundaries that the Bots cannot move through.
p r o p e r t y S t a r t X : e x t e n d e d ;
p r o p e r t y S t a r t Y : e x t e n d e d ;
p r o p e r t y E n d X : e x t e n d e d ;
p r o p e r t y E n d Y : e x t e n d e d ;
Determines the positions of both ends of the Wall.
No uninherited methods for this object.
TSimThing
*TRoundThing*TBot
S e n s o r : a r r a y [ 0 . . S E N S O R C O U N T ] o f b o o l e a n ;
Contains the values of the Bot's sensors after a call to it's owning World's A n i m a t e method. This array should not be modified.
p r o p e r t y i d : i n t e g e r ;
This is the number that gets passed to the Brain component to identify the Bot whose sensor information is to be processed into an action. The i d property of all of the Bots in a World MUST be set to the appropriate values before any call to the World's A n i m a t e method.
p r o p e r t y C a r r y i n g : T B l o c k ;
Read-only. Determines which Block the Bot is carrying at any particular instant, if any. If the Bot is not carrying a Block, C a r r y i n g is set to N I L, otherwise it references the Block object that is being carried.
p r o p e r t y H i t s : i n t e g e r ;
Read-only. Specifies the number of blocks that this Bot has successfully dropped in the correct Bin. Set to 0 by a call to the World's I n i t S i m u l a t i o n method.
p r o p e r t y D r o p s : i n t e g e r ;
Read-only. Specifies the number of Blocks that this Bot has dropped, whether inside or outside a
Bin. Set to 0 by a call to the World's I n i t S i m u l a t i o n method.
p r o p e r t y R a n k : i n t e g e r ;
This variable is not affected by any method calls. It can be used by the application to rank Bots over several Worlds.
p r o p e r t y P i c k u p s : i n t e g e r ;
Read-only. Specifies the number of blocks that this Bot has picked up. Set to 0 by a call to the World's I n i t i S i m u l a t i o n method.
p r o p e r t y F i t n e s s : e x t e n d e d ;
Read-only. Specifies the current fitness of this Bot. This value changes as the Bot performs certain actions. The way this value changes is determines by the FitnessOnMove and similar global variables, described in a previous section.
No uninherited methods for this object.
TSimThing
*TRoundThing*TBin
This object is used to create Bins that the Bots can drop Blocks into.
No uninherited properties for this object.
No uninherited methods for this object.
TSimThing
*TRoundThing*TBlock
p r o p e r t y F r o m D i s t A r e a : T D i s t A r e a ;
Specifies which Distribution Area this Block appeared from. This property is used to determine when to make other Blocks apear. Do NOT modify it.
p r o p e r t y D r o p p e d B y : T B o t ;
Specifies which Bot dropped this Block, if any. This is used to prevent a Bot from colliding with a Block it has just dropped, until it moves away from it. Do NOT modify this property.
No uninherited methods for this object.
TSimThing
*TRoundThing*TDistArea
No uninherited properties for this object.
No uninherited methods for this object.
p r o c e d u r e I n v a l i d T e m p l a t e F i l e ;
Brings up a dialog box stating that the template file is invalid or corrupt. (should be in some other file)
f u n c t i o n S k i p T o k e n ( v a r f : T e x t ; T o k e n : S t r i n g ) : B o o l e a n ;
Reads from f character by character until it finds an '=' or goes further than the length of T o k e n. Returns true if the token read matched T o k e n. (should be in some other file)
function ClassToString(TempClass: TThingClass): String;
Converts T e m p C l a s s into a string representation.
function StringToClass(Buffer: String): TThingClass;
Converts the string representation B u f f e r into a class of T S i m T h i n g.
None.
None.
None.
None.
f u n c t i o n W h i c h S i d e ( x , y , x 1 , y 1 , x 2 , y 2 : i n t e g e r ) : b o o l e a n ;
Determines on which side of the line ( x 1, y 1)--( x 2, y 2) is the point ( x, y). Which way is which is determined by the relative positions of the endpoints of the line. Generally, if a point is on the left of the line as you travel from ( x 1, y 1) to ( x 2, y 2), then the result returned will be f a l s e.
f u n c t i o n I s I n s i d e ( x , y , x 1 , y 1 , x 2 , y 2 , x 3 , y 3 , x 4 , y 4 : i n t e g e r ) : b o o l e a n ;
Returns t r u e if the point ( x, y) is inside the 4-sided polygon described by the points ( x 1, y 1), ( x 2, y 2), ( x 3, y 3) and ( x 4, y 4).
This routine is used by the Clicked methods of the various SimThing objects to determine if the user has clicked a line.
f u n c t i o n I s C l o s e E n o u g h ( x 1 , y 1 , x 2 , y 2 , r a d i u s : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the two points ( x 1, y 1) and ( x 2, y 2) are closer than r a d i u s.
f u n c t i o n L i n e C i r c l e C o l l i d e ( x , y , r a d i u s , x 1 , y 1 , x 2 , y 2 : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the Line ( x 1, y 1)--( x 2, y 2) crosses the circle centre ( x, y) radius r a d i u s.
f u n c t i o n T o A n g l e ( x , y : e x t e n d e d ) : e x t e n d e d ;
Converts the polar screen coordinates ( x, y) into an angle, navigational style (North is 0 radians, East is [pi]/2 radians etc.).
f u n c t i o n A n g l e R a n g e ( a n g l e , m i n , m a x : e x t e n d e d ) : b o o l e a n ;
Determines if a n g l e is between m i n and m a x. The function is warranted because the task is a little more complex than two comparisons, since min could be greater than m a x (specifying a range that passes over 0 radians).
f u n c t i o n L i n e C o l l i d e ( x 1 1 , y 1 1 , x 1 2 , y 1 2 , x 2 1 , y 2 1 , x 2 2 , y 2 2 : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the lines ( x 1 1, y 1 1)--( x 1 2, y 1 2) and ( x 2 1, y 2 1)--( x 2 2, y 2 2) intersect.
f u n c t i o n S e c C i r c l e C o l l i d e ( x , y , r a d i u s , s e c x , s e c y , s e c m i n , s e c m a x , s e c r a d : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the circle center ( x, y) radius r a d i u s, and the sector center ( s e c x, s e c y) radius s e c r a d with start and end angles s e c m i n and s e c m a x respectively, intersect.
f u n c t i o n S e c L i n e C o l l i d e ( x 1 , y 1 , x 2 , y 2 , s e c x , s e c y , s e c m i n , s e c m a x , s e c r a d : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the line ( x 1, y 1)--( x 2, y 2), and the sector center ( s e c x, s e c y) radius s e c r a d with start and end angles s e c m i n and s e c m a x respectively, intersect.
f u n c t i o n S e c B o x C o l l i d e ( x 1 , y 1 , x 2 , y 2 , s e c x , s e c y , s e c m i n , s e c m a x , s e c r a d : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the box with boundaries x 1, y 1, x 2 and y 2, and the sector center ( s e c x, s e c y) radius s e c r a d with start and end angles s e c m i n and s e c m a x respectively, intersect.
f u n c t i o n C i r c l e B o x C o l l i d e ( x , y , r a d i u s , x 1 , y 1 , x 2 , y 2 : e x t e n d e d ) : b o o l e a n ;
Returns t r u e if the box with boundaries x 1, y 1, x 2 and y 2, and the circle center ( x, y) radius r a d i u s, intersect.
function BoxBoxcollide(x11,y11,x12,y12,x21,y21,x22,y22:extended):boolean;
Returns t r u e if the box with boundaries x 1 1, y 1 1, x 1 2 and y 1 2, and the box with boundaries x 2 1, y 2 1, x 2 2 and y 2 2, intersect.
None.
None.
None.
None.
f u n c t i o n H o o k u p ( h o s t , p o r t : s t r i n g ) : b o o l e a n ;
connects to the specified host on the specified port, via TCP/IP.
At present, h o s t cannot be an IP address (dotted quad) but p o r t may be a number.
f u n c t i o n G e t M e s s a g e : P C h a r ;
Retrieves a single message from the other end of the connection.
As far as this routine is concerned, a message is lisp-style, i.e. it is enclosed in brackets (), and may contain nested sets of brackets. Anything before the first opening bracket is ignored.
the message returned is an allocated string. Its memory MUST be deallocated after use.
p r o c e d u r e S e n d M e s s a g e ( m e s s a g e : P C h a r ) ;
Sends an arbitrary string to the other end of the connection.
p r o c e d u r e U n h o o k ;
Disconnects from the socket connected to by a call to H o o k U p.
type TThingArray=array[0..10000] of TSimThing;
type PThingArray=^TThingArray;
This type is used internally by the unit for the storage of Worlds.
Set to the maximum number of Bots in an Evaluation. The product of the number of Worlds and the number of Bots in each World cannot exceed this number.
Specifies the number of Bots in each World in an evaluation object. This shouldn't be here, is should be a property of T E v a l u a t i o n, but some choad meister made is a global variable. Michael is not to blame.
Sepcifies the number of Worlds in an Evaluation. This should be a property of T E v a l u a t i o n also.
TEvaluation
This class encapsulates all of the Worlds in a signel Evaluation. It creates all of the Worlds from a template World and prepares them for the simulation.
property TEvaluation.Worlds:integer;
Read-only. Contains the number of Worlds in this evaluation, as sepcified by the Create call (see below).
property TEvaluation.World:TWorldArray;
Read-only. This is the array of Worlds created by the Create call. DO NOT destroy them or otherwise tamper with them as anything of this sort will disrupt the function of the Evaluation.
constructor TEvaluation.Create(Template:TWorld;NewWorlds:integer);
Creates NewWorlds worlds from the template world Template, then calls the InitSimulation method of each one.
procedure TEvaluation.AssignIds(var id:array of integer);
Assigns the Id property of each Bot in each World in the Evaluation from each value in the array. The array is assumed to be in order of Bot then World.
function TEvaluation.CreateFitnessLevelString: string;
Creates the message specifying the fitness levels of all of the Bots in the Evaluation, in the format required by the Common Brain-Environment Protocol (CBEP).
procedure TEvaluation.CreateHitsHistogram(var HitsArray: array of integer; var MaxHeight: Integer);
Creates a histogram of number-of-Bots vs. Hits. The array must have the same number of elements as Worlds*BotsPerWorld.
procedure TEvaluation.CreateBotRankings(var BotRankedID:array of integer);
Assigns the array with the Id's of all of the Bots in the Evaluation, in order of their final fitness levels. The array must have the same number of elements as Worlds*BotsPerWorld.
procedure TEvaluation.Animate;
Calls the Animate methods of all of the Worlds in the Evaluation, once each.
f u n c t i o n G e t B o t ( B u f f M y K n o b : I n t e g e r ) : T B o t ;
Returns the Bot whose Id is B u f f M y K n o b.
GUI
This is the About BOTSsim form. It displays some basic Technical Information about the BOTSsim Application as well as displaying a Bitmap of all of the Group Members. Links are available from the Group Members Bitmap to individual About Boxes for each Group Member.
* Stephen & Colin
Borland Delphi Version 2.0
GUI
This is the Bot Properties Dialogue Box. It allows you to change the properties of a Bot. The properties that can be changed include the Bot's initial direction and the Bot's colour.
* Stephen & Colin
Borland Delphi Version 2.0
* p r o c e d u r e O K B t n C l i c k
* p r o c e d u r e C o l o r S B C l i c k
GUI
This is the Bot form. It displays the properties of a selected Bot in real time. The properties displayed include the Environment Number, Hits, Pickups, Drops, Raw Fitness, and the Rule Set.
* Mik
Delphi
* p r o c e d u r e U p d a t e T i m e r T i m e r
* p r o c e d u r e F o r m C r e a t e
* p r o c e d u r e F o r m P a i n t
* p r o c e d u r e F o r m S h o w
* p r o c e d u r e F o r m D e s t r o y
* p r o c e d u r e C l o s e B u t t o n C l i c k
* p r o c e d u r e S h o w R u l e s e t B u t t o n C l i c k
* p r o c e d u r e F o r m R e s i z e
* p r o c e d u r e F o r m C l o s e
* p r o c e d u r e S h o w E n v i r o n m e n t B u t t o n C l i c k
* p r o c e d u r e F o r m A c t i v a t e
* p r o c e d u r e U p d a t e B o t D i s p l a y
Defines the BOTS optimisation problem in a way that the gp-kernel can operate on.
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
* d e f i n e--t e r m i n a l--s e t--f o r--B O T S
* d e f i n e--f u n c t i o n--s e t--f o r--B O T S
* i f--H a s B l o c k--i m p l e m e n t a t i o n
* i f--B l o c k C o l l i d e--i m p l e m e n t a t i o n
* i f--W a l l F o r w a r d--i m p l e m e n t a t i o n
* i f--W a l l B a c k w a r d--i m p l e m e n t a t i o n
* i f--W a l l L e f t--i m p l e m e n t a t i o n
* i f--W a l l R i g h t--i m p l e m e n t a t i o n
* i f--B o t F o r w a r d--i m p l e m e n t a t i o n
* i f--B o t B a c k w a r d--i m p l e m e n t a t i o n
* i f--B o t L e f t--i m p l e m e n t a t i o n
* i f--B o t R i g h t--i m p l e m e n t a t i o n
* i f--B l o c k F o r w a r d--i m p l e m e n t a t i o n
* i f--B l o c k B a c k w a r d--i m p l e m e n t a t i o n
* i f--B l o c k L e f t--i m p l e m e n t a t i o n
* i f--B l o c k R i g h t--i m p l e m e n t a t i o n
* i f--B i n F o r w a r d--i m p l e m e n t a t i o n
* i f--B i n B a c k w a r d--i m p l e m e n t a t i o n
* i f--B i n L e f t--i m p l e m e n t a t i o n
* i f--B i n R i g h t--i m p l e m e n t a t i o n
* i f--B l o c k C o l l i d e
* i f--W a l l F o r w a r d
* i f--W a l l B a c k w a r d
* i f--W a l l L e f t
* i f--W a l l R i g h t
* i f--B o t F o r w a r d
* i f--B o t B a c k w a r d
* i f--B o t L e f t
* i f--B o t R i g h t
* i f--B l o c k F o r w a r d
* i f--B l o c k B a c k w a r d
* i f--B l o c k L e f t
* i f--B l o c k R i g h t
* i f--B i n F o r w a r d
* i f--B i n B a c k w a r d
* i f--B i n L e f t
* i f--B i n R i g h t
* d e f i n e--f i t n e s s--c a s e s--f o r--B O T S
* e v a l u a t e--s t a n d a r d i z e d--f i t n e s s--f o r--B O T S
* d e f i n e--p a r a m e t e r s--f o r--B O T S
* t e r m i n a t i o n--c r i t e r i a--f o r--b o t s
Run genetic programming system as a whole. Create a CBEP socket, and then run the genetic programming system contained in gp-kernel.lsp
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
* b r a i n
* p l a c e--r o b o t s--i n--e n v i r o n m e n t s
Define Brain module variables which need to be shared among other modules.
David Formosa
Allegro Common LISP for Windows 3.0.2
* * p o p u l a t i o n--s i z e *
* * n u m b e r--o f--f a c t o r i e s *
* * m a x i m u m--g e n e r a t i o n s *
* * b o t--f a c t o r y--g r o u p i n g s *
GUI
This is the CBEP unit. It contains the code that implements the Complex Brain Environment Protocol (CBEP) on the GUI / Environment side. It also contains code to create & destroy the CBEP object.
Borland Delphi Version 2.0
GUI
This is the About Colin form. It is completely inherited from the About Mark form. Information is available under About Mark form specification--section MarkAbout.pas / AboutMark.dfm.
Environment, GUI
Contains routines to connect to the Brain via TCP/IP, and send and receive messages.
Michael Slade
Borland Delphi 2.0
* f u n c t i o n H o o k u p
* f u n c t i o n G e t P r o t o c o l M e s s a g e
* p r o c e d u r e S e n d P r o t o c o l M e s s a g e
* p r o c e d u r e U n h o o k
Environment, GUI
Contains code that stores & displays incoming & outgoing CBEP messages for the purpose of debugging.
Stephen Beacom
Borland Delphi 2.0
* p r o c e d u r e F o r m C r e a t e
* p r o c e d u r e A d d I n c o m i n g M e s s a g e
* p r o c e d u r e A d d O u t g o i n g M e s s a g e
GUI
This is the About David form. It is completely inherited from the About Mark form. Information is available under About Mark form specification--section MarkAbout.pas / AboutMark.dfm.
Environment
This is the heart and bulk of the environment component. It contains an object hierarchy with objects types for a simulated world and the things, called SimThings, contained in that world. It stores position, orientation, and other information about the SimThings in a World, and performs all of the simulation processes, except for the actual brain functions.
Michael Slade
Borland Delphi 2.0
* TWorld
* TSimThing
* TWall
* TRoundThing
* TBot
* TBlock
* TBin
Environment
The Evaluation unit encapsulates objects that allow restricted access to the multiple instances of the Template Environment within the Run.
Michael Slade
Borland Delphi 2.0
* c o n s t r u c t o r C r e a t e
* d e s t r u c t o r D e s t r o y
* p r o c e d u r e A s s i g n I d s
* f u n c t i o n C r e a t e F i t n e s s L e v e l S t r i n g
* p r o c e d u r e C r e a t e H i t s H i s t o g r a m
* p r o c e d u r e C r e a t e B o t R a n k i n g s
* f u n c t i o n G e t B o t
* p r o c e d u r e A n i m a t e
Streamlined function to evaluate simple LISP-like expressions. Used to speed evaluation of the control programs of individual Bots.
John Koza, some additional modification by David Formosa
Allegro Common LISP for Windows 3.0.2
* f a s t--e v a l--f u n
* f a s t--e v a l
* i n s t a l l--p s e u d o--m a c r o
Streamlined function to evaluate simple LISP-like expressions. Used to speed up evaluation of the control programs of individual Bots.
Colin Lowther
Borland Delphi 2.0
* f u n c t i o n C r e a t e T r e e
* p r o c e d u r e D e s t r o y T r e e
* f u n c t i o n I f C l a u s e
* f u n c t i o n A c t i o n
* f u n c t i o n W a l l S e n s o r
* f u n c t i o n W h i c h B
* f u n c t i o n W h i c h G
* f u n c t i o n W h i c h T
* f u n c t i o n B i n S e n s o r
* f u n c t i o n B l o c k S e n s o r
* f u n c t i o n B o t S e n s o r
* f u n c t i o n S e n s o r M a p p i n g
* f u n c t i o n G e t A c t i o n
* p r o c e d u r e I n i t i a l i s e R u l e S e t s
* p r o c e d u r e D e s t r o y R u l e S e t s
* p r o c e d u r e D e s t r o y A l l R u l e S e t s
* p r o c e d u r e S h o w R u l e S e t
* f u n c t i o n T o k e n T o S t r i n g
Converts Raw Fitness into Refined Fitness for the purpose of sending it to the Brain.
Colin Lowther
Borland Delphi 2.0
Environment
This pascal unit contains procedures that perform the analytic geometry needed by Environment.pas for the simulation. Among these are line-circle intersection, line-sector intersection, and so on.
Michael Slade
Borland Delphi 2.0
* WhichSide
* IsInside
* IsCloseEnough
* LineCircleCollide
* ToAngle
* AngleRange
* LineCollide
* SecCircleCollide
* SecLineCollide
* SecBoxCollide
* CircleBoxCollide
Provide basic genetic prograing facilities, to be used in optimisation.
John Koza, with minor modifications by David Formosa and Mark Greenaway
Allegro Common LISP for Windows 3.0.2
* r u n--g e n e t i c--p r o g r a i n g--s y s t e m
* e v a l u a t e--f i t n e s s--o f--p o p u l a t i o n
Share gp-kernel variables among other modules.
David Formosa
Allegro Common LISP for Windows 3.0.2
* * n u m b e r--o f--f i t n e s s--c a s e s *
* * m a x--d e p t h--f o r--n e w--i n d i v i d u a l s *
* * m a x--d e p t h--f o r--i n d i v i d u a l s--a f t e r--c r o s s o v e r *
* * f i t n e s s--p r o p o r t i o n a t e--r e p r o d u c t i o n--f r a c t i o n *
* * c r o s s o v e r--a t--a n y--p o i n t--f r a c t i o n *
* * c r o s s o v e r--a t--f u n c t i o n--p o i n t--f r a c t i o n *
* * m a x--d e p t h--f o r--n e w--s u b t r e e s--i n--m u t a n t s *
* * m e t h o d--o f--s e l e c t i o n *
* * m e t h o d--o f--g e n e r a t i o n *
* * s e e d *
* * b e s t--o f--r u n--i n d i v i d u a l *
* * g e n e r a t i o n--o f--b e s t--o f--r u n--i n d i v i d u a l *
* * s e n s o r--r e a d i n g *
* * t e r m i n a t e--b r a i n *
This unit contains code for operating the Histogram Window. The Histogram is a Bar Chart that displays the number of Hits achieved by each Bot. As an after-thought we decided to add the ability for the Hits Histogram to display Hits, Pickups or Drops for all the Bots. On the 17th of September the Histogram was changed so that it would display percentages of the Bot Population instead of the actual number of Bots. This was done to increase the accuracy & scaling factor.
Colin Lowther & Stephen Beacom
Borland Delphi Version 2.0
* p r o c e d u r e F o r m S h o w
* p r o c e d u r e R e s e t H i s t o g r a m C l i c k
* p r o c e d u r e C a n c e l B t n C l i c k
* p r o c e d u r e R e s e t H i t s H i s t o g r a m
Setup and close CBEP socket connections.
David Formosa
Allegro Common LISP for Windows 3.0.2
*CBEP-stream*
open-cbep
GUI
This is the main form, also known as the BOTSsim form. It is the first window that the user sees when the program starts, and is responsible for coordinating all of the components. Through this window, runs are loaded, launched and saved. Users can also get online instructions, open other windows, launch TED, and quit from this window.
* Stephen Beacom, Colin Lowther, Mik Scheper
Borland Delphi Version 2.0
* p r o c e d u r e F i l e S a v e R u n C l i c k
* p r o c e d u r e F i l e N e w R u n C l i c k
* p r o c e d u r e F i l e O p e n R u n C l i c k
* p r o c e d u r e F i l e E x i t C l i c k
* p r o c e d u r e F i l e O p e n T e m p l a t e C l i c k
* p r o c e d u r e E d i t T e m p l a t e C l i c k
* p r o c e d u r e E d i t R u n I n f o C l i c k
* p r o c e d u r e R u n S t a r t R u n C l i c k
* p r o c e d u r e R u n P a u s e R u n C l i c k
* p r o c e d u r e R u n R e s e t R u n C l i c k
* p r o c e d u r e V i e w H i t s H i s t o g r a m C l i c k
* p r o c e d u r e V i e w C o m m u n i c a t i o n s C l i c k
* p r o c e d u r e S h o w E n v i r o n m e n t
* p r o c e d u r e S h o w B o t
* p r o c e d u r e B o t M e n u C l i c k
* p r o c e d u r e B o t S h o w A n o t h e r B o t C l i c k
* p r o c e d u r e H e l p T o p i c s C l i c k
* p r o c e d u r e H e l p A b o u t C l i c k
* p r o c e d u r e F o r m C r e a t e
* p r o c e d u r e F o r m C l o s e
* p r o c e d u r e A n i m a t i o n T i m e r T i m e r
* p r o c e d u r e E n d O f G e n e r a t i o n
* p r o c e d u r e A l l o w R u n
* p r o c e d u r e D i s a l l o w R u n
* p r o c e d u r e A l l o w S t a r t R u n
* p r o c e d u r e D i s a l l o w S t a r t R u n
* procedure UpdateRunDisplay
* procedure UpdateTemplateDisplay
* procedure UpdateRunInfoDisplay
GUI
This is the About Mark form. It displays some basic Technical Information about Mark as well as displaying mugshot style bitmaps of Mark. Also contained are Notable Comments made by Mark, as well as what Project sections Mark is responsible for. Also visible here is Mark's alias ( a.k.a. N/A ).
Borland Delphi Version 2.0
GUI
This is the About Michael form. It is completely inherited from the About Mark form. Information is available under About Mark form specification--section MarkAbout.pas / AboutMark.dfm.
GUI
This is the About Mik form. It is completely inherited from the About Mark form. Information is available under About Mark form specification--section MarkAbout.pas / AboutMark.dfm.
Parse CBEP protocol messages received and perform the appropriate action as defined in semantics.lsp
David Formosa
Allegro Common LISP for Windows 3.0.2
domessage
parser
GUI
This unit contains code for operating the Run Information Dialogue. This unit has code for Opening and saving the dialogue's variables, as well as code for sending the Environment Variables to the Environment Component and code for sending the GP Variables to the Brain Component via the IPC method of Sockets using our BOTSsim project's proprietary socket protocol CBEP.
Borland Delphi Version 2.0
GUI
This unit contains for Loading & Saving Runs.
Borland Delphi Version 2.0
Perform appropriate actions for CBEP protocol messages, such as setting fitness values etc.
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
makecall
sensorcall
set-slot-and-eat
fitnesslevelcall
getrulesetcall
setruleset
test-if-valid-variable
SetGPVariablescall
errorcall
Send CBEP protocol messages to the GUI/Environment.
David Formosa
Allegro Common LISP for Windows 3.0.2
* s e n d--a c t i o n
* s e n d--R o b o t E n v i r o n m e n t--m e s s a g e
Define sensor structure used to pass sensor values around the Brain component.
Mark Greenaway
Allegro Common LISP for Windows 3.0.2
GUI
To allow the user to choose by Bot ID the Bot whose details to show in the Bot Window.
Borland Delphi Version 2.0
* p r o c e d u r e O K B t n C l i c k
* p r o c e d u r e C a n c e l B t n C l i c k
* p r o c e d u r e F o r m S h o w
GUI
This is the About Stephen form. It is completely inherited from the About Mark form. Information is available under About Mark form specification--section MarkAbout.pas / AboutMark.dfm.
GUI
This unit contains the code for the TED Form. Contained within is code for creating, opening, saving and editing Template Environments. That's about it really.
Borland Delphi Version 2.0
* p r o c e d u r e S a v e T e m p l a t e
* p r o c e d u r e O p e n T e m p l a t e
* p r o c e d u r e F o r m P a i n t
* p r o c e d u r e C l o s e T E D C l i c k
* p r o c e d u r e H e l p T o p i c s C l i c k
* p r o c e d u r e C r e a t e B o t C l i c k
* p r o c e d u r e C r e a t e D A C l i c k
* p r o c e d u r e T e m p l a t e M o u s e D o w n
* p r o c e d u r e F o r m C r e a t e
* p r o c e d u r e C r e a t e N e w B o t
* p r o c e d u r e C r e a t e N e w B i n
* p r o c e d u r e C r e a t e N e w B l o c k
* p r o c e d u r e C r e a t e N e w W a l l
* p r o c e d u r e D r a w
* f u n c t i o n P o i n t D i s t a n c e
* p r o c e d u r e T e m p l a t e M o u s e U p
* p r o c e d u r e C r e a t e W a l l C l i c k
* p r o c e d u r e C r e a t e B i n C l i c k
* p r o c e d u r e T e m p l a t e M o u s e M o v e
* p r o c e d u r e E d i t D e s t r o y C l i c k
* p r o c e d u r e E d i t C h a n g e P r o p e r t i e s C l i c k
* p r o c e d u r e T e m p l a t e S a v e C l i c k
* p r o c e d u r e T e m p l a t e S a v e A s C l i c k
* p r o c e d u r e T e m p l a t e O p e n C l i c k
* p r o c e d u r e T e m p l a t e N e w C l i c k
* p r o c e d u r e C r e a t e N e w T e m p l a t e
* p r o c e d u r e F o r m K e y P r e s s
* p r o c e d u r e A b o u t C l i c k
* p r o c e d u r e Z o o m I n C l i c k
* p r o c e d u r e Z o o m O u t C l i c k
* p r o c e d u r e U p d a t e Z o o m L e v e l
* p r o c e d u r e C r e a t e B o u n d a r y W a l l s
* p r o c e d u r e F o r m C l o s e
* p r o c e d u r e F o r m R e s i z e
* p r o c e d u r e T e m p l a t e P a i n t
* f u n c t i o n I s T e m p l a t e V a l i d
* p r o c e d u r e U p d a t e T e m p l a t e S c r o l l e r
GUI
Allows the user to an Environment based upon it's Environment Number.
Borland Delphi Version 2.0
* procedure OKBtnClick
* procedure CancelBtnClick
GUI
This unit contains code that displays any Environment.
Borland Delphi Version 2.0
* procedure FormCreate
* procedure FormClose
* procedure FormShow
* procedure FormResize
* procedure FormPaint
* procedure FormMouseMove
* procedure FormMouseDown
* procedure FormMouseUp
* procedure UpdateDisplayTimer
* procedure UpdateEnvironmentScroller
GUI
This unit contains the code for the Template Dimensions Dialogue. Code contained within this unit implements the functionality for creating a Template Environment of user defined dimensions.
Borland Delphi Version 2.0
* procedure OKBtnClick
BOTSsim standards are a reference for all group members to refer to. Originally there were seven separate standards, but only four are shown here. The others are either obsolete, or their contents are contained within other parts of this document.
This BotsS provides information about the sensors possessed by the Bots. The sensors exist to communicate data about the simulated world into the robot's "Brain".
This standard regards the robot a vector. From the robot there are 4 directions Forward, Backward, Left and right
Forward is the direction that the vector points.
Backward is 180° from forward.
Right is 90° clockwise from forward.
Left is 270° clockwise from forward.
This sensor MUST return True if the bot is holding a block otherwise it MUST return a False.
This sensor MUST return True if the bot is close enough to pick up a block otherwise it MUST return False.
This sensor MUST return True if the bot is close enough to drop a block in a bin otherwise it MUST return False.
There are 4 wall sensors, Forward, Backward, right and left. The 4 sensors possess a common range (Rw) and an individual scope (Swf Swb Swr Swl). The sensors MUST cover all directions without blind spots i.e. Swf + Swb + Swr + Swl = 360
The Forward wall sensor MUST return True if there is a wall within the sector with a radius of Rw and an angel of Swf otherwise it MUST return False. This sector SHOULD face forward.
The Forward wall sensor MUST return True if there is a wall within the sector with a radius of Rw and an angel of Swr otherwise it MUST return False. This sector SHOULD face right.
The Backward wall sensor MUST return True if there is a wall within the sector with a radius of Rw and an angel of Swb otherwise it MUST return False. This sector SHOULD face backward.
The Left wall sensor MUST return True if there is a wall within the sector with a radius of Rw and an angel of Swl otherwise it MUST return False. This sector SHOULD faceleft.
There are 4 bot sensors, Forward, Backward, right and left. The 4 sensors possess a common range (Rb) and an individual scope (Sbf Sbb Sbr Sbl). The sensors cover all directions without blind spots i.e. Sbf + Sbb + Sbr + Sbl = 360
The Forward bot sensor MUST return True if there is a bot within the sector with a radius of Rb and an angel of Sbf otherwise it MUST return False. This sector SHOULD face forward.
The Right bot sensor MUST return True if there is a bot within the sector with a radius of Rb and an angel of Sbr otherwise it MUST return False. This sector SHOULD face right.
The Backward bot sensor MUST return True if there is a bot within the sector with a radius of Rb and an angel of Sbb otherwise it MUST return False. This sector SHOULD face backward.
The Left bot sensor MUST return True if there is a bot within the sector with a radius of Rb and an angel of Sbl otherwise it MUST return False. This sector SHOULD face left.
There are 4 block sensors, Forward, Backward, right and left. The 4 sensors have an individual scope (Slf Slb Slr Sll). The sensors MUST cover all directions without blind spots i.e. Slf + Slb + Slr + Sll = 360
The Forward block sensor MUST return True if there is a block within the sector with an infinite radius and an angel of Slf otherwise it MUST return False. This sector SHOULD face forward.
The right block sensor MUST return True if there is a block within the sector with an infinite radius and an angel of Slr otherwise it MUST return False. This sector SHOULD face right.
The Backward block sensor MUST return True if there is a block within the sector with an infinite radius and an angel of Slf otherwise it MUST return False. This sector SHOULD face forward.
The left block sensor MUST return True if there is a block within the sector with an infinite radius and an angel of Slf otherwise it MUST return False. This sector SHOULD face forward.
There are 4 bin sensors, Forward, Backward, right and left. The 4 sensors have an individual scope (Sif Sib Sir Sil). The sensors MUST cover all directions without blind spots i.e. Sif + Sib + Sir + Sil = 360
The Forward bin sensor MUST return True if there is a bin within the sector with an infinite radius and an angel of Sif otherwise it MUST return False. This sector SHOULD face forward.
The right bin sensor MUST return True if there is a bin within the sector with an infinite radius and an angel of Sir otherwise it MUST return False. This sector SHOULD face right.
The Backward bin sensor MUST return True if there is a bin within the sector with an infinite radius and an angel of Sif otherwise it MUST return False. This sector SHOULD face forward.
The left bin sensor MUST return True if there is a bin within the sector with an infinite radius and an angel of Sif otherwise it MUST return False. This sector SHOULD face forward.
This BotsS provides information about communication between the Brain and GUI/Environment modules. This is based on the Context diagram in report two. This protocol is built on top of TCP however I believe it is possible to mount it on any stream based protocol.
This document is split into two sections, The Brain à Environment messages, and the Environment à Brain messages.
The protocol MUST be case insensitive.
There are a number of brain à Environment messages they all take the basic form of
<Message> ::= "(" <MessageName> <space> {<Argument>}")"
The messages are Action, RobotEnvironment, Rule set, FitnessOrder, Ready and Error.
These messages go from the brain to the GUI.
The action message represents an action resulting from a sensor mapping request.
The action message MUST be returned as a result of a Sensor message (defined in 3.1). It has the form of
<Message> ::= "(" "Action" <space> <Argument>")"
The robotEnvironment message represents the grouping of bots into enviroments.
The robotEnvironment message MUST be returned as a result of a FitnessLevel message (defined in 3.2) or SetGPVariables (defined in 3.5). It has the form of
<Message> ::= "(" "RobotWorld" { <space> "(" <botno> {<space> <botno>} ")" } ")"
The meaning is to put each bot botno into enviroment enviromentno.
e.g.
(RobotWorld (4 1 2 8)(7 6 5 3))
means place robots 1,2,4 and 8 into world 0, and robots 3,5,6,7 into world 1.
The rule set message represents one bots brain, returned after the request for one.
The get rule message MUST be returned as a result of a GetRuleSet message (defined in 3.3). It has the form of
<Message> ::= "(" "Rule set" <space> <Lisp-S-Expression> ")"
The ready message MUST be returned as a result of a successful connection.
This message MAY be returned when an error occurs. The error takes the form of
This message MAY be returned when the input is acceptable.
There are a number of Environment à Brain messages they all take the basic form of
<Message> ::= "(" <MessageName> <space> {<Argument>}")"
The messages are Sensor, FitnessLevel, GetRuleSet, SetRuleSet, SetGPVariables, Mirror, reset and GetFitnessOrder.
The sensor message represents the values of the sensors at some point
The sensor message MUST occur some time after the SetGPVerable message has been sent
<Message> ::= "(" "Sensor" <space> <botno> <space> <Bincollide> <space> <HasBlock> <space> <BlockCollide> <space> <WallForward> <space> <WallBackward> <space> <WallLeft> <space> <WallRight> <space> <BotForward> <space> <BotBackward> <space> <BotLeft> <space> <BotRight> <space> <BlockForward> <space> <BlockBackward> <space> <BlockLeft> <space> <BlockRight> <space> <BinForward> <space> <BinBackward><space> <BinLeft><space> <BinRight> ")"
Where <HasBlock> etc. is "T" or "Nil"
The FitnessLevel represents the value of each robots fitness.
The FitnessLevel message MUST occur some time after the SetGPVariable message has been sent.
<Message> ::= "(" "FitnessLevel" {<space><value>} ")"
Where each <value> is the value of that robots raw fitness of the n'th robot.
The GetRuleSet represents a request for a rule set.
The GetRuleSet message MUST occur some time after the SetGPVerable message has been sent.
<Message> ::= "(" "GetRuleSet" <space> <botno> ")"
The SetRuleSet represents an attempt to set the rule set for a robot.
The SetRuleSet MUST occur some time after the SetGPVerable message has been sent.
<Message> ::= "(" "SetRuleSet" <space> <botno> <space> <Lisp-S-Expresstion>")"
The <Lisp-S-Expresstion> SHOULD be valid lisp, the Brain MAY return an error if it is not.
The SetGPVariables represents an attempt to set the variables for the system.
The SetGPVariables message MUST be sent only once during a run.
The SetGPVariables message MUST occur as a response to the Ready message.
<Message> ::= "(" "SetGPVariables" <space> "(" { "(" <Varname> <space> <Varvalue>")" } ")"
SHOULD reset the brain.
The close message MUST cause the connection and the brain component to undergo an orderly shutdown.
The Mirror message SHOULD cause the Brain to implement rule set mirroring. The stability of the brain after this message is send is not guaranteed.
This BotsS defines standards for actions. There are three types of actions movement, block, and noop.
The robot model from BotsS01 is used in this document.
Movement actions cause the robot to change its vector.
This action means that a robot moves forward by a user defined distance.
This action means that a robot moves backward by a user defined distance.
This action means that a robot turns to the left by a user defined distance.
This action means that a robot turns to the right by a user defined distance.
Block action cause the robot to change the robots ownership of a block.
This action means that a robot picks up a block if available.
This action means that a robot drops a block if it has one.
This action means that the robot dose not do anything for this time period (pronounced No Op or noop)
This BOTS Standard provides information about the File Formats used for Loading and Saving Runs. The information saved includes Template Environments, Run Information and Bot Rule Sets. BOTSsim provides facilities for Loading and Saving Template Environments and Run Information separately or as part of a Run. This document contains sections that explain the File Formats used for Loading and Saving Runs, Template Environments, Run Information and Bot Rule Sets.
The RUN File is just a blank file that we create for the purposes of directory searching. The RUN File contains the File Name of the Run, this is the same File Name that is used for saving the TED, RIF and SEX files for the same Run.
The TED File contains the data for all of the objects that appear in that Template Environment. Note that <ObjectClass> can at the moment be any of Wall, Bot, Bin or DA.
The first line contains the title and type of the file. The title used for Template Environments is "Template Environment". If the correct title is not scanned by the file interpreter then the file is deemed to be an invalid Template Environment file.
<Title> ::= "Template Environment"
The second line contains the number of objects in the Template Environment.
<TotalThings> ::= "TotalThings=" <Total Things>
Each Wall in the Template Environment contains 6 lines that identify the it's properties.
<Line 1> ::= "ObjectClass=" <ObjectClass>
<Line 2> ::= "StartX=" <Start X Coordinate>
<Line 3> ::= "StartY=" <Start Y Coordinate>
<Line 4> ::= "EndX=" <End X Coordinate>
<Line 5> ::= "EndY=" <End Y Coordinate>
<Line 6> ::= "Colour=" <Colour>
Each Round Thing in the Template Environment contains 5 lines that identify the it's properties. Round Things within the Template Environment are Bots, Bins and Distribution Areas.
<Line 1> ::= "ObjectClass=" <ObjectClass>
<Line 2> ::= "X=" <X Coordinate>
<Line 3> ::= "Y=" <Y Coordinate>
<Line 4> ::= "Direction=" <Starting Direction>
<Line 5> ::= "Colour=" <Colour>
The RIF File contains the data for all of the Run Information variables applicable to a Run.
The first line contains the title and type of the file. The title used for Run Information Files is "RunInformationVariables". If the correct title is not scanned by the file interpreter then the file is deemed to be an invalid Run Information file.
<Title> ::= "RunInformationVariables"
Each subsequent line contains data that identifies the Variable Name, and Variable Value.
<Run Information Variable> ::= <VariableName> "=" <VariableValue>
The SEx File contains the data for all of the Rule Sets used by Bots in that Run.
The first line contains the Number Of Rule Sets stored in that file.
<Number Of Rule Sets> ::= "NumberOfRuleSets=" <Number Of Rule Sets Value>
The rest of the file are rule sets. Each rule set is on a separate line and the number of rule sets MUST be equal or greater than the number in the first line of the file.
Log exist to record a log of events that occur in the systems history.
The Unified Log (So called because it unified a number of previously separate logs.) records the rule sets and fitness over the generations. In general enteries in this log MUST take the form.
<Unified Log Line> ::= "(" <Entry Type> <Space> {<Argument>} ")"
The Entry type SHOULD be one of "Header", "Rule set", "FitnessLevel", "BestBot", "Generation". This field is case insensertive.
The Unified log MAY contain a Header. If present it SHOULD be the first line in the log. The header MAY contain data to aid analysis.
<Header> ::= "(Header" <SPACE> {"(" <Header-Attribute-Type> <Header-Attribute-Value> ")" } ")"
At the time of writing there where no standard header-type values.
This Entry has the same format as the Rule set message from the Cbep standard. See that for details
This Entry has the same format as the FitnessLevel message from the Cbep standard. See that for details
This Entry records the best Bot within a generation. There MUST not be more then one BestBot entry within the scope of a generation.
<BestBot> ::= "(BestBot" <SPACE> {"(" <BestBot-Attribute-Type> <BestBot-Attribute-Value> ")" } ")"
The Attribute Types currently are Fitness, Pickups, Drops, Hits, and Rule set. Unknown Attributes SHOULD be silently ignored.
The value of this attribute is a real number representing the fitness of the best bot.
The value of this attribute is a integer number representing the number of the times the bot has picked up a block.
The value of this attribute is a integer number representing the number of the times the bot has dropped a block.
The value of this attribute is a integer number representing the number of the times the bot has picked up and dropped a block in the correct place.
This Entry has the same format as the FitnessLevel message from the Cbep standard. See that for details.
This
The Comms log contains data for debugging of the Brain/Environment. communications link.
All entries in this log take the form
BBBB >> CBEP message
For messages to the brain
EEEE << CBEP message
For messages to the enviroment