CDR

Tutorial Two

This tutorial focuses mainly on exploring State Variable Rules (SVRules). Quoting from the genetics kit help file:

State Variable Rules (or SVRules) are genetically defined functions that are used throughout a brain lobe structure to control several aspects of synaptic behaviour, as well as an SVRule to compute a neurone€s state.

Tutorial One demonstrated how the leakage rate was applied to the State of a cell to move it towards its rest state. A leakage rate is a function that is applied to state to get the output of the cell. An SVRule is the same. It is a function that is applied to the state of a cell to calculate the output (Here I'm talking about the 'Neurone State Rule' in the 'Cell Body' tab of the brain lobe). Both leakage rate and SVRule act on the state to produce the output. In the following examples we will set the leakage rate to the largest possible value (52 years). This will effectively disable the leakage and only apply the SVRule to the state. This will allow us to view the exact effects of various SVRules.

An SVRule is like a miniature program written in a special programming language. This programming language has a number of 'opcodes' or operations that it can perform on various pieces of data. The result of all the opcodes is assigned to be the output of the cell. Only eight individual opcodes are allowed in an SVRule making them very small and fast to execute - the SVRule for every cell in the brain must execute approximately 10 times per second!

The following table lists the opcodes available for writing SVRules. The descriptions after each opcode are what I think they do. I obtained this data through experimentation so if you have other information relating to what an opcode does or means please let me know. Following the description in the example column there may be a link to a page that goes through an example using BrainCellMonitor to display the effects of that particular opcode.

Updated 10/04/1999: A full table of the latest state variable rule information for all creatures versions is now available. The table below may be out of date but is valid for this tutorial.

Opcode Description
end Marks the end of an SVRule. Any opcodes appearing after this marker are ignored.
0 The integer number zero. Can be used for calculations.
1 The integer number one. Can be used for calculations. For example, adding or subtracting one from the current state.
64 The integer number sixty-four. Can be used for calculations. For example, adding or subtracting sixty-four from the current state.
255 The integer number 255. Can be used for calculations. For example, adding or subtracting 255 from the current state.
chem 0 Represents the current amount of chemical 0 in the brain lobe. This chemical can be added to a lobe through a genetic receptor.
chem 1 Represents the current amount of chemical 1 in the brain lobe. This chemical can be added to a lobe through a genetic receptor.
chem 2 Represents the current amount of chemical 2 in the brain lobe. This chemical can be added to a lobe through a genetic receptor.
chem 3 Represents the current amount of chemical 3 in the brain lobe. This chemical can be added to a lobe through a genetic receptor.
state Represents the current value of the state of the cell.
output Represents the current output value of the cell.
thres The value of 'Nominal Threshold' defined in 'Cell Body Dynamics'.
type 0 The sum of type 0 dendrites.
type 1 The sum of type 1 dendrites.
anded 0 If all type 0 dendrites are firing then this will be the value of the sum of these dendrites. If any of the type 0 dendrites are not firing then this value will be 0.
anded 1 If all type 1 dendrites are firing then this will be the value of the sum of these dendrites. If any of the type 1 dendrites are not firing then this value will be 0.
input To be defined.
conduct To be defined.
suscept Current susceptibility to reinforcement - but which one? Type 0 or Type 1 dendrites? The cell itself? Needs investigating.
STW STW means Short Term Weight but which one? Type 0 or Type 1 dendrites?
LTW LTW means Long Term Weight but which one? Type 0 or Type 1 dendrites? LTW acts as a rest state for STW. STW and LTW reduce towards each other with LTW moving slower than STW.
Strength Current value of dendrite strength - I assume it is the sum of all the strengths of all the dendrites? Or is it type 0 or type 1?
TRUE If the previous opcode evaluates to TRUE (ie. not zero) then execute the remaining opcodes otherwise the value of state is zero and the SVRule completes. This is what appears to happen in example 4.
PLUS Adds the value of the following option to the value of the previous opcode.
MINUS Subtracts the value of the following opcode from the value of the previous opcode. For example 'state:MINUS:1' will subtract '1' from the current value of 'state'.
TIMES Takes the left hand opcode multiplied by the right hand opcode and divides this by 256. The result of this calculation is the value of this opcode. For example: '64:TIMES:thres' where 'thres' is 32 will be 32*64/256=8.
INCR Returns the value of the previous opcode incremented by one. For example 'state:INCR' will add one to the current value of state.
DECR Returns the value of the previous opcode decremented by one. For example 'state:DECR' will subtract one from the current value of state.
unused To be defined.
unused To be defined.
ERROR To be defined.

To demonstrate the effects of SVRules we will modify the example1 norn from Tutorial 1. This norn will be changed to make sure the leakage rate does not affect the cell output so we can view the effects of the SVRules. Load the norn from example1 in Tutorial 1 into the genetics kit and modify the 'Cell Body' tab of the additional brain lobe that was created to have the following settings:

Nominal Threshold 0 - slider all the way to the left
Leakage Rate 248 - 52 Years - Slider all the way to the left
Rest State 0 - slider all the way to the left
Input gain lo-hi 255 - slider all the way to the right


A .gen file is available in base.zip to use as a starting point if you wish.

Example 1

The .gen file and a norn exported with this genome is available in example1.zip. This should enable you to try some of this example out even if you don't have the genetics kit.

  1. Start from the base norn described above.
  2. Under the 'Cell Body' tab set the 'Neurone State Rule' to be 'State:MINUS:1'. This creates an SVRule which subtracts one from the state and stores it in output every clock tick.
  1. Accepting the state rule above should show the brain lobe screen below.

  2. Close the dialog box and save the genome as example1.gen.
  3. Make sure Creatures is running and use the 'Lay Egg' option of the genetics kit to insert an egg with this genetic file into the game.
  4. Hatch the egg.
  5. You should now have a norn in the world with an extra brain lobe.
  6. Run the BrainCellMonitor program and press the 'Connect' button. The title of the program should indicate the name of the selected norn in creatures.
  7. Press 'Add Cell' and set the values to 'Lobe 9', 'Cell 0', 'Dendrite 0' and choose 'Ok'.
  8. You should now see the data for this brain cell appearing in the list box and updating every half second or so. Everything should be zero.
  9. In the 'CAOS' edit area, enter the following CAOS command: inst,trig 9 0 255,endm
  10. Press the 'Execute' button. This will cause lobe 9, cell 0 to fire at its maximum value.
  11. You should see the first two numbers in brackets in the list box change to (255/255/...). This is the ouput and state values respectively.
  12. Approximately every second or so you should see the numbers dropping by one (ie. to 254, 253, 252, etc). This is the result of th SVRule we asked for where we said we wanted the output to be 'State minus 1'.

  13. Press Disconnect. Close BrainCellMonitor.
  14. Export the norn from Creatures and we'll try another one in Example 2.

Example 2

  1. Start from the base norn described above.
  2. Under the 'Cell Body' tab set the 'Neurone State Rule' to be 'State:INCR'. This creates an SVRule which adds one to the state and stores it in output every clock tick.


  1. Close the dialog box and save the genome as example2.gen.
  2. Make sure Creatures is running and use the 'Lay Egg' option of the genetics kit to insert an egg with this genetic file into the game.
  3. Hatch the egg.
  4. You should now have a norn in the world with an extra brain lobe.
  5. Run the BrainCellMonitor program and press the 'Connect' button. The title of the program should indicate the name of the selected norn in creatures.
  6. Press 'Add Cell' and set the values to 'Lobe 9', 'Cell 0', 'Dendrite 0' and choose 'Ok'.
  7. You should now see the data for this brain cell appearing in the list box and updating every half second or so. This time rather than everything being zero you should see the state and output numbers increasing by one without even having to fire the lobe. When the numbers hit 255 the incrementing will stop as 255 is the maximum value. We've effectively created a simple timer.
  8. In the 'CAOS' edit area, enter the following CAOS command: inst,trig 9 0 0,endm
  9. Press the 'Execute' button. This will cause lobe 9, cell 0 to drop back to zero and start incrementing again.
  10. Press Disconnect. Close BrainCellMonitor.
  11. Export the norn from Creatures and we'll try another one in Example 3.

Note that the 'DECR' opcode does the opposite of INCR. The SVRule 'state:DECR' is functionally the same as 'state:MINUS:1'.

Example 3

  1. Start from the base norn described above.
  2. Under the 'Cell Body' tab set the 'Neurone State Rule' to be 'thres'. This creates an SVRule which sets the state to the value of 'Nominal Threshold' in the 'Cell Body Dynamics' section of the brain lobe.
  3. Set the 'Nominal Threshold' slider to '33' (see Tutorial one for details on 'Nominal Threshold').
  1. Close the dialog box and save the genome as example3.gen.
  2. Make sure Creatures is running and use the 'Lay Egg' option of the genetics kit to insert an egg with this genetic file into the game.
  3. Hatch the egg.
  4. You should now have a norn in the world with an extra brain lobe.
  5. Run the BrainCellMonitor program and press the 'Connect' button. The title of the program should indicate the name of the selected norn in creatures.
  6. Press 'Add Cell' and set the values to 'Lobe 9', 'Cell 0', 'Dendrite 0' and choose 'Ok'.
  7. You should now see the data for this brain cell appearing in the list box and updating every half second or so. You should see the value of 'State' as being '33' always (or whatever value you put in the nominal threshold). Note that the output is zero because the cell will only fire if the value of state is greater than the nominal threshold. Try doing this exercise again with the SVRule set to 'thres:PLUS:1' and you should see the output as '1' and state as '34'. The '1' comes from output being calculated as state minus threshold.

Example 4

This example lists the SVRules that were set and the results that were observed. By following the previous examples you should be able to work out how to duplicate the results.

SVRule Result
thres:TRUE:64 The state is set to 64 only if the value of 'Nominal Threshold' is not zero. If the threshold is zero then the state will be zero.
64:TIMES:thres With 'Nominal Threshold' set to 1 we get a result of '0'.
With 'Nominal Threshold' set to 64 we get a result of '16'.
With 'Nominal Threshold' set to 32 we get a result of '8'.
The result of using TIMES appears to be left-hand-opcode multiplied by right-hand-opcode divided by 256.

The following opcodes still need to be worked out in future examples (they'll be displayed in the table above when done):

Opcode Description
input To be defined.
conduct To be defined.
suscept Current susceptibility to reinforcement - but which one? Type 0 or Type 1 dendrites? The cell itself? Needs investigating.
STW STW means Short Term Weight but which one? Type 0 or Type 1 dendrites?
LTW LTW means Long Term Weight but which one? Type 0 or Type 1 dendrites? LTW acts as a rest state for STW. STW and LTW reduce towards each other with LTW moving slower than STW.
Strength Current value of dendrite strength - I assume it is the sum of all the strengths of all the dendrites? Or is it type 0 or type 1?

 

Back