package scalevalapokalypsi.Model.Entities import scala.collection.mutable.Buffer import scalevalapokalypsi.Model.* /** A `Player` object represents a player character controlled by one real-life player * of the program. * * A player object’s state is mutable: the player’s location and possessions can change, * for instance. * * @param name the player's name * @param initialLocation the player’s initial location */ class Player(name: String, initialLocation: Area) extends Entity(name, initialLocation): private val observations: Buffer[String] = Buffer.empty override def observe(observation: String): Unit = this.observations.append(observation) def readAndClearObservations(): Vector[String] = val res = this.observations.toVector observations.clear() res end Player