package robots
- Alphabetic
- Public
- Protected
Type Members
- class Floor extends Square
The class
Floor
represents squares that robots can successfully occupy and move through.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. - class Lovebot extends RobotBrain
The class
Lovebot
represents the "brains" (or AI) of robots which have another robot as their "beloved".The class
Lovebot
represents the "brains" (or AI) of robots which have another robot as their "beloved". A lovebot tries to home in on its beloved. - class Nosebot extends RobotBrain
The class
Nosebot
represents the "brains" (or AI) of robots that move in the direction their nose points, in straight lines, only turning when they have to.The class
Nosebot
represents the "brains" (or AI) of robots that move in the direction their nose points, in straight lines, only turning when they have to. They always turn right. - class Psychobot extends RobotBrain
The class
Psychobot
represents the "brains" (or AI) of robots which stand still until they see another unbroken robot.The class
Psychobot
represents the "brains" (or AI) of robots which stand still until they see another unbroken robot. When this happens, they ram the victim with incredible speed. - class RobotBody extends AnyRef
The class
RobotBody
represents virtual robots (or "bots") which inhabit two-dimensional grid worlds.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 the 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.- See also
- abstract class RobotBrain extends AnyRef
The class
RobotBrain
represents the "brains" (or artificial intelligence, AI) of virtual robots that inhabit two dimensional grid worlds.The class
RobotBrain
represents the "brains" (or artificial intelligence, AI) 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 class need to provide implementations for the abstract
moveBody
method; each such concrete class can represent a new kind of robot behavior. Some subclasses are also expected to override themayAdvance
method. - class RobotWorld extends o1.Grid[Square]
An instance of the class
RobotWorld
represents a mutable, two-dimensional world that can be inhabited by virtual robots.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 aGrid
whose elements areSquare
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 to have 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 robot world.
- See also
- class Spinbot extends RobotBrain
The class
Spinbot
represents the "brains" (or AI) of extremely simple robots that simply spin clockwise and never change location. - trait Square extends AnyRef
The trait
Square
represents squares in a robot world, as an abstract concept. - class Staggerbot extends RobotBrain
The class
Staggerbot
represents the "brains" (or AI) of robots whose algorithms are not sophisticated enough to beat a game of Viinaharava.The class
Staggerbot
represents the "brains" (or AI) 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.
Value Members
- object Wall extends Square
The singleton object
Wall
represents walls, that is, squares that constitute unpassable barriers for robots.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.