예제 #1
0
        private static void CtorContract(EightPuzzleCell blank)
        {
            blank.Line.BiggerOrEqualThanDebug(0);
            blank.Line.LessThanDebug(9);

            blank.Column.BiggerOrEqualThanDebug(0);
            blank.Column.LessThanDebug(9);
        }
예제 #2
0
        private static EightPuzzle PerformMove(EightPuzzle map, EightPuzzleCell piece)
        {
            int value = map.board[piece.Line][piece.Column];

            map.board[map.blank.Line][map.blank.Column] = value;
            map.board[piece.Line][piece.Column]         = 0;

            map.blank = new EightPuzzleCell(piece.Line, piece.Column);

            return(map);
        }
예제 #3
0
 private EightPuzzle(int[][] map, EightPuzzleCell blank)
 {
     board = map;
     CtorContract(blank);
     this.blank = blank;
 }
예제 #4
0
 public EightPuzzle(int[][] map)
 {
     board = map;
     blank = FindBlankCell(board);
 }