コード例 #1
0
        /// <summary>
        ///     Get the rows and select the cordinates that make a backward(\) diagonal
        /// </summary>
        /// <returns></returns>
        public CordinateSet GetLeftDiagonal()
        {
            var rowCounter        = 0;
            var winningCordinates = new CordinateSet();

            foreach (var set in GetRowCordinateSets())
            {
                var cords = set.Get().ToArray()[rowCounter];
                rowCounter++;
                winningCordinates.Set(cords);
            }

            return(winningCordinates);
        }
コード例 #2
0
        /// <summary>
        ///     Get the rows and select the cordinates that make a forward(/) diagonal
        /// </summary>
        /// <returns></returns>
        public CordinateSet GetRightDiagonal()
        {
            var rowCounter        = Constants.GRID_WIDTH - 1;
            var winningCordinates = new CordinateSet();

            foreach (var set in GetRowCordinateSets())
            {
                var cords = set.Get().ToArray()[rowCounter];
                rowCounter--;
                winningCordinates.Set(cords);
            }

            return(winningCordinates);
        }
コード例 #3
0
        public CordinateSet GetRowCordinates(int rowNumber)
        {
            var winningCordinates = new CordinateSet();

            for (var c = 1; c <= Constants.GRID_WIDTH; c++)
            {
                var cords = new Cordinate
                {
                    X = rowNumber,
                    Y = c
                };
                winningCordinates.Set(cords);
            }

            return(winningCordinates);
        }
コード例 #4
0
        public CordinateSet GetColumnCordinates(int columnNumber)
        {
            var winningCordinates = new CordinateSet();

            for (var r = 1; r <= Constants.GRID_HEIGHT; r++)
            {
                var cords =
                    new Cordinate
                {
                    X = r,
                    Y = columnNumber
                };
                winningCordinates.Set(cords);
            }

            return(winningCordinates);
        }