UserPreferences

SimpleBrain2Program


You are not allowed to edit this page. Are you logged in? Click on UserPreferences in upper-righthand corner.

Clear message

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
# A simple brain with a setup method

from pyrobot.brain import Brain

# Define the robot's brain class

class SimpleBrain2(Brain):
   # The setup method can be used to do initializations
   def setup(self):
      self.moveAmount = 0.3

   # The step method is the main behavior loop
   def step(self):
      self.robot.translate(self.moveAmount)     # go forward

# Create a brain for the robot

def INIT(engine):
   return SimpleBrain2('SimpleBrain2', engine)