예제 #1
0
        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;
        }
예제 #2
0
 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);
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
 private void UpdateCurrentPlayerStatus(Cordinate cords)
 {
     GameStatus.Instance.CurrentPlayer.MoveCount++;
     GameStatus.Instance.CurrentPlayer.OccupiedPositions.Add(cords);
 }
예제 #6
0
 public bool IsOccupied(Cordinate cords)
 {
     return(Cordinates.Single(x => x.X == cords.X && x.Y == cords.Y).IsOccupied);
 }