Exemplo n.º 1
0
        private bool ExistsAlreadyInGroup(CellValue value)
        {
            if (Row.Contains(value))
            {
                return(true);
            }
            if (Col.Contains(value))
            {
                return(true);
            }
            if (Sqr.Contains(value))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public static Sudoku CreateEmptySudoku()
        {
            var row1 = new Row(1);
            var row2 = new Row(2);
            var row3 = new Row(3);
            var row4 = new Row(4);
            var row5 = new Row(5);
            var row6 = new Row(6);
            var row7 = new Row(7);
            var row8 = new Row(8);
            var row9 = new Row(9);

            var col1 = new Col(1, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col2 = new Col(2, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col3 = new Col(3, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col4 = new Col(4, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col5 = new Col(5, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col6 = new Col(6, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col7 = new Col(7, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col8 = new Col(8, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var col9 = new Col(9, row1, row2, row3, row4, row5, row6, row7, row8, row9);

            var sqr1 = new Sqr(1, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr2 = new Sqr(2, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr3 = new Sqr(3, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr4 = new Sqr(4, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr5 = new Sqr(5, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr6 = new Sqr(6, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr7 = new Sqr(7, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr8 = new Sqr(8, row1, row2, row3, row4, row5, row6, row7, row8, row9);
            var sqr9 = new Sqr(9, row1, row2, row3, row4, row5, row6, row7, row8, row9);

            return(new Sudoku(row1, row2, row3, row4, row5, row6, row7, row8, row9,
                              col1, col2, col3, col4, col5, col6, col7, col8, col9,
                              sqr1, sqr2, sqr3, sqr4, sqr5, sqr6, sqr7, sqr8, sqr9));
        }
Exemplo n.º 3
0
 public void To(Col col)
 {
     _cell.Col = col;
 }