private void UpdateGridStatus(Cordinate cords) { var cordinate = Cordinates.Single(x => x.X == cords.X && x.Y == cords.Y); cordinate.IsOccupied = true; cordinate.Symbol = GameStatus.Instance.CurrentPlayer.Symbol; }
public void Update(Cordinate cords) { if (!IsOccupied(cords)) { UpdateGridStatus(cords); UpdateCurrentPlayerStatus(cords); } }
public void Update(Cordinate cords) { try { _grid.Update(cords); } catch (Exception e) { logger.Error(e.StackTrace); } }
public static IList <Cordinate> InitializeGrid(int _length, int _height, char symbol) { var cordinates = new List <Cordinate>(); for (var i = 1; i <= _length; i++) { for (var j = 1; j <= _height; j++) { var cord = new Cordinate(i, j, symbol) { IsOccupied = false }; cordinates.Add(cord); } } return(cordinates); }
private void UpdateCurrentPlayerStatus(Cordinate cords) { GameStatus.Instance.CurrentPlayer.MoveCount++; GameStatus.Instance.CurrentPlayer.OccupiedPositions.Add(cords); }
public bool IsOccupied(Cordinate cords) { return(Cordinates.Single(x => x.X == cords.X && x.Y == cords.Y).IsOccupied); }