public BFSNode(PatternDatabase db)  // initial state --> the empty tile is in the bottom right corner
 {
     this.db        = db;
     this.empty_row = db.rows - 1;
     this.empty_col = db.cols - 1;
     this.direction = Direction.NONE;
     this.board     = new MiniBoard(db.rows, db.cols);
     this.distance  = 0;
 }
 private BFSNode(PatternDatabase db, MiniBoard board, int empty_row, int empty_col, int distance, Direction direction)
 {
     this.db        = db;
     this.empty_row = empty_row;
     this.empty_col = empty_col;
     this.board     = board;
     this.distance  = distance;
     this.direction = direction;
 }
Exemplo n.º 3
0
        public PuzzleSolver(int board_size)
        {
            this.board_size = board_size;
            //
            PuzzleType type;

            switch (board_size)
            {
            case 3: type = PuzzleType.PUZZLE_3x3; break;

            case 4: type = PuzzleType.PUZZLE_4x4; break;

            default: throw new Exception("Unsupported board dimensions! Supported are 3x3 and 4x4 puzzles!");
            }
            //
            patternDB = new PatternDatabase(type);
        }