Bots and Simulations > DNA - General
Eye template
Shadowgod2:
oh i had also made a simple eye scanning today too
start
*.robage 9 mod 4 sub .focuseye store
stop
now with the new code:
start
*.robage1 *.robagemult 32000 mult add *.robage add 9 mod 4 sub .focuseye store
stop
it doesn't seem to be storing anything in .robagemult though
Botsareus:
lol, I know it is a pointless exercise, I just want people to get the math involved without spelling anything out. That does not make them better programmers. If you take a + 4 mod 4 it is going to be equal to a mod 4. duh!
It becomes useful as Numsgil exposed math to conditions a while back, you can for example get away with
cond
*.robage *.robage1 32000 mult add
32000 777 add >
start
...
stop
I am really going to sleep now :)
Testlund:
Well, that's my problem. I suck at math. With these operators I can't figure out what exactly is being calculated, so it becomes all trial and error for me.
OK, let's see what I can do with your examples...
Testlund:
--- Quote from: Botsareus on September 13, 2014, 09:33:50 PM ---Testlund in a more serious programming language people always write 2 + 2 = 4 as 4 = 2 + 2, review my posts, good night. :sleepin:
--- End quote ---
Yeah, I'm aware of the reversed polish notation or whatever it's called, otherwise I wouldn't have gotten this far. But I don't understand why the .robage2 instruction wasn't executed in my example.
Testlund:
I'm getting the same problem here. The first instruction to move forward is carried out, but not the second where it's supposed to move backwards.
--- Code: ---def robagemult 50
def robage1 51
start
*.robage1 *.robagemult 32000 multi add 32000 add
stop
cond
*.robage 32000 =
start
.robage1 inc
.up inc
stop
cond
*.robage1 32000 =
start
0 .robage1 store
.robagemult inc
.dn inc
stop
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version