예제 #1
0
        public static int VerticalRelatives(this GameCell cell, GameCell[,] grid)
        {
            int relatives = 0;
            int colNum    = grid.IndexOf(cell).Item1;

            for (var y = 0; y < 3; y++)
            {
                //Find row of cell
                if (grid[colNum, y].CellStatus.Equals(cell.CellStatus))
                {
                    relatives++;
                }
            }

            return(relatives - 1);
        }
예제 #2
0
        public static int HorizontalRelatives(this GameCell cell, GameCell[,] grid)
        {
            int relatives = 0;
            int rowNum    = grid.IndexOf(cell).Item2;

            for (var x = 0; x < 3; x++)
            {
                //Find row of cell
                if (grid[x, rowNum].CellStatus.Equals(cell.CellStatus))
                {
                    relatives++;
                }
            }

            return(relatives - 1);
        }