o1.robots
Members list
Type members
Classlikes
The class Floor
represents squares that robots can successfully occupy and move through. On creation, a floor square is always empty, but this changes if a robot arrives.
name
: String, body
: RobotBody, val beloved
: RobotBody) extends RobotBrain
The class Lovebot
represents the “brains” of robots which have another robot as their “beloved”. A lovebot tries to home in on its beloved.
The class Lovebot
represents the “brains” of robots which have another robot as their “beloved”. A lovebot tries to home in on its beloved.
Parameters
- beloved
-
another robot that the lovebot targets
- body
-
the robot body whose actions the lovebot brain will control
- name
-
the name of the lovebot
Attributes
- Supertypes
name
: String, body
: RobotBody) extends RobotBrain
The class Nosebot
represents the “brains” of robots that move in the direction their nose points, in straight lines, only turning when they have to. They always turn right.
The class Nosebot
represents the “brains” of robots that move in the direction their nose points, in straight lines, only turning when they have to. They always turn right.
Parameters
- body
-
the robot body whose actions the nosebot brain will control
- name
-
the name of the nosebot
Attributes
- Supertypes
The class RobotBody
represents virtual robots (or “bots”) which inhabit two-dimensional grid worlds. More specifically, each instance of the class represents a “robot body” (or “chassis” or “hardware”) and basic functionality of such a robot. Each “robot body” is associated with a “robot brain” that controls the body and determines what functionality is activated and when.
The class RobotBody
represents virtual robots (or “bots”) which inhabit two-dimensional grid worlds. More specifically, each instance of the class represents a “robot body” (or “chassis” or “hardware”) and basic functionality of such a robot. Each “robot body” is associated with a “robot brain” that controls the body and determines what functionality is activated and when.
A robot is equipped with various capabilities:
-
It can sense its own surroundings (location, facing, the world that it is in).
-
It can spin around in any one of the four main compass directions.
-
It can move into the next square in a given direction.
-
It can sense whether it is broken or not, and whether it is “stuck” in a square between four walls.
When a robot’s takeTurn
method is called, it uses its “brain” to figure out what to do (move, turn about, etc.). Robots with different kinds of brains behave differently.
Parameters
- initialFacing
-
the direction the robot initially faces in
- initialLocation
-
the initial location of the robot in its world
- world
-
the world inhabited by the robot
Attributes
- See also
- Supertypes
The trait RobotBrain
represents the “brains” (or artificial “intelligence”) of virtual robots that inhabit two-dimensional grid worlds. A robot brain is equipped with an algorithm for determining what a robot should do during its turn in a robot simulation. In other words, a robot brain is capable of controlling the actions of a robot body.
The trait RobotBrain
represents the “brains” (or artificial “intelligence”) of virtual robots that inhabit two-dimensional grid worlds. A robot brain is equipped with an algorithm for determining what a robot should do during its turn in a robot simulation. In other words, a robot brain is capable of controlling the actions of a robot body.
Concrete classes that extend this trait need to provide implementations for the abstract moveBody
method; each such concrete class can represent a new kind of robot behavior. Overriding the mayMove
method may also be necessary.
Parameters
- body
-
the body the robot brain will control
- initialName
-
the name of the robot
Attributes
- Supertypes
- Known subtypes
floorWidth
: Int, floorHeight
: Int) extends Grid[Square]
An instance of the class RobotWorld
represents a mutable, two-dimensional world that can be inhabited by virtual robots. This kind of “robot world” is a Grid
whose elements are Square
objects.
An instance of the class RobotWorld
represents a mutable, two-dimensional world that can be inhabited by virtual robots. This kind of “robot world” is a Grid
whose elements are Square
objects.
Robots — RobotBody
objects — can be added to the robot world, and the robot world object maintains a listing of the added robots. it uses this list so that the robots take their turns in a round-robin fashion.
Apart from robots, a robot world can also contain walls. All robot worlds are bounded by walls on all sides: all the edge squares of all robot worlds are always unpassable by robots. Wall squares may also be added at other locations within a world.
Parameters
- floorHeight
-
the height of the robot world, in squares, in addition to the walls at the top and at the bottom. The total height of the grid will be two plus this number.
- floorWidth
-
the width of the robot world, in squares, in addition to the walls on both sides. The total width of the grid will be two plus this number.
Attributes
- See also
- Supertypes
name
: String, body
: RobotBody) extends RobotBrain
The class Slaybot
represents the “brains” of robots which stand still until they see another unbroken robot. When this happens, they ram the victim with incredible speed.
The class Slaybot
represents the “brains” of robots which stand still until they see another unbroken robot. When this happens, they ram the victim with incredible speed.
Parameters
- body
-
the robot body whose actions the slaybot brain will control
- name
-
the name of the slaybot
Attributes
- Supertypes
name
: String, body
: RobotBody) extends RobotBrain
The class Spinbot
represents the “brains” of extremely simple robots that simply spin clockwise and never change location.
The class Spinbot
represents the “brains” of extremely simple robots that simply spin clockwise and never change location.
Parameters
- body
-
the robot body whose actions the spinbot brain will control
- name
-
the name of the spinbot
Attributes
- Supertypes
The trait Square
represents squares in a robot world, as an abstract concept. A square object is potentially mutable: its state can change as robots enter and exit it. Two concrete kinds of squares have been implemented: Floor
s and Wall
s.
The trait Square
represents squares in a robot world, as an abstract concept. A square object is potentially mutable: its state can change as robots enter and exit it. Two concrete kinds of squares have been implemented: Floor
s and Wall
s.
Attributes
- See also
- Supertypes
- Known subtypes
name
: String, body
: RobotBody, randomSeed
: Int) extends RobotBrain
The class Staggerbot
represents the “brains” of robots whose algorithms are not sophisticated enough to beat a game of Viinaharava. These robots stagger from place to place harum-scarum, relying on a (pseudo)random number generator.
The class Staggerbot
represents the “brains” of robots whose algorithms are not sophisticated enough to beat a game of Viinaharava. These robots stagger from place to place harum-scarum, relying on a (pseudo)random number generator.
Parameters
- body
-
the unlucky robot body whose actions the staggerbot brain will control
- name
-
the name of the staggerbot
- randomSeed
-
the seed that feeds the random generator that guides the bot
Attributes
- Supertypes
The singleton object Wall
represents walls, that is, squares that constitute unpassable barriers for robots. A robot can never be in the same location with a wall.
The singleton object Wall
represents walls, that is, squares that constitute unpassable barriers for robots. A robot can never be in the same location with a wall.
Since all wall locations in all robot worlds are alike and immutable, it is enough to have a single Wall
object that can be placed anywhere in any robot world. There is no need for separate instances for each wall square.
Attributes
- Supertypes
- Self type
-
Wall.type