RobotTribes Docs
Fall 2026
API

# 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: `Floor`s and `Wall`s.

## Attributes

See also

  Floor

  Wall

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

def isEmpty: Boolean

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

def isUnpassable: Boolean

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

def robot: Option[RobotBody]

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

def nonEmpty: Boolean

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