5 * Created by Alyssa Milburn on Mon Aug 13 2007.
6 * Copyright (c) 2007 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
30 * random:0:chem 5:PLUS:state
31 * state:PLUS:type 0:MINUS:type 1
32 * input:TRUE:output:TRUE:suscept:move twrds:255:64
33 * suscept:TRUE:chem 0:TRUE:STW
36 * state:PLUS:state:PLUS:state
37 * type 0:TRUE:type 0:PLUS:type 1
41 unsigned char processSVRule(oldNeuron
*cell
, oldDendrite
*dend
, uint8
*svrule
, unsigned int len
) {
44 for (unsigned int i
= 0; i
< len
; i
++) {
118 if (!state
) return 0;
143 /* creatures 2 is different, we should probably remap at load time:
146 case 24: // rnd const
151 case 29: // curr src leak in
161 case 39: // move twrds
163 case 41: // <error>*/
170 oldLobe::oldLobe(oldBrain
*b
, oldBrainLobeGene
*g
) {
178 unsigned int width
= g
->width
, height
= g
->height
;
180 if (width
< 1) width
= 1;
181 if (height
< 1) height
= 1;
183 neurons
.reserve(width
* height
);
186 for (unsigned int i
= 0; i
< width
* height
; i
++) {
187 neurons
.push_back(n
);
193 void oldLobe::init() {
200 void oldLobe::wipe() {
204 void oldLobe::tick() {
208 oldBrain::oldBrain(oldCreature
*p
) {
213 void oldBrain::processGenes() {
214 shared_ptr
<genomeFile
> genome
= parent
->getGenome();
216 for (vector
<gene
*>::iterator i
= genome
->genes
.begin(); i
!= genome
->genes
.end(); i
++) {
217 if (!parent
->shouldProcessGene(*i
)) continue;
219 if (typeid(**i
) == typeid(oldBrainLobeGene
)) {
220 oldBrainLobeGene
*g
= (oldBrainLobeGene
*)*i
;
221 oldLobe
*l
= new oldLobe(this, g
);
222 lobes
[lobes
.size()] = l
; // TODO: muh
227 void oldBrain::init() {
228 for (std::map
<unsigned int, oldLobe
*>::iterator i
= lobes
.begin(); i
!= lobes
.end(); i
++) {
229 if (!(*i
).second
->wasInited()) (*i
).second
->init();
233 void oldBrain::tick() {
234 for (std::map
<unsigned int, oldLobe
*>::iterator i
= lobes
.begin(); i
!= lobes
.end(); i
++) {
239 oldLobe
*oldBrain::getLobeByTissue(unsigned int id
) {
240 if (lobes
.find(id
) == lobes
.end())