Exemplo n.º 1
0
  /** test internally--is data structure consistent for first go manual. */
  public void testForwardNextStep_FirstLibGoManualInternally() {

    byte count = 0;
    List<GMDGoManual> list = new LoadGMDGoManual(rootDir).loadMultiGoManualFromLib0();
    for (GMDGoManual manual : list) {
      count++;
      byte[] original = manual.getMoves();
      log.debug("GOManual:" + count);
      log.debug("GOManualLength:" + original.length);
      try {
        this.helperTestMethod(original);
      } catch (RuntimeException e) {
        if (log.isDebugEnabled()) log.debug("GOManual:" + count);
        if (log.isDebugEnabled()) log.debug("GOManualLength:" + original.length);
        throw e;
      }
    }
    log.debug("success of testForwardNextStepFirstLibGoManualInternally");
  }
Exemplo n.º 2
0
  /**
   * test internally--is data structure consistent for first go manual. for all Go Manuals
   *
   * @deprecated external data is not valid any more.
   */
  public void testForwardNextStep_ForAllGoManualInternally() {

    int count = 0;
    List<GMDGoManual> list = new LoadGMDGoManual(rootDir).loadMultiGoManualFromLib0();

    for (int j = 1; j < 2; j++) {
      log.debug("j=" + j);
      list = new LoadGMDGoManual(rootDir).loadMultiGoManual(j);
      for (GMDGoManual manual : list) {
        byte[] original = manual.getMoves();
        count++;

        if (log.isDebugEnabled()) {
          log.debug("GOManual:" + count);
          log.debug("GOManualLength:" + original.length);
        }
        this.helperTestMethod(original);
      }
    }
    log.debug("success of testForwardNextStepForAllGoManualInternally");
  }
Exemplo n.º 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);
        }
      }
    }
  }
Exemplo n.º 4
0
 public void testBackward() {
   GMDGoManual manual = GMDGoManual.loadGoManual(Constant.GLOBAL_MANUAL, 0);
   if (log.isDebugEnabled()) log.debug(manual);
   _testBackward(manual);
 }