Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: ikke on December 09, 2009, 02:55:11 AM

Title: variable storage & retrieval
Post by: ikke on December 09, 2009, 02:55:11 AM
Currently DB2 has makes a distinction between variable assignment and retrieval:
reading a variable is one command (.variable)
storing a variable is two commands. (.variable store)
Retrieval is implicit, storage explicit. What is the reason for this? For consistency one would expect .variable store and .variable read (both explicit, 2 BP) or .variable and something like >variable. (both implicit, 1 BP). As it is now it is easier for a bot to evolve variable retrieval than to evolve variable storage. I expect evolution sims to be faster (and or more interesting) if both are implicit. How is this giong to be done in DB3?
Title: variable storage & retrieval
Post by: Numsgil on December 09, 2009, 02:24:05 PM
It's actually *.variable vs. .variable store.  .variable just means to look up the (custom or predefined) sysvar named variable and turn it in to a number.  But you're right it's a little inconsistant.

DB3 DNA is smarter about knowing that "variable" means a certain number.  So storing becomes either 10 .variable or 10 variable store, and dereferencing becomes *variable or variable ref.  So there's symmetry between storing and loading and the number of bp required.  Check out THis old topic (http://www.darwinbots.com/Forum/index.php?showtopic=2207).  It has an attached command line DNA interpreter you can use to play with the language.