Generated with
This document is part of the ebook for O1 (aka CS-A1110 Programming 1), a course at Aalto University.
This document is part of the ebook for O1 (aka CS-A1110 Programming 1), a course at Aalto University.
o1.robots.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
Graph
Reset zoom Hide graph Show graph
Supertypes
Known subtypes
Members list
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
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
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