FANDOM


Understanding Grobots Scripting

I am just starting out with Grobots and have been looking to fully understand how to build a robot. The first step was to look and Reverse Polish notation, stack diagram programming and the Forth language.

Questions:

  • How do I start creating a bot?
The first thing you would want to do is pick (if you dont have one already) a favorite editor and create a new file with the .gb extension.
  • What is the meaning and structure of the code that makes up a bot?
Your first lines of code should be your name, date of creating, and a short description, wheather it be the list of types in that side or just some notes. These lines should be comments, which are preceded by a semicolin ( ; ).
Next, you will declare your side name and color for that side. The color format is RGB or RRGGBB. The side name is the name of the class of robots. 
# side MySide 

# color FF00FF
Then create a list of types, declaring thier names, in that side. Each Type is a type of robot under this class. To specify the order in shich the bots should reproduce add a seed line.
Type 1: Marvin

​Type 2: Python
  • The processor speed determines how many processes a bot can handle within one frame  of the game. This hardware specifier takes one parameter.
  • The engine speed determines the speed at which the robot can move. This hardware specifier takes one parameter.
  • The constructor speed determines the speed at which the robot can transform its energy into a bot. This hardware specifier takes one parameter.
  • The eater speed determines the speed at which the robot can transform manna (food) to energy. This hardware specifier takes one parameter.
  • The energy specifier determines the amount of energy the bot can hold. This hardware specifier takes two parameters, the total amount of possible energy and the initial amount.
  • The food-sensor, for example, determines the number of units at which it can "sense" manna (I like to think of it as "see" manna). This hardware specifier takes one parameter.
The hardware section of the code specifys the the bots processor, engine, constructor, eater, energy, sensors (different for each bot type), armor, and others.
  • What belongs after the code tag (for lack of a better term)?
In the current bot that I am building I gave him the properties to reproduce, find manna, eat the manna, and  if no manna is found, stop the robot from moving. These properties were all put in a do forever loop.

do

     autoconstruct

     44 periodic-food-sensor drop

     food-found if

          food-position seek-location

     else

          0 engine-power!

     then

forever


The autoconstruct tells the robot to start constructing the next bot in the seeding order, if there is a sufficiant amount of energy.
The third line puts 44 in the energy stack and the periodic-food-sensor puts a boolean on the stack, whether the boolean is true or false depends on if the food-sensor was active in that frame.
The if block is exicuted if manna is found. If manna is found then it finds the location of the manna ( food-position ) and sets the bot to go towards that location ( seek-location ).
If no manna is in range, 0 is assigned to engine-power! causing the bot to not move. The exclamation mark at the end of engine-power tells the computer that engine-power is a writable variable, thus allowing it to set its speed to 0.
  • What are the formulas for the mass and cost of the bots elements?
  • How to improve bot performance, efficiantly and lessen bot cost?

Sources

http://grobots.sourceforge.net/docs/language.html

http://grobots.sourceforge.net/docs/tutorial.html

http://grobots.sourceforge.net/docs

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.