Code center > Darwinbots3
Command Shortcutting
Peter:
In machine language you would repeat yourself quite often, often more efficient to duplicate a method than referencing it with a pointer. It's all about not having to do those steps yourself. Read the link about DRY again.
Panda:
--- Quote from: Peter on April 06, 2015, 04:16:58 PM ---In machine language you would repeat yourself quite often, often more efficient to duplicate a method than referencing it with a pointer. It's all about not having to do those steps yourself. Read the link about DRY again.
--- End quote ---
Who is this aimed towards?
Peter:
Sorry, aimed at spike.
spike43884:
I know it takes extra typing, but only one set of alternatives won't be that hard. Anyway, im not sure how your currently linking commands to memory address's but in a .txt file you could fit in alternatives dead easy, along with standard commands then just reference a line on the txt file.
Command,Alternative Command
Command,Alternative Command
each line just responding to the memory address of the same number...you could even do
Address,Command,Alternative Command
Address,Command,Alternative Command
to make it easier to remember. So writing the actual code shouldn't be much harder, especially with only 1 set of alternatives.
My point about color and colour is very relevant actually, its naturally built in. To people who have mastered DB as a language, then things like .dx and .aimdx and .sx and .aimsx are built in, you could recall it off the top. But for example, I haven't a clue which way .dx turns and which way .sx turns, Im just able to comprehend that they turn. sx and dx make no relevance to what I already know, or what most people already know. But lets give an example, in the format of that .txt list of commands I was talking about, (without using address in the actual file yet):
.dx,.left
.sx,.right
Now if your still really concerned about it taking longer to write, just send me a link to the current DB3 commands and just a quick link to the definitions of them and I'd personally write it.
Before you start moaning over its harder to read, it can be harder to read if we chose ridiculous ones, yes...But it can also be much easier to read, and lets use the .dx .left example here, Now normally you'd have a paragraph blabbering on about the function of .dx and you could keep that in for further referencing, but you could also have at the top of the page ".dx does the same as .left" which I'd more likely remember than a whole paragraph.
Then I'll give a quick simple example with animal_minimalis using current code, and just some off the top of my head alternatives:
Standard Commands:
--- Code: ---'Animal_Minimalis
'By Nums
'Good For newbies to base bots off or learn DNA from
'Gene 1 Find Food
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
'Gene 2 Eat Food
cond
*.eye5 50 >
*.refeye *.myeye !=
start
-1 .shoot store
*.refvelup .up store
stop
'Gene 3 Avoid Family
cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop
'Gene 4 Reproduce
cond
*.nrg 20000 >
start
10 .repro store
stop
end
--- End code ---
Alternative Commands:
--- Code: ---'Animal_Minimalis
'By Nums
'Good For newbies to base bots off or learn DNA from
'Gene 1 Find Food
condition
*.eyemiddle 0 >
*.enemyeye *.myeye !=
startcode
*.enemyvelocityleft .left store
*.enemyvelocityforward 30 sum .forward store
stopcode
'Gene 2 Eat Food
condition
*.eyemiddle 50 >
*.enemyeye *.myeye !=
startcode
-1 .attack store
*.enemyvelocityforward .forward store
stopcode
'Gene 3 Avoid Family
condition
*.eyemiddle 0 =
*.enemyeye *.myeye = either
startcode
314 random .left store
stopcode
'Gene 4 Reproduce
condition
*.energy 20000 >
startcode
10 .reproduce store
stopcode
enddna
--- End code ---
Most of those alternatives are longer, but reading it...Most of them make quite a bit of sense don't they. The commands are much closer to english... Yet someone new to DB wouldn't have a clue what "NRG" was, is it some sort of sound the bots make?? But oh yeah, "energy" that stuff, I know that! and when they see that "NRG" is the same as "ENERGY" they don't need to read an entire paragraph do they? Now I might not use all of these personally, but .left i'd certainly use, expanding rnd to random I'd use...ABS you could call REDUCE because it reduces it to one of 3 values. Try to put yourself in the shoes of 'imbecile' thats never touched DB before. I know for certain when I started, the first 4 weeks or so that when I first glanced at the language it was so weirdly done, with weird names for simple things that I just stuck to putting random bots in evolution sims (Sidenote: can you bring back ebola to DB2 please, its amazing for evolution sims)
Panda:
--- Quote ---I know it takes extra typing, but only one set of alternatives won't be that hard.
--- End quote ---
--- Quote ---Now if your still really concerned about it taking longer to write, just send me a link to the current DB3 commands and just a quick link to the definitions of them and I'd personally write it.
--- End quote ---
These both require future maintenance and can increase the number of locations in the code that errors can appear. If you decide that once you've put them in that you're no longer going to maintain them, it's up to somebody else to do it. What difference is there for you by doing this compared to
--- Quote ---I know it takes extra typing, but only one set of alternatives won't be that hard.
--- End quote ---
--- Quote ---.attack
--- End quote ---
Well, rather than the original shoot, I want shot instead but Numsgil wants strike. Which ones do we include?
--- Quote ---Try to put yourself in the shoes of 'imbecile' thats never touched DB before. I know for certain when I started, the first 4 weeks or so that when I first glanced at the language it was so weirdly done, with weird names for simple things that I just stuck to putting random bots in evolution sims
--- End quote ---
By adding more variable names, new DBers are going to be further confused. There can be two bots written in 2 different ways that does the exactly same thing (especially in terms of stack manipulation, etc.), it doesn't make it easier for them at all.
Your concerns are not irrelevant or invalid; the variable names can be very obscure at times and I guess this will be something considered in DB3. Since it's completely separate to DB2, no variable names are required to be carried over from DB2. In the end, the
Despite this, a design decision has been made and it's not going to change. One of the biggest problems with DB2, in my opinion, was the amalgamation of different design decisions without communication between the start and the end. The concepts of DRY are being used despite your disagreements and it's clear that a large proportion of this community (currently 3 against 1 in this thread) agrees with this decision.
I'm going to put two points that will hopefully end this argument: it really is Numsgil's decision and we can only offer our opinions and discussions towards features (since he has been the developer for how many years); the feature you have requested is within DB3 (somewhat) and you have to compromise somewhere.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version