### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Messages - bacillus

Pages: [1] 2 3 ... 60
1
##### DNA - General / SS (Single Store) Bot Guide
« on: March 14, 2014, 06:47:14 PM »
I just got asked by MysticalDumpling to make a SS Bot guide. Sounded like a fun exercise, so I'll do my best, but bear in mind I haven't touched DB in around three years.

The Inofficial SS Guide 1.0

Step 1: Conditions

The most important, and hardest part, of writing a SS bot, is writing up your conditions. I'll start with some simple examples and move from there:

Code: [Select]
`*.eye5 40 sub sgn 0 floor`
This statement is equivalent to *.eye5 40 >. How?

First, we subtract 40 from *.eye5; if *.eye5 was larger than 40, the value will be negative, if it was equal to 40, zero, and if it was less than 40, negative. the sgn operator reduces these possibilities to {-1, 0, 1}. Finally, the floor multiplier folds -1 and 0 into 0. End result is 0 if it's less than or equal, or 1 if it's greater.

Here's some more examples:

Code: [Select]
`*.refeye *.myeye sub sgn abs`
*.refeye *.myeye !=. Same deal as before. the sub sgn reduces us to {-1, 0, 1}, depending on whether *.refeye is smaller, equal, or greater than *.myeye, respectively. abs turns -1 into 1, so we have 0 if they're equal, and 1 if they're not equal.

