Wall

object Wall extends Square

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.

trait Square
class Object
trait Matchable
class Any
Wall.type

Value members

Concrete methods

def addRobot(arrivee: RobotBody): Boolean

Fails to add the given robot to the square. Instead, the robot collides with the wall and is destroyed.

Fails to add the given robot to the square. Instead, the robot collides with the wall and is destroyed.

Value parameters:
arrivee

the robot attempting to arrive in the square

Returns:

false since the robot’s arrival failed

def clear(): Unit

Does nothing, since there is no robot to remove in a wall square.

Does nothing, since there is no robot to remove in a wall square.

Inherited 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.

Inherited from:
Square

Concrete fields

false since there is a wall

false since there is a wall

true since a wall is an unpassable barrier

true since a wall is an unpassable barrier

None since there is never any robot in a wall square

None since there is never any robot in a wall square