C2e Brains
From ccdevnet
Want to make a c2e brain? So do all the cool kids! So here's some documentation, currently mostly covering the svrules.
Introduction
The 'accumulator' is the temporary working space used by the c2e svrule system. Generally, you load values into the accumulator, work with them, and then store them back somewhere else.
Lobes/Tracts
"Update Lobe/Tract" means the update rule runs. "Initialization Rule runs always" means the initialization rule is run repeatedly before the update rule if "Update Lobe/Tract" is also checked.
The update sequence/order just defines when the component is processed in relation to other bits of the brain.
Lobes
Lobes define sets of neurons.
X/Y position and colour are just used by the Brain in a Vat kit, we think.
The lobe ID can be any four letter, but the game engine has many of them hard-coded for certain tasks, and will stomp over the data in them!
Width and height are used to define the number of neurons, and probably also the dendrite spread.
Tissue ID needs to be unique for attached emitters etc to work right, at least. 255 is probably unused.
Tracts
Tracts define sets of dendrites between two lobes.
You set a source lobe with a number of connections per neuron, and a destination lobe with the same. The numbers of connections can either be the exact numbers, or the maximum numbers, depending on which option you select.
Dendrites will only attach to neurons labelled between the start and end neuron numbers, inclusive.
When migration is *disabled*:
Dendrites are initialised in order, starting from the beginning of the lobe and ending at the end. All connections end up satisfied. You may not use 0 for the number of connections, apparently.
When migration is *enabled*:
Dendrites are initialised randomly. 0 for number of connections means the number of dendrites on that end is unconstrained? But you obviously must be constrained on one side, so you can't have 0 for both source and destination.
The Genetics Kit describes "NGF state" (Neural Growth Factor state?) as "the state variable in source/destination neurons that is used to select which source/destination neuron migratory dendrites should connect to". Basically, migrating dendrites choose the source neurons and destination neuron(s?) with the highest value of that state variable.
SVRule Opcodes
0: stop
Stops processing of the current rule.
1: blank
Set the specified destination to zero.
2: store in
Copy the contents of the accumulator to the specified destination.
When storing to a neuron value, The Brain-in-a-vat seems clamped to [-1.0, 1.0]. To check.
3: load from
Copy the contents of the specified distination to the accumulator.
4-15: if commands
Only execute the following opcode if the specified condition for the accumulator is true.
Warning: Not yet checked.
16-21: basic arithmetic
Perform the specified arithmetic operation on the accumulator.
Warning: Not yet checked.
22-23: minimum/maximum with
Sets the accumulator to the minimum/maximum value of the current accumulator value and the specified value.
24: set tend rate
Set the rate (as a fraction of the difference) at which to 'tend' towards things using the 'tend to' opcode.
Zero by default. Negative values seem to have the same effect as positive ones.
25: tend to
Modify the accumulator so it moves further towards the operand, using the fraction specified in 'set tend rate' to decide how much of the difference to add/remove from the accumulator.
26-27: load negation/abs of
Set the accumulator to the negation or absolute value of the operand.
For instance, loading the negation of 0.5 will result in -0.5 and vice versa. However, loading the absolute value of either 0.5 or -0.5 will result in 0.5.
28: get distance to
Set the accumulator to the absolute value of the difference between the accumulator and the operand.
29: flip around
Subtracts the accumulator from the operand, and stores the result in the accumulator (ie, same as 'subtract from').
30: no operation
Do nothing.
31: register as spare
Register this neuron(?) as spare.
Used by:
- decision lobe
- attention lobe
Warning: Not yet checked.
32-33: bound in range
Bind the operand between (inclusively) either [0,1] or [-1,1], and store the result in the accumulator.
For instance, binding 1.4 to [0,1] would result in 1.0 being stored, but binding -0.2 to [-1,1] would result in -0.2 being stored.
34-35: add/tend to and store in
Like either the 'add' or 'tend to' opcodes, but store the result in the operand instead of the accumulator.
36: Nominal Threshold
If the accumulator is less than the value of the operand, set the accumulator to zero. Otherwise, do nothing.
Warning: Not yet checked.
37: Leakage Rate
Set the leakage rate (used by rest state) to the value of the operand.
Unused?
38: Rest State
??
Unused?
39: Input Gain Hi Lo
??
Unused?
40: Persistence
drives neuron State towards neuron Input value;
S(1) = S(0) + ( (1-Persistence) * (I(0) - S(0)) )
Unused?
41: Signal Noise
??
Unused?
42: Winner Takes All
??
Unused?
43: ShortTerm Relax Rate
Set the short-term relaxation rate.
Used by:
- drive to combination tract
Warning: Not yet checked.
44: LongTerm Relax Rate
Set the long-term relaxation rate, and does the relaxation calculation.
Off the top of fuzzie's head, it goes like this (hardcoded vars):
- weight = weight + (Var 1 - weight) * STR
- Var 1 = Var 1 + (weight - Var 1) * LTR
ie, it's intended to pull the weight downwards towards Var 1 (stable state) at a speed according to STR, and Var 1 upwards towards the weight at a speed according to LTR.
Warning: Not yet checked.
45: store abs in
??
46-47: stop if zero/nonzero
??
48-49: if zero/nonzero goto
??
50-51: divide/multiply by, add to neuron input
This seems to, indeed, divide or multiply by the operand, and add to the neuron Input variable (var 1).
Tired, might be wrong, etc.
52: goto line
??
53-56: stop if condition
??
57: Reward Threshold
??
Unused?
58: Reward Rate
??
Unused?
59: Use Reward With
??
Unused?
60: Punish Threshold
??
Unused?
61: Punish Rate
??
Unused?
62: Use Punish With
??
Unused?
63: Preserve Neuron SV
Very weird. If I remember correctly, it basically stores the value of the neuron variable given by the *value* of the operand, in the neuron Var 4. ie, if you pass it a value '3.0' it will take Var 3 and store that in Var 4.
Tired, might be wrong, etc.
64: Restore Neuron SV
I think this does the opposite of 63.
Unused? Tired, might be wrong, etc.
65: Preserve Spare Neuron
Like 63 (preserve neuron SV), only with the spare neuron.
Unused? Tired, might be wrong, etc.
66: Restore Spare Neuron
I think this does the opposite of 65.
Tired, might be wrong, etc.
67-68: if negative/position goto
??
SVRule Operands
0: accumulator
The accumulator, as described in the introduction. Useful for instructions which only operate on an operand, such as the "bound in" opcodes.
1: input neuron
The source neuron for the dendrite which this svrule is running on?
2: dendrite
The dendrite which this svrule is running on?
3: neuron
The neuron which this svrule is running on? (or the destination neuron, for dendrites)
4: spare neuron
??
5: random
A random number between 0.0 and 1.0.
6: source chemical
??
7: chemical
A chemical level (with chemical# specified)?
8: destination chemical
??
9: zero
The literal value 0.0.
10: one
The literal value 1.0.
11: value
A literal value from 0.0 to 1.0.
12: negative value
A literal value from 0.0 to -1.0.
13: value x 10
A literal value from 0.0 to 10.0.
14: value / 10
A literal value from 0.0 to 0.1.
15: value integer
A literal value from 0 to 248.
