Example #1
0
  public void testBentFourInCorner() {
    String[] text = new String[4];
    text[0] = new String("[B, B, _, _]");
    text[1] = new String("[B, B, B, _]");
    text[2] = new String("[B, B, B, _]");
    text[3] = new String("[B, B, B, B]");
    byte[][] state = StateLoader.LoadStateFromText(text);

    TerritoryAnalysis ta = new TerritoryAnalysis(state);
    Logger.getLogger(TerritoryAnalysis.class).setLevel(Level.WARN);

    Point point = Point.getPoint(4, 2, 1);
    Block target = ta.getBlock(point);
    Point eye = Point.getPoint(4, 1, 4);
    BlankBlock eyeBlock = ta.getBlankBlock(eye);
    boolean live = ta.isBigEye_alreadyLive(target, eyeBlock);
    assertFalse(live);

    boolean canLive = ta.isBigEye_canLive(target, eyeBlock);
    assertTrue(canLive);

    boolean dead = ta.isAlreadyDead_dynamic(point);
    assertFalse(dead);

    boolean finalState_deadExist = ta.isFinalState_deadExist();
    assertFalse(finalState_deadExist);
  }
Example #2
0
  @Override
  public Set<Point> getEatenPoints() {
    Set<Point> points = new HashSet<Point>();
    // 当前一步提吃的单子
    for (int i = 0; i < 4; i++) {
      int m = hui[shoushu][i * 2 + 1];
      int n = hui[shoushu][i * 2 + 2];
      if (m != 0 && n != 0) points.add(Point.getPoint(boardSize, m, n));
      else break;
    }
    // 当前一步提吃的气块
    for (int i = 0; i < 4; i++) {
      int kin = hui[shoushu][9 + i];
      if (kin != 0) {
        for (int k = 1; k <= kuai[kin][0][1]; k++)
          points.add(Point.getPoint(boardSize, kuai[kin][k][0], kuai[kin][k][1]));

      } else break;
    }
    return points;
  }
Example #3
0
  public void _testBackward(GMDGoManual manual) {
    GoBoard goBoard = new GoBoard();
    int row = 0;
    int column = 0;
    byte[] original = manual.getMoves();

    for (int i = 0; i < original.length; i += 2) {
      row = original[i];
      column = original[i + 1];
      if (log.isDebugEnabled()) {
        log.debug("shoushu=" + (i + 3) / 2);
        log.debug("a=" + row);
        log.debug("b=" + column);
      }
      goBoard.oneStepForward(row, column);
    }

    for (int i = 0; i < original.length; i += 2) {
      column = original[(original.length - 1) - i];
      row = original[(original.length - 1) - (i + 1)];
      if (log.isDebugEnabled()) {
        log.debug("shoushu=" + (manual.getShouShu() - i / 2));
        log.debug("a=" + row);
        log.debug("b=" + column);
      }
      goBoard.oneStepBackward();
    }
    if (log.isInfoEnabled()) {
      log.info(goBoard.getBlock(1, 1));
      Set<Point> originalB = goBoard.getBlankBlock(1, 1).getPoints();
      for (row = 1; row <= Constant.BOARD_SIZE; row++) {
        for (column = 1; column <= Constant.BOARD_SIZE; column++) {
          Point point = Point.getPoint(Constant.BOARD_SIZE, row, column);

          if (originalB.contains(point) == false) log.debug(point);
        }
      }
    }
  }
Example #4
0
 public Point getPoint(int row, int column) {
   return Point.getPoint(this.boardSize, row, column);
 }