All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.robocode.tankroyale.server.model.ITurn.kt Maven / Gradle / Ivy

package dev.robocode.tankroyale.server.model

import dev.robocode.tankroyale.server.event.Event

/** Mutable state of a game turn in a round. */
interface ITurn {
    /** Turn number */
    val turnNumber: Int

    /** Bots */
    val bots: Set

    /** Bullets */
    val bullets: Set

    /** Observer events  */
    val observerEvents: Set

    /** Map over bot events  */
    val botEvents: Map>

    /**
     * Returns a bot instance by id.
     * @param botId is the id of the bot.
     * @return the bot instance with the specified id or null if the bot was not found.
     */
    fun getBot(botId: BotId): IBot? = bots.find { it.id == botId }

    /**
     * Returns the event for a specific bot.
     * @param botId is the id of the bot.
     * @return a set of bot events.
     */
    fun getEvents(botId: BotId): Set = botEvents[botId] ?: HashSet()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy