using System; namespace DevilLink2.Core { /// Immutable tile identity with board-controlled location. IDs are unique within a board. public sealed class Tile { internal Board Owner { get; set; } public int Id { get; } public TileSymbol Symbol { get; } public int Row { get; private set; } public int Column { get; private set; } public GridPosition Position => new GridPosition(Row, Column); internal void SetPosition(int row, int column) { Row = row; Column = column; } public Tile(int id, TileSymbol symbol, int row, int column) { if (id <= 0) throw new ArgumentOutOfRangeException(nameof(id)); if (!Enum.IsDefined(typeof(TileSymbol), symbol)) throw new ArgumentOutOfRangeException(nameof(symbol)); if (row < 0) throw new ArgumentOutOfRangeException(nameof(row)); if (column < 0) throw new ArgumentOutOfRangeException(nameof(column)); Id = id; Symbol = symbol; Row = row; Column = column; } } }