Code: [Select]
`*.refeye *.myeye sub sgn abs -- abs`
*.refeye *.myeye =. The same example as above, but inverted.  -- abs is a very handy tool, as it inverts the result of a condition (i.e. it's our NOT operator).

Step 2: Compounding Conditions

This step's actually fairly easy. Once you have all your conditions written out, you AND them together by multiplying their values, like so:

Code: [Select]
`2000 *.nrg sub sgn 0 floor*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor mult`
We'll only get 1 if both the conditions are one, otherwise the result is 0.

OR isn't much tricker. We add the conditions together and apply the abs operator.

Code: [Select]
`2000 *.nrg sub sgn 0 floor*.refeye *.myeye sub sgn abs add abs39 *.eye5 sub sgn 0 floor add abs`
XOR's the only tricky one here. We need to check that the sum of the two conditions is exactly one. add -- abs will give us 0 if that's true and 1 otherwise, so we invert it using the NOT operator (-- abs):

Code: [Select]
`2000 *.nrg sub sgn 0 floor*.refeye *.myeye sub sgn abs add -- abs -- abs39 *.eye5 sub sgn 0 floor add add -- abs -- abs`
(Does this even come up?  )

Step 3: Applying Conditions

Short and simple. Just string your conditions together, then multiply the target value by it:

Code: [Select]
`2000 *.nrg sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor mult`

The part you really wanted to get to! I honestly can't remember too much about this, so I'll give you the tools to string the bots together and leave it to someone else to write up some clues on writing good SS bots.

Code: [Select]
`condstart'Values here'Locations herestorestop`
This is your skeleton for every Single Store bot. For every potential store command, you'll need two corresponding blocks: one in the Values and one in the Locations. Same as any other bot really. I'll do a quick walkthrough of my first SS Bot, Dominis:

Code: [Select]
`condstart'Values-6*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult'Locations.shoot*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs multstorestop`
Stores -6 into .shoot if:
• *.eye5 40 <
• *.refeye *.myeye !=

The way it works is that -6 and .shoot get pushed onto the stack and read by the store command if the conditions are true. Otherwise, 0 and 0 get pushed. The 0/0 is important, you'll see why next:

Code: [Select]
`condstart'Values-6*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult52000 *.nrg sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor multadd'Locations.shoot*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult.up2000 *.nrg sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor multaddstorestop`
Same as before, but with 5 .up on the following conditions:
• *.eye5 40 >=
• *.refeye *.myeye !=
• *.nrg 2000 <

Note that due to the first condition, the two condition pairs are mutually exclusive and only (at most) one will return a non-zero value/location pair. This is what makes SS bots work - only one "gene" at a time must return a non-zero value; that way, when you add all the values up and add all the locations up, you get a sensible value pair. If more than one pair returns a non-zero value, then you get some jibberish (or worse yet, you don't) and waste the store command.

Code: [Select]
`condstart'Values-6*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult52000 *.nrg sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor multadd50*.nrg 2000 sub sgn 0 floor mult39 *.eye5 sub sgn 0 floor multadd314 rnd*.refeye *.myeye sub sgn abs -- abs multadd'Locations.shoot*.eye5 40 sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult.up2000 *.nrg sub sgn 0 floor mult*.refeye *.myeye sub sgn abs mult39 *.eye5 sub sgn 0 floor multadd.repro*.nrg 2000 sub sgn 0 floor mult39 *.eye5 sub sgn 0 floor multadd.aimdx*.refeye *.myeye sub sgn abs -- abs multaddstorestop`
A turning and reproduction pair (I'll let you figure out the conditions), and we're done!

The only hint I can give regarding the design of your bot is to remember that you only have one store a cycle, so prioritize. Design your conditions in such a way that the most important functions take precedence. You don't want to starve to death because you're executing .up instead of .shoot if there's something in your sight.

Hope that helps!

2
##### The Gene depository / Re: Oculus III
« on: August 22, 2011, 04:47:30 PM »
Bleh, I managed to lock myself out of my account. Back now!

I'm glad to see Oculus is still in use after all these years, and even better, improved. Now I have to figure out a way to get DB running again

3
##### Off Topic / Re: age
« on: March 15, 2011, 05:20:14 AM »
Some thing I've always wondered, actually. I'm seventeen.

4
##### Darwinbots Program Source Code / Re: Re-writing DB in JAVA
« on: January 06, 2011, 09:56:56 PM »
I suppose not, but I'm more comfortable in Java and looking at a whole pile of code in a foreign language made me feel a little overwhelmed. Plus I'm too lazy to download a C# dev kit for mac

5
##### Darwinbots Program Source Code / Re: Re-writing DB in JAVA
« on: January 06, 2011, 07:51:13 PM »
More or less what I was thinking - copying the features of DBII, creating a framework and them building everything from scratch...in fact, I thought that was what you meant in the first place...

6
##### Darwinbots Program Source Code / Re: Re-writing DB in JAVA
« on: January 06, 2011, 03:56:54 PM »
Well, it looks like DB3 is nearing completion (The last post I see in the forum was in November when Nums was messing around with graphics); I'm willing to wait a few months before a new project is started. In the meantime, I'll just quietly stalk the forum...as always...

7
##### Darwinbots Program Source Code / Re: Re-writing DB in JAVA
« on: January 06, 2011, 01:27:00 PM »
This has actually been something on my mind for a long time (Mainly because Java is my native language); I'm not too great at programming UI and I/O stuff, but would be glad to lend a hand at anything else.

8
##### Bot Tavern / Re: Plausible tactic?
« on: November 11, 2010, 11:08:18 PM »
That shouldn't be an issue...you can redefine the width and orientation of the eyes using .eyeXwidth and .eyeXdir .

9
##### DNA - General / Re: Hi I'm new =)
« on: October 13, 2010, 02:29:14 PM »
Hi and welcome to the community

10
##### Interesting behaviour bots / Re: my bot. pls give it a name
« on: October 08, 2010, 05:03:47 AM »
Heh, I have a lot of friends down South - most of them complained because facebook stopped working

It probably wasn't heard of much around the world, there was a magnitude 7.1 earthquake in New Zealand. No casualties though...did you guys get much damage?

11
##### Darwinbots3 / Re: Chromosomes and Sexual Rproduction
« on: September 13, 2010, 06:08:13 PM »
Yup; remember that in RL, plasmids reproduce independently of the cell itself.

12
##### Suggestions / Re: Bots to include with a new installer
« on: August 31, 2010, 01:10:09 AM »
You probably want something like Animal Multi in there, although something more sophisticated would be nice. I'm also thinking a more advanced veggie.

13
##### Darwinbots3 / Re: Chromosomes and Sexual Rproduction
« on: August 20, 2010, 01:04:54 AM »
The main reason to treat chromosomes differently to plasmids is that they are the only determinants in sexual repoduction. Plasmids do not define a species - they just float in the cell, acting completely independently of the chromosomes. This also means that infected cells don't suddenly have huge reproduction complications - viral plasmids simply replicate their own DNA (a virus doesn't copy huge chunks of random DNA, just itself) without messing up the reproduction system. It also means you don't have to trim DNA to pressure downwards - you can just can, say, half the plasmids from each parent or something like that, which would provide serious issues with chromosomes.

14
##### Off Topic / Re: Starcraft 2
« on: August 19, 2010, 02:30:26 AM »
Ah, the Zergling/Zealot/random tiny creature rush. Dead in 12 seconds flat. Starcraft 2 like that as well?
I know somebody who apparently has a cracked version with a few bugs-he'll pass it over once the glitches are sorted.

15
##### Darwinbots3 / Re: Chromosomes and Sexual Rproduction
« on: August 19, 2010, 02:13:02 AM »
Quote
@bac:
If viruses are chromosomes, you don't need cond, start, stop, etc. to define them anyway.  Virus production just becomes "duplicate this chromosome".  So if you've defined a nice way in which conflicting chromosomes interact (eg: average their store values or something) then this part of it at least becomes quite manageable.  You also don't have to worry about trying to balance how DNA gets injected in to existing DNA strands (eg: inside the middle of a gene is usually doubly damaging).

Ah, but viruses are not chromosomes - in this model, viruses would instead be plasmids, floaty chunks of DNA separate from the main body of DNA eg. chromosomes. I suppose you could also insert them into the chromosomes, but then you have to define the gene within the chromosome, which otherwise would not be necessary; this way also gives some limited degree of DB2 code.

In summary, I think I'm somehow missing your point...

Pages: [1] 2 3 ... 60