Bots and Simulations > Bot Tavern
Ambitious MB project
bacillus:
Sweet as, you do that.
Houshalter:
Heres what I got so far. sorry its not much, my computer I had it saved on went down for a while. I now have it saved to a gmail account just in case.
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']def botnumber 70 'what number I am in the tentacle chain
def lasttienum 71 'last tienumber (nessasary for comunication) I found out you
'can use .tiepres. May have to change this
def agewhentied 72 'what age was I when I tied to my first bot (or got tied to)
def whichside 73 'which side of the tentacle will I search for food?
def clock 74 'turn clockwise or counter clockwise?
def foundveg 75
'========================================================================
'touts and outs and ins tins etc.
' out1 = numties
' tout1 = my botnumber
' out2 = botnumber
' tout2 = which side of the bot my search pattern is assigned
' tout3 = refxpos
' tout4 = refypos
' tout5 = communication state
'========================================================================
'reproduce to form a new tentacle
'NOTE: this is temporary to test the performance of the tentacle, my idea
' is that the tentacle will grow longer over time when theres nrg.
cond
*.foundveg 1 !=
*.botnumber 20 !=
*.robage 20 >
*.eye5 0 =
start
*.nrg 20 *.botnumber sub div 100 >
*.nrg 20 *.botnumber sub div *.nrg div 100 mult .repro store
stop
'what to do when I see my new offspring
cond
*.numties 1 =
*.multi 1 =
*.refeye *.myeye =
*.reftie *.myties =
*.refmulti 0 =
*.in1 0 =
start
*.lasttienum 1 =
.tie inc
not
.tie inc inc
stop
'set my out1 (can change if nessacary) to show if im part of the main bot yet
'so when im a new cell I won't be tied to two tentacles instead of just one
cond
*.out1 *.numties !=
start
*.out1 *.numties store
stop
'store a value in .lasttienum to find what tie connects to the bot behind me
cond
*.multi 1 =
*.lasttienum 0 =
start
*.tiepres .lasttienum store
stop
'Find out what cell number I am etc, once im a multibot
cond
*.multi 1 =
*.botnumber 0 =
start
*.readtie *.tiepres != 'this makes sure it stores .tieread before it does
'anything
*.tiepres .readtie store
not
*.tin1 1 add .botnumber store
stop
'store .botnumber in tout1
cond
*.tout1 *.botnumber !=
start
*.botnumber .tout1 store
stop
'find age when tied
cond
*.multi 1 =
.agewhentied 0 =
start
*.robage .agewhentied store
stop
'store my bot number in my out2
cond
*.botnumber *.out2 !=
start
*.botnumber .out2 store
stop
'search for food
Cond
*.foundveg 1 !=
*.multi 1 =
start
*.clock 0 = and
100 .aimdx store
*.clock 1 = and
-100 .aimdx store
stop
'check the bot behind me if I should be searching on the left or the right
cond
*.whichside 0 =
*.readtie *.lasttienum =
start
*.tin2 1 =
.whichside inc inc
.tout2 inc inc
*.tin2 2 =
.whichside inc
.tout2 inc
stop
'turn untill I see bot next to me
cond
*.eye5 0 >
*.refeye *.myeye =
*.reftie *.myties =
*.numties 2 =
start
*.in2 *.botnumber 1 sub =
*.whichside 1 = and
*.in2 *.botnumber 1 add =
*.whichside 2 = and or
*.clock 0 = and
.clock inc
*.in2 *.botnumber 1 add =
*.whichside 1 = and
*.in2 *.botnumber 1 sub
*whichside 2 = and or
*.clock 1 = and
.clock dec
stop
'if I have one tie then just turn untill I see bot behind me
cond
*.eye5 0 >
*.numties 1 =
*.refeye *.myeye =
*.reftie *.myties =
*.in2 *.botnumber 1 sub
start
*.clock 1 =
.clock dec
*.clock 0 =
.clock inc
stop
'when I see food I? (should I put a refshell/slime condition here?)
cond
*.eye5 0 >
*.refshoot 0 =
*.reftie 0 =
*.refkills 0 =
start
*.refxpos *.refypox angle .setaim store
.tie inc inc inc 'I only want to shoot one tie but this might shoot untill it hits
*.foundveg 0 =
*.foundveg inc
*.tout3 *.refxpos !=
*.refxpos .tout3 store
*.tout4 *.refypos !=
*.refypos .tout4 store
*.tout5 1 !=
.tout5 1 store
stop
Please note that its only half complete. I just wanted to show the direction I was going in and ask if anyone has any suggestions. Right now my problem is trying to get the bots to pass the veggies on. I want the bot to calculate the diference between itself and the veggie, then set an angle between that and the bot next to it and use tieloc/tieval to set the veggies aim toward the bot next to at while firing memory shots at it to make it move. It will comunicate its refxpos refypos through the tie and the next bot will set its aim toward the veggie and fire a tie at it when it sees it, overiding the previous tie. I think I can make it compatible with the main bot but I'll have to add a gene to every bot that only activates when its a tentacle cell.
bacillus:
I'll be away for a week, but I'll have a look at the code when I get back
Houshalter:
well hopefully I'll have it working by then .
bacillus:
I think I see where you're going, but just to clarify a few things:
X inc inc will increment location X, then increment zero. you have to implicitly say X inc X inc or X dup inc inc.
The repro gene should multiply by 100 first, not last, otherwise rounding means you either end up with zero or 100. (No fractions or decimals!)
--- Code: ---cond
*.out1 *.numties !=
start
*.out1 *.numties store
stop
--- End code ---
make that second *.numties simply .numties and it should be sweet.
*.lasttienum seems to refer to the first, not last, tie, so should probably be left seperate from .tiepres, which refers to the most recent tie. Other than that, the code seems pretty good. You may want to look into taking advantage of OCULUS, I'll be using it here and there anyway...
I was thinking that using 31999 rnd ++ .tie store to make a virtually unique tie ID could be helpful for organizing ties. Do you think this would be a good idea to implement?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version