### Author Topic: Bot testbed  (Read 7237 times)

• Bot Destroyer
• Posts: 387
##### Re: Bot testbed
« Reply #30 on: April 09, 2017, 12:53:26 PM »
Ok well what should i look for when it crashes so i don't post repeats?

#### Numsgil

• Bot God
• Posts: 7717
##### Re: Bot testbed
« Reply #31 on: April 09, 2017, 02:08:32 PM »
I meant because I'm fixing all the crashes you're posting, you end up finding novel ways to break things each time.  Definitely post all your crashes.

#### spike43884

• Bot Overlord
• Posts: 656
##### Re: Bot testbed
« Reply #32 on: April 09, 2017, 04:46:30 PM »
i have me a crude swimmer finally..

Ah, it's pretty sweet   I haven't started with fluid stuff yet (fixing all the crashes you've been finding), but soon.

Quote from: spike43884
Do 9900 perhaps as it's a multiple of 180 (which is half of 360) -> 55*180 = 9999

Problem is you can't represent 45 degrees if 360->9900 (since 9900 doesn't divide evenly in to 8 parts), and that's a fairly important angle.

Quote
Also, I can't imagine you using 9999 memory locations (though, I may be wrong) so if you then made it so memory locations greater than 9900 (those which can't standardly be selected by cos/sin) as custom memory locations, for people to store their own data in (including epigenetic locations?) - 99 in most cases should be enough.

At the moment there are only 999 memory locations.  I'll probably expand that to 9999 at some point, but point is don't confuse how many memory slots there are (999) with what values they can store ([-9999, 9999]).

At some point I'll reserve a large contiguous memory block for user use.  At the moment I'm not sure how many sysvars I'll need for normal bot stuff yet, so I don't want to jump on to segmenting up the memory just yet.

Ahh k.
I just think trying to achieve a slightly nicer number to mark the end of sin/cos range might be better, so that people can memorise the division quicker to make coding bots a bit easier.

I can't imagine you needing even 999 memory slots, although expanding early on might be best just to ensure you don't run out, and so it doesn't end up with dedicated free slots sandwiched inbetween slots defined to a sysvar.

Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.

• Bot Destroyer
• Posts: 387
##### Re: Bot testbed
« Reply #33 on: April 09, 2017, 06:58:47 PM »
actually i can see you needing more for some advanced complex bots, especially when you get into some multibots.

