nosebot module
import direction class Nosebot(object): ''' NOTE! IMPLEMENT THE METHODS DEFINED HERE! The class Nosebot represents the "brains" (or AI) of robots that move where their nose is pointing, in straight lines, turning right when they are forced to. See the documentation of RobotWorld ''' def __init__(self, body): ''' NOTE! IMPLEMENT THIS. Creates a new nosebot brain for the given robot body. Parameter body is the robot whose actions the nosebot brain is supposed to control: Robot ''' pass def move_body(self): ''' NOTE! IMPLEMENT THIS. Moves the given "body", i.e., the robot given as a parameter. A nosebot first looks at the next square in the direction of its nose. If that square is empty, it moves there and ends its turn. If the square was not empty, it turns its nose 90 degrees clockwise and tries again, moving if possible, etc. If the robot makes a full 360 turnabout without finding a suitable square to move in, it ends its turn without moving. As a nosebot always looks where it's going, so it can never collide with anything during its own turn. This method assumes that it is called only if the robot is not broken or stuck. ''' pass
Classes
class Nosebot
NOTE! IMPLEMENT THE METHODS DEFINED HERE!
The class Nosebot represents the "brains" (or AI) of robots that move where their nose is pointing, in straight lines, turning right when they are forced to.
See the documentation of RobotWorld
class Nosebot(object): ''' NOTE! IMPLEMENT THE METHODS DEFINED HERE! The class Nosebot represents the "brains" (or AI) of robots that move where their nose is pointing, in straight lines, turning right when they are forced to. See the documentation of RobotWorld ''' def __init__(self, body): ''' NOTE! IMPLEMENT THIS. Creates a new nosebot brain for the given robot body. Parameter body is the robot whose actions the nosebot brain is supposed to control: Robot ''' pass def move_body(self): ''' NOTE! IMPLEMENT THIS. Moves the given "body", i.e., the robot given as a parameter. A nosebot first looks at the next square in the direction of its nose. If that square is empty, it moves there and ends its turn. If the square was not empty, it turns its nose 90 degrees clockwise and tries again, moving if possible, etc. If the robot makes a full 360 turnabout without finding a suitable square to move in, it ends its turn without moving. As a nosebot always looks where it's going, so it can never collide with anything during its own turn. This method assumes that it is called only if the robot is not broken or stuck. ''' pass
Ancestors (in MRO)
- Nosebot
- __builtin__.object
Methods
def __init__(
self, body)
NOTE! IMPLEMENT THIS.
Creates a new nosebot brain for the given robot body.
Parameter body is the robot whose actions the nosebot brain is supposed to control: Robot
def __init__(self, body): ''' NOTE! IMPLEMENT THIS. Creates a new nosebot brain for the given robot body. Parameter body is the robot whose actions the nosebot brain is supposed to control: Robot ''' pass
def move_body(
self)
NOTE! IMPLEMENT THIS.
Moves the given "body", i.e., the robot given as a parameter. A nosebot first looks at the next square in the direction of its nose. If that square is empty, it moves there and ends its turn. If the square was not empty, it turns its nose 90 degrees clockwise and tries again, moving if possible, etc. If the robot makes a full 360 turnabout without finding a suitable square to move in, it ends its turn without moving. As a nosebot always looks where it's going, so it can never collide with anything during its own turn.
This method assumes that it is called only if the robot is not broken or stuck.
def move_body(self): ''' NOTE! IMPLEMENT THIS. Moves the given "body", i.e., the robot given as a parameter. A nosebot first looks at the next square in the direction of its nose. If that square is empty, it moves there and ends its turn. If the square was not empty, it turns its nose 90 degrees clockwise and tries again, moving if possible, etc. If the robot makes a full 360 turnabout without finding a suitable square to move in, it ends its turn without moving. As a nosebot always looks where it's going, so it can never collide with anything during its own turn. This method assumes that it is called only if the robot is not broken or stuck. ''' pass