Square

o1.robots.Square
trait Square

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: Floors and Walls.

Attributes

See also
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Floor
object Wall

Members list

Value members

Abstract methods

def addRobot(arrivee: RobotBody): Boolean

Adds the given robot to the square, if possible. If there is something already in the square, a collision happens instead.

Adds the given robot to the square, if possible. If there is something already in the square, a collision happens instead.

Parameters

arrivee

the robot arriving in the square

Attributes

Returns

true if arrivee was successfully placed in the square, false if a collision occurred

def clear(): Unit

Removes any robot from the square (if there was one there to begin with).

Removes any robot from the square (if there was one there to begin with).

Attributes

Returns true if the square is completely empty (of robots and walls), false otherwise.

Returns true if the square is completely empty (of robots and walls), false otherwise.

Attributes

Returns true if the square contains a permanent, unpassable barrier, false otherwise.

Returns true if the square contains a permanent, unpassable barrier, false otherwise.

Attributes

Returns the robot occupying the square, wrapped in an Option, or None, if there is no robot in the square.

Returns the robot occupying the square, wrapped in an Option, or None, if there is no robot in the square.

Attributes

Concrete methods

Returns true if the square contains any robot or wall, false otherwise.

Returns true if the square contains any robot or wall, false otherwise.

Attributes