Bots and Simulations > DNA - General

Chameleon genes

(1/2) > >>

Jez:
I must be missing something here, want the set of genes as a closed loop in the bots code. Figured that *.memval can only be used for one value per turn.

Biggest problem has been *.reqmemval and *.reqmemloc ending up as the same value when I make minor changes

Have been testing against Ymir which uses a value of 8741 in mem loc 604 for ID

I've tried lots of different ways but seem to always end up against a brick wall.  

Test bot I have been using:

def count 987
def foundmemloc 51
def reqmemval 52

cond
*.count 1 =
*.reqmemval 0 !=
*.foundmemloc 0 !=
start
0 .count store
stop

'CHAMELEON GENES
'********************Adding count to next genes makes refmemval and foundmemloc same
cond
*.refeye 0 !=
'*.count 1 =
*.eye5 0 >
*.refshoot *.myshoot !=
*.foundmemloc 0 !=
'***********************Why not this line? (makes reqmemval and foundmemloc same)
'*.reqmemval 0 =
start
*.foundmemloc .memloc store
*.memval .reqmemval store
stop

cond
'*.count 1 =
*.reqmemval 0 !=
*.foundmemloc 0 !=
start
*.reqmemval *.foundmemloc store
stop

cond
*.refeye 0 !=
*.eye5 0 >
*.refshoot *.myshoot !=
*.robage 1 >
*.foundmemloc 0 =
'*.reqmemval 0 =
start
.memloc .memloc store
*.memval .foundmemloc store
'1 .count store
stop

'*****BOT******
cond
*.nrg 1000 >
start
50 .repro store
stop

cond
*.numties 0 =
*.count 0 = and
*.refshoot *.myshoot !=
*.eye5 0 >
start
*.refxpos *.refypos angle .setaim store
10 .up store
-1 .shoot store
stop

cond
*.eye5 0 =
*.refshoot *.myshoot = or
start
145 .aimsx store
stop
end

Would appreciate it if someone could check the code and tell me why the bot seems to like living in cloud cuckoo land everytime I make these changes.  

PurpleYouko:
I don't see any place in the genes above where you actually stored the value in .reqmeloc into a memory location

Basically, in order to read .memval you have to first store a value into .memloc

if you want to find a value of 8741 in memory location 604, you need something like...


--- Code: ---cond
start
  604 .memloc store
stop

cond
  *.memval 8741 =
start
  'do whatever you want
stop
--- End code ---

Jez:
Hiya PY  

Thanks for looking at the code. It's a bit muddled because I switched the order of genes to see if that helped.

The first time it sees an enemy it should do:

.memloc .memloc store
*.memval .foundmemloc store (what value do you have in memloc)

The next time it sees an enemy it should do:

*.foundmemloc .memloc store
*.memval .reqmemval store  (what value do you have in the location you store in memloc)

And then store the value in the same memory location using:

*.reqmemval *.foundmemloc store

All of which leads to the bot, using the code posted, to display the correct behaviour against Ymir, it probably won't win but it will last for a while.

However, if I enable the line:

'***********************Why not this line? (makes reqmemval and foundmemloc same)
'*.reqmemval 0 =

It won't work properly.

Or if I enable the count cond in the chameleon genes it won't work properly.
So I figure there is something I'm not taking account of, normally I can work out why the code isn't working but not this time.  

PurpleYouko:
I can't see amy obvious reasopn why it shouldn't work.

Have you tried stepping it through with the console?

Jez:
Only as far as working out that the reason it stops working (if I add those extra bits) is that it stores 604 in location 604 or doesn't store 8741 in location 8741.

Can't figure why though. (Beyond reqmemval and foundmemvloc are the same.)

I'll go and run it through the console a few more times. See if I can find anymore info about how it goes wrong.

[Edit]It could be reading the value from it's friends instead I suppose, hmm, might be problem.

Navigation

[0] Message Index

[#] Next page

Go to full version