ok this bug i know where its coming from, its when i close the lid of my computer with the program still running:
Code: [Select]
`RootLevelException = {    Description = "SharpDX.SharpDXException",    Message = "Unknown error (HRESULT = 0x88760868)",    Source = "System.Windows.Forms.ControlMarshaledInvoke",    Stack Trace = {        File = "\Modules\Darwinbots3\Bot.Testbed\Main.cs:140:17",        File = "\Modules\Darwinbots3\Bot.Testbed\Renderer.cs:109:13",        File = "\Modules\Darwinbots3\Bot.Testbed\Renderer.cs:149:17",    },    Data = {        radiiOut = {            0 = "0.031980198 //0x3FA05FB5613AB3DC",            1 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            2 = "0.0159945995 //0x3F9060E3665F5248",            3 = "0.0179927993 //0x3F926CB451E214F6",            4 = "0.0219891989 //0x3F96845628E79A52",            5 = "0.0289828983 //0x3F9DADB1613143B4",            6 = "0.0269846985 //0x3F9BA1E075AE8104",            7 = "0.0229882988 //0x3F978A3E9EA8FBA9",            8 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            9 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            10 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            11 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            12 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            13 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            14 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            15 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            16 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            17 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            18 = "0.0159945995 //0x3F9060E3665F5248",            19 = "0.0179927993 //0x3F926CB451E214F6",            20 = "0.0219891989 //0x3F96845628E79A52",            21 = "0.0289828983 //0x3F9DADB1613143B4",            22 = "0.0269846985 //0x3F9BA1E075AE8104",            23 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            24 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            25 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            26 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            27 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            28 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            29 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            30 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            31 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            32 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            33 = "0.0159945995 //0x3F9060E3665F5248",            34 = "0.0179927993 //0x3F926CB451E214F6",            35 = "0.0219891989 //0x3F96845628E79A52",            36 = "0.0289828983 //0x3F9DADB1613143B4",            37 = "0.0269846985 //0x3F9BA1E075AE8104",            38 = "0.0229882988 //0x3F978A3E9EA8FBA9",            39 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            40 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            41 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            42 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            43 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            44 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            45 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            46 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            47 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            48 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            49 = "0.0159945995 //0x3F9060E3665F5248",            50 = "0.0179927993 //0x3F926CB451E214F6",            51 = "0.0219891989 //0x3F96845628E79A52",            52 = "0.0289828983 //0x3F9DADB1613143B4",            53 = "0.0269846985 //0x3F9BA1E075AE8104",            54 = "0.0229882988 //0x3F978A3E9EA8FBA9",            55 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            56 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            57 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            58 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            59 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            60 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            61 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            62 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            63 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            64 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            65 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            66 = "0.0229882988 //0x3F978A3E9EA8FBA9",            67 = "0.0269846985 //0x3F9BA1E075AE8104",            68 = "0.0289828983 //0x3F9DADB1613143B4",            69 = "0.0219891989 //0x3F96845628E79A52",            70 = "0.0179927993 //0x3F926CB451E214F6",            71 = "0.0159945995 //0x3F9060E3665F5248",            72 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            73 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            74 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            75 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            76 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            77 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            78 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            79 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            80 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            81 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            82 = "0.0229882988 //0x3F978A3E9EA8FBA9",            83 = "0.0269846985 //0x3F9BA1E075AE8104",            84 = "0.0289828983 //0x3F9DADB1613143B4",            85 = "0.0219891989 //0x3F96845628E79A52",            86 = "0.0179927993 //0x3F926CB451E214F6",            87 = "0.0159945995 //0x3F9060E3665F5248",            88 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            89 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            90 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            91 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            92 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            93 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            94 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            95 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            96 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            97 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            98 = "0.0269846985 //0x3F9BA1E075AE8104",            99 = "0.0289828983 //0x3F9DADB1613143B4",            100 = "0.0219891989 //0x3F96845628E79A52",            101 = "0.0179927993 //0x3F926CB451E214F6",            102 = "0.0159945995 //0x3F9060E3665F5248",            103 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            104 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            105 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            106 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            107 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            108 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            109 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            110 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            111 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            112 = "0.0149954995 //0x3F8EB5F5E13BE1E1",            113 = "0.0229882988 //0x3F978A3E9EA8FBA9",            114 = "0.0269846985 //0x3F9BA1E075AE8104",            115 = "0.0289828983 //0x3F9DADB1613143B4",            116 = "0.0219891989 //0x3F96845628E79A52",            117 = "0.0179927993 //0x3F926CB451E214F6",            118 = "0.0159945995 //0x3F9060E3665F5248",            119 = "0.0149954995 //0x3F8EB5F5E13BE1E1",        },    },}`

#### spike43884

• Bot Overlord
• Posts: 656
##### Re: Bot testbed
« Reply #34 on: April 10, 2017, 04:25:40 AM »
I decided to pull out desmos just to try a few sine graphs.

Equation 1 satisfies full wavelengths for 999 and 9990.
Equation 2 satisfies fitting a number of half wavelengths for 999 and 9999.
Equation 3 satisfies fitting a full number of wavelengths for 9999.
Equation 4 satisfies fitting a full number of wavelengths for 999 and 9999.

In this case 1 wavelength = 999. For that type of equation within a sine function the wavelength = the denominator
Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.

#### Numsgil

• Bot God
• Posts: 7717
##### Re: Bot testbed
« Reply #35 on: April 10, 2017, 10:32:29 AM »
How about one full circle = 9000 units.  That's 360 degrees * 25, which gives prime factors of 2^3, 3^2, 5^3.  And it's relatively easy to remember.  By comparison, 9720 gives prime factors of 2^3, 3^5, 5.

Another option is 8640, which is 360 * 24, which has prime factors 2^6, 3^3, 5.  Not as easy to remember as 9000, but lets you split the full circle in to 64 equal slices instead of just 8, at the cost of not being able to slice things in to as many 5ths.

Yet another option is 9600.  That's not a multiple of 360 degrees, but it does have a lot of nice dividers.  Its prime factors are 2^7, 3, 5^2.
« Last Edit: April 10, 2017, 10:36:40 AM by Numsgil »

• Bot Destroyer
• Posts: 387
##### Re: Bot testbed
« Reply #36 on: April 10, 2017, 05:28:53 PM »
Speaking of sin and cos how exactly do they work? Also im not really ginding any more bugs... at least not yet

#### Numsgil

• Bot God
• Posts: 7717
##### Re: Bot testbed
« Reply #37 on: April 10, 2017, 05:47:23 PM »
They take units in whatever forms a full circle (as of this moment, that'd be 1080), and convert them in to degrees (so in this case, divide the values by 3), then run sin/cos on them.  Normally the results of sin and cos are in the range [-1, 1], but they get scaled so it's easier to make use of them, up to [-1080, 1080].

So for example, 90 degrees would be 360 units in Sunweaver.  Sine of 90 degrees is 1.0, so 360 sin would return 1080.

#### spike43884

• Bot Overlord
• Posts: 656
##### Re: Bot testbed
« Reply #38 on: April 11, 2017, 08:53:22 AM »
How about one full circle = 9000 units.  That's 360 degrees * 25, which gives prime factors of 2^3, 3^2, 5^3.  And it's relatively easy to remember.  By comparison, 9720 gives prime factors of 2^3, 3^5, 5.

Another option is 8640, which is 360 * 24, which has prime factors 2^6, 3^3, 5.  Not as easy to remember as 9000, but lets you split the full circle in to 64 equal slices instead of just 8, at the cost of not being able to slice things in to as many 5ths.

Yet another option is 9600.  That's not a multiple of 360 degrees, but it does have a lot of nice dividers.  Its prime factors are 2^7, 3, 5^2.

Where'd 9600 come from?
Anyway, 9000 seems a pretty nice value.

If you want to get close to 9999 then the following options:
9360 is 360*26 giving 2^4,3^2, 5 and 13.
9720 as you mentioned is 360*27 giving 2^3, 3^5 and 5 however is a bit of a weirder one for remembering.
9900 is 55*180 giving 2^2,3^2, 5^2 and 11. (quite a nice pattern of squares there...)
9990 is 111*90 giving 2, 3^3 , 5 and 37.

I don't think there is really many other sensible alternatives as multiples of 45,90,180 or 360
Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.

#### Numsgil

• Bot God
• Posts: 7717
##### Re: Bot testbed
« Reply #39 on: April 12, 2017, 08:03:16 AM »
Where'd 9600 come from?
Anyway, 9000 seems a pretty nice value.

Okay, I might just go with 9000, even though I think 9600 is better in a lot of ways, since 9000 is both a round number and evenly divided by 360, which should make math easier for humans.

In terms of where they come from: the prime factors help to determine how many different ways you can divide up the full circle evenly.  3, 4, and 6 are important, since triangles, squares, and hexagons form a full tesselation of the plane, and are the only regular shapes to do so, so you need some multiple of 12 at least (the lowest common multiple of 3, 4, and 6).

If you ever wondered why there's 360 degrees in a circle, it's because it's the closest round number to 365 in base 60 (which was the base the Sumerians used thousands of years ago).  Their number system was base 60 because it makes math easy: 60 divides cleanly in to all sorts of different divisors.  For Darwinbots, we have a similar requirement.  The more ways there are to divide the circle in to even parts, the more different symmetries are possible, or at least easy.  The prime factors show you the raw ingredients to combine to divide the circle up.

2 is an important prime factor, because splitting things in to halves, or quarters, or sixteenths, etc. are very natural ways to break things apart, and can easily mimic the way cells in biology cleave in half during reproduction.  3 is important, but multiple copies of 3 aren't so much: being able to split things in to thirds and being able to represent 30, 45, and 60 degrees is important, but being able to represent 40 degrees or divide things in to 9ths isn't very important.

Sunweaver is sort of built to be base 10, to make math easy for humans, so 5 is an important factor in so far as 10 is.

But 7 isn't an important factor.  It would let you split circles in to 7ths, but there probably isn't much call for that.    As the prime factors get larger, they become less useful.  About the only use 101 would be for is if the bot had 101 segments.  Otherwise there's not much call for splitting a circle evenly in to 101 pieces.

So generally speaking finding a good number is balancing the needs for 2, 3, and 5 as prime factors, taking up as much of the [0,9999] range as possible, and making it easy for humans to do the math.

#### spike43884

• Bot Overlord
• Posts: 656
##### Re: Bot testbed
« Reply #40 on: April 13, 2017, 04:45:09 AM »
Where'd 9600 come from?
Anyway, 9000 seems a pretty nice value.

Okay, I might just go with 9000, even though I think 9600 is better in a lot of ways, since 9000 is both a round number and evenly divided by 360, which should make math easier for humans.

In terms of where they come from: the prime factors help to determine how many different ways you can divide up the full circle evenly.  3, 4, and 6 are important, since triangles, squares, and hexagons form a full tesselation of the plane, and are the only regular shapes to do so, so you need some multiple of 12 at least (the lowest common multiple of 3, 4, and 6).

If you ever wondered why there's 360 degrees in a circle, it's because it's the closest round number to 365 in base 60 (which was the base the Sumerians used thousands of years ago).  Their number system was base 60 because it makes math easy: 60 divides cleanly in to all sorts of different divisors.  For Darwinbots, we have a similar requirement.  The more ways there are to divide the circle in to even parts, the more different symmetries are possible, or at least easy.  The prime factors show you the raw ingredients to combine to divide the circle up.

2 is an important prime factor, because splitting things in to halves, or quarters, or sixteenths, etc. are very natural ways to break things apart, and can easily mimic the way cells in biology cleave in half during reproduction.  3 is important, but multiple copies of 3 aren't so much: being able to split things in to thirds and being able to represent 30, 45, and 60 degrees is important, but being able to represent 40 degrees or divide things in to 9ths isn't very important.

Sunweaver is sort of built to be base 10, to make math easy for humans, so 5 is an important factor in so far as 10 is.

But 7 isn't an important factor.  It would let you split circles in to 7ths, but there probably isn't much call for that.    As the prime factors get larger, they become less useful.  About the only use 101 would be for is if the bot had 101 segments.  Otherwise there's not much call for splitting a circle evenly in to 101 pieces.

So generally speaking finding a good number is balancing the needs for 2, 3, and 5 as prime factors, taking up as much of the [0,9999] range as possible, and making it easy for humans to do the math.

I knew about prime factors, I just meant the number 9600 as an option in and of itself. It didn't divide cleanly at all into 360 so even as an option for better primes seemed a bit unusual.

I suspect actually having 7 could be a useful prime. Less useful then 2, 3 and 5, however there's still a reasonable chance a bot could have 7 segments, 11 and 13 and 17 being reasonably useful as it's not unimaginable for a bot to have that many segments, and in the case of multi-bots. As you get larger primes less numbers use them, however these are just the first few primes so will crop up regularly.
Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.

#### Billy

• Bot Destroyer
• Posts: 175
##### Re: Bot testbed
« Reply #41 on: April 27, 2017, 09:44:36 AM »
Nice work, Nums! Took you long enough

Here's a quick 'swimmer' I threw together:

Code: [Select]
`const myage 360{ *myage 1 add myage store } call//{ 0 myage store } call*numspindles { dup *numspindles 2 div sub abs     *myage *numspindles 2 div mod sub abs 30 mul 100 swap sub 1000 add   swap store } loop`
Sometimes it bugs out and you have to uncomment the line and recomment it to make it work.
"I cannot persuade myself that a beneficent and omnipotent God would have designedly created parasitic wasps with the express intention of their feeding within the living bodies of Caterpillars."

-Charles Darwin

#### Numsgil

• Bot God
• Posts: 7717
##### Re: Bot testbed
« Reply #42 on: April 27, 2017, 05:29:36 PM »
Looks good but I think shadowgod still has you beat

If you can figure out under which circumstances it bugs out that would be good.  It's possible it's a bug in the program that I should fix.

#### Billy

• Bot Destroyer
• Posts: 175
##### Re: Bot testbed
« Reply #43 on: April 27, 2017, 06:56:20 PM »
Mine is more concise though!

I think it was when I was fiddling with the number on the last line that is now 30, I can't seem to reproduce it now unfortunately.
"I cannot persuade myself that a beneficent and omnipotent God would have designedly created parasitic wasps with the express intention of their feeding within the living bodies of Caterpillars."

-Charles Darwin

#### Botsareus

• Society makes it all backwards - there is a good reason for that
• Bot God
• Posts: 4483
##### Re: Bot testbed
« Reply #44 on: April 28, 2017, 05:50:19 AM »
I like the idea of using multiples for memory range, basing it from days in year aka about 360 is not a bad idea. However, we need to consider what other values stuff will return and incorporate the prime numbers from these into it. That is why I prefer to go with large ranges with stuff like this. In my experiments I always go with longs actually even though I do not need them.