Author Topic: Is there something wrong with this  (Read 6961 times)

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« on: January 11, 2010, 07:43:30 PM »
 Look at this gene
Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.eye5 40 < or
*.refshell 0 > or
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or
*.totalbots *.totalmyspecies sub 100 > and or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop
It <you>should</you> make the bot turn when theres nothing worth looking at and set its focus on the bot in focus otherwise. But no matter what I try it just wants to turn around endlessly  . If your wondering what kind of bot this is for, its for a sheperd bot im creating. By the way, .avgfitness is a custom variable which refers to the average fitness of the last ten bots hes seen.

Edit: somethings wrong with the post system, I tell it to underline a word and it puts you's on both sides of it in <> signs then it auto spell checks the you's into you's.
« Last Edit: January 11, 2010, 07:46:59 PM by Houshalter »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #1 on: January 11, 2010, 07:48:57 PM »
The last and or statement could be your problem. The and counts the whole command stack, the or is then left with nothing.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #2 on: January 11, 2010, 07:52:50 PM »
So how do you "or" two independent conditions together eg;
a 1 >
b 1 > and



c 1 >
d 1 > and

now I want it to activate when both or either of these two conditions are true? Is there any way to do that



<you>Now Im going to try to get it to under line these words</you>
« Last Edit: January 11, 2010, 07:53:20 PM by Houshalter »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #3 on: January 11, 2010, 08:14:29 PM »
the boolean operators take the top two booleans from the stack and add the result to the stack. So it would look like this:

[A]
and
[C]
[D] and or

to elaborate, the first and adds A and B; then, the second and adds B and C, those being on top of the stack. You can then or the two results together.

I'm getting the underline thing too...
« Last Edit: January 11, 2010, 08:16:58 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #4 on: January 11, 2010, 08:18:53 PM »
So you mean do something like this?
Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or
*.totalbots *.totalmyspecies sub 100 > and or
*.eye5 40 < or
*.refshell 0 > or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop

Edit: Wait scratch that...

Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <=
*.totalbots *.totalmyspecies sub 100 > and or
*.eye5 40 < or
*.refshell 0 > or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop
I mean this.
« Last Edit: January 11, 2010, 08:21:29 PM by Houshalter »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #5 on: January 11, 2010, 08:23:52 PM »
Sadly, I have no idea what you are trying to achieve. If you could break the conditions down step-by-step in pseudocode, it would make things much simpler for me.

The post-edit version makes sense, at least. Run it and see if it works

If it helps, this is what it does:
FIXED and NRG (Condition A )
FIT and SPECIES (Condition B )
A or B or EYES or SHELL
« Last Edit: January 11, 2010, 08:26:22 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #6 on: January 11, 2010, 08:32:32 PM »
Ya, I hate trying to figure out other peoples bots to.
Here I go

'this is the original code not the one I just changed
start                'obvious
*.reffixed 0 =                'check to see if the robot im looking at is fixed (if it is I either have to feed it or let it go)
*.refnrg 10000 > and     'if its not fixed and it already has plenty of nrg then why bother just staring at it?
*.eye5 40 < or              ' If theres nothing in my eye then turn till there is
*.refshell 0 > or            'I am trying to avoid evolving bots with shell so I put this one in there
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or      'this line checks
                                                                  'the fitness of the bot im looking at based on the refvars and tells me if its less then or equal to average fitness
*.totalbots *.totalmyspecies sub 100 > and or   'even if its less then average fitness I can still feed it if the population is to low
157 .aimdx store      now if any of those conditions are true turn me right (or left, im not sure)
not 'Otherwise do the following
*.refxpos *.refypos angle .setaim store    'set my aim at the robot in my eye
stop 'we're done here

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #7 on: January 11, 2010, 08:41:12 PM »
I never tried using in-line conditions, have you ever tried using algebraic functions as booleans? It's time-consuming but foolproof...
...for example, the genes
cond
 *.reffixed 0 =
start
 15 .up store
stop

becomes

15 *.reffixed sgn abs -- abs ..up mult store

EDIT => I think I wrote a post about all the possible functions in the DNA section once. Also check out the OCULUS II code; it's a super-efficient piece of code I wrote that puts the closest eye in focus. Then eyef can be read as though it were eye5. It's a monster of conditionless logic that combines at least 45 conditions into a single expression as seen above
« Last Edit: January 11, 2010, 08:56:52 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #8 on: January 11, 2010, 08:59:51 PM »
Yes I did but I didn't get it at all so I figured out how to use the boolean operators instead  . I already have a hard enough time debugging my bot. By the way there was some improvement with the last change I made. Instead of spinning endlessly it stops and stares at a bot untill it randomly explodes several cycles later  . I don't even know where to begin now.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #9 on: January 11, 2010, 09:05:14 PM »
I suppose spontaneous combustion might have its advantages in a species...

To clarify, the bit you posted was designed to only turn and face a bot.
If I understand you intentions correctly, and you want to feed the bot, use -2 .shoot store to fire a food shot.

EDIT => If you want, I could maybe rewite OCULUS II to suit your needs?
« Last Edit: January 11, 2010, 09:07:46 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #10 on: January 11, 2010, 09:06:48 PM »
Ya pretty much. This is what the bot looks like now:  



<you>Trying the underline function one more time...</you>
« Last Edit: January 11, 2010, 09:07:14 PM by Houshalter »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Is there something wrong with this
« Reply #11 on: January 11, 2010, 09:11:14 PM »
Uh...your bot is a veggie isn't it? You need to turn the autotroph function on if so when starting a new sim.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #12 on: January 11, 2010, 09:14:37 PM »
Yes it is and I figured out part of what was wrong. It tries to store 30,000 in shell, poison, and slime, but the simulator only lets it have a maximum of 500 slime. So it keeps trying to store more and more, etc. I'll fix that. As to why it won't shoot food shots at the bots, well thats a whole nother can of worms.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Is there something wrong with this
« Reply #13 on: January 12, 2010, 02:57:41 AM »
Underlining is square brackets, not angular.  eg: [] not <>

Offline Houshalter

  • Bot Destroyer
  • ***
  • Posts: 312
    • View Profile
Is there something wrong with this
« Reply #14 on: January 12, 2010, 06:39:49 AM »
<you>Thats right but I just used the underline button</you>
« Last Edit: January 12, 2010, 06:40:04 AM by Houshalter »