/**
 * Represents the state of a game.
 */
export class State
{
    /**
     * The board of the game.
     *
     * @type {Board}
     */
    #board;

    /**
     * The number of turns that have been played.
     */
    turnCount = 0;

    /**
     * Initializes a new instance of the {@link State `State`} class.
     *
     * @param {number} width
     * The width of the board.
     *
     * @param {number} height
     * The height of the board.
     */
    constructor(width, height)
    {
        this.#board = /** @type {Board} */ (
            Array(height).fill("").map(
                () =>
                {
                    return Array(width).fill(
                        /** @type {CellOwner} */ (""));
                }));
    }

    /**
     * Gets the id of the current player.
     *
     * @type {CellOwner}
     */
    get currentPlayer()
    {
        return this.turnCount % 2 === 0 ? "r" : "b";
    }

    /**
     * Gets the board of the game.
     */
    get board()
    {
        return this.#board;
    }
}