Package minesweeper.ai.utils

Examples of minesweeper.ai.utils.Node


  public void backtrackSolve(MutableBoard grid) {
    BoardInfoHelper helper = new BoardInfoHelper(grid);
      List<Position> positions = helper.getUnknownBorderCells();
      toPick = new HashMap<>(); toFlag = new HashMap<>();
      toPickSet = new HashSet<>(positions); toFlagSet = new HashSet<>(positions);
      backtrackSolve(grid, helper, positions, new Node(null,null), new Node(null,null));
      System.out.println("To Pick " + toPickSet);
      System.out.println("To Flag " + toFlagSet);
      for(Position p : toPickSet)
        grid.setCell(p, Cell.NO_BOMB);
      for(Position p : toFlagSet)
View Full Code Here


    }
    Position p = positions.remove(0);
    board.setCell(p,Cell.NO_BOMB);
    boolean result = false;
    if(helper.validate(p))
      if(backtrackSolve(board,helper,positions,new Node(p,outPick),outFlag))
        result = true;
    board.setCell(p, Cell.FLAG);
    if(helper.validate(p))
      if(backtrackSolve(board,helper,positions,outPick,new Node(p,outFlag)))
        result = true;
    board.setCell(p, Cell.UNKNOWN);
    positions.add(0,p);
    return result;
  }
View Full Code Here

TOP

Related Classes of minesweeper.ai.utils.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.