Welcome To Darwinbots > Newbie
Where are the free sysvars?
fulizer:
--- Quote from: EricL ---The majority of bot memory isn't used by the system. There are only 227 sysvars (version 2.43.1e) - actually I think its more like 224 as there are a few duplicate names that map to the same location. The list is below, straight from the code. Add in the genetic memory locations and you still end up with fewer than 250 locations used by the system. The rest are open for private use.
I gaurentee locations 50-175 inclusive will not be used by the system in the future. Bot authors are encouraged (but not required) to define private sysvars in this range.
--- End quote ---
well that confused me
so where are they?
im pretty sure I didnt see any.
by the way im using 2.43 (still)
abyaly:
Every memory location that isn't used by sysvars is considered a free variable.
fulizer:
theres 1000 of them right?
so if eric l (in his infinate wisodm of all things darwinbot stoped at 820 there are 180 free vaiables?
theres 1000 of them right?
so if eric l (in his infinate wisodm of all things darwinbot stoped at 820 there are 180 free vaiables?
EricL:
--- Quote from: fulizer ---theres 1000 of them right?
--- End quote ---
There are 1000 memory locations. Understand, a sysvar is nothing more than simply a named memory location that the system uses for some purpose. So, yes, there are 1000 mem locations, about 250 of which are used by the system for one purpose or another, so the other 750 can be used as your own private variables. As above, I recommend staying within the 50-175 range so that future versiosn don't break your bots. So, if you want to define a private variable, just do the following at the top of your bot:
def private1 50
def someotherprivatename 51
.
.
.
Then use them like normal sysvars. I.e.
cond
*.private1 0 <>
start
1023 .someotherprivatename store
blah
blah
blah
Moonfisher:
You can also use def to define constant values... actualy that's all you're realy doing to begin with.
Only difference is when you name a memmory location you store something in that area (Ex : 10 .keyloc store), and fetching the value it's pointing at (So *.keyloc would be 10). If you define a constant you just call it directly (Ex : *.memval .key !=)
Basicaly the * means you want the value in this memmory location, and no star means you just want the memmory location itself.
A good example :
--- Quote ---'Memmory location of your conspec key
def keyloc 50
'Your key value
def key 1234
cond
*.robage 0 =
start
.key .keyloc store 'Save key value in memmory location 50
.keyloc .memloc store 'Set memloc to point at memmory location 50
stop
cond
*.eye5 0 >
*.memval .key != 'If the value in oponents memmory location 50 isn't our key
start
-1 .shoot store
stop
or you could use :
cond
*.eye5 0 >
*.memval *.keyloc != 'If the value in oponents memmory location 50 isn't what we have in memmory location 50
start
-1 .shoot store
stop
--- End quote ---
So without defines this would look like this :
--- Quote ---cond
*.robage 0 =
start
1234 50 store 'Save key value in memmory location 50
50 .memloc store 'Set memloc to point at memmory location 50
stop
cond
*.eye5 0 >
*.memval 1234 != 'If the value in oponents memmory location 50 isn't our key
start
-1 .shoot store
stop
or you could use :
cond
*.eye5 0 >
*.memval *50 != 'If the value in oponents memmory location 50 isn't what we have in memmory location 50
start
-1 .shoot store
stop
--- End quote ---
The reserved memmory locations are scattered, theres gaps in between them, and these may later get reserved for new system variables.
But the locations Eric is talking about will never get reserved, use those locations if you want to be sure your bot doesn't fall appart because of a new sysvar overlaping one of your variables.
Sorry if I'm explaining needless details, but you seemed confused about this so I just wrote everything there is to know.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version