Examples of BoardDef


Examples of org.darkhelm.dragonchess.server.board.BoardDef

      // Make a clone of the current board set to calculate the move with.
      BoardSet set = board.getSet().clone();

      // Figure out which board to work with.
      BoardDef boardDest = set.getBoard(Boards.values()[boardMove]);

      // Diagonal step checking: The in-between steps for diagonal
      // movements must be empty if doing this check.
      if (getCheck() != null) {
        int horizCheck = horizDest - getDir().getHoriz()
            + getCheck().getHoriz();
        int vertCheck = vertDest - getDir().getVert()
            + getCheck().getVert();
        int boardCheck = boardMove - getDir().getBoard()
            + getCheck().getBoard();

        BoardDef boardCheckDest = set
            .getBoard(Boards.values()[boardCheck]);

        if (boardCheckDest.get(vertCheck, horizCheck) != null) {
          break;
        }
      }

      // Figure out what piece (if any) is at the destination location.
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

    // Clone the current board set for this move.
    BoardSet set = board.getSet().clone();

    // Figure out which board the move is going to.
    BoardDef boardDest = set.getBoard(Boards.values()[boardMove]);

    // Check what is at the destination.
    BoardPiece destPiece = boardDest.get(vertDest, horizDest);

    // Destination piece is on the same team.
    if (destPiece != null && destPiece.getTeam() == team) {
      return ret;

      // Destination piece is on the other team.
    } else if (destPiece != null) {
      PieceDef destPieceDef = PieceDef.get(destPiece.getType());

      score = destPieceDef.getValue();
    }

    // If there is a piece that can be "captured" it can be frozen.
    if (score > 0) {
      ret.add(Position.create(boardDest.getType(), horizDest, vertDest));
    }

    return ret;
  }
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

     
      // Clone the current board set for this move.
      BoardSet set = board.getSet().clone();
     
      // Figure out which board the move is going to.
      BoardDef boardDest = set.getBoard(pos.getBoard());

      // Check what is at the destination.
      BoardPiece destPiece = boardDest.get(pos.getVert(), pos.getHoriz());
     
      // If the home position is not empty, skip.
      if(destPiece != null) {
        continue;
      }
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

    // Clone the current board set for this move.
    BoardSet set = board.getSet().clone();

    // Figure out which board the move is going to.
    BoardDef boardDest = set.getBoard(Boards.values()[boardMove]);

    // Check what is at the destination.
    BoardPiece destPiece = boardDest.get(vertDest, horizDest);

    // Destination piece is on the same team.
    if (destPiece != null && destPiece.getTeam() == team) {
      return ret;

      // Destination piece is on the other team.
    } else if (destPiece != null) {
      PieceDef destPieceDef = PieceDef.get(destPiece.getType());

      score = destPieceDef.getValue();
    }

    // FROM_AFAR only makes sense with capture moves.
    if (getType() == MoveTypes.FROM_AFAR && score == 0) {
      return ret;
    }

    // Perform move on cloned board set.
    set.move(board.getType(), horizPos, vertPos, boardDest.getType(),
        horizDest, vertDest);

    // FROM_AFAR doesn't need to worry about check validation.
    if (getType() != MoveTypes.FROM_AFAR && !check
        && set.isCheck(team.other())) {
      return ret;
    }

    // get the board set's hash for this move.
    hash = set.hash();

    MoveTypes type = null;

    // Define what the type of the move is.
    if (getType() == MoveTypes.FROM_AFAR) {
      type = getType();
    } else if (score == 0) {
      type = MoveTypes.MOVE;
    } else {
      type = MoveTypes.CAPTURE;
    }

    // Load the move into the returned array.
    ret.add(new Move(hash, score, boardDest.getType(), horizDest, vertDest,
        type));

    return ret;
  }
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

public class BoardTest {
  @Test
  public void testAir() {
    try {
      BoardDef board = loadBoard("air.xml");

      assertTrue(board.getType() == Boards.AIR);

    } catch (JiBXException e) {
      fail(e.getMessage());
      e.printStackTrace();
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

  }

  @Test
  public void testLand() {
    try {
      BoardDef board = loadBoard("land.xml");

      assertTrue(board.getType() == Boards.LAND);

    } catch (JiBXException e) {
      fail(e.getMessage());
      e.printStackTrace();
View Full Code Here

Examples of org.darkhelm.dragonchess.server.board.BoardDef

  }

  @Test
  public void testUnder() {
    try {
      BoardDef board = loadBoard("under.xml");

      assertTrue(board.getType() == Boards.UNDER);

    } catch (JiBXException e) {
      fail(e.getMessage());
      e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.