Examples of BoardSet


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

   
    for(Position pos : board.getSet().getHomes(bPiece)) {
      long hash = 0;
     
      // 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;
      }
     
      // Perform move on cloned board set.
      set.move(board.getType(), horizPos, vertPos, pos.getBoard(),
          pos.getHoriz(), pos.getVert());

      // check validation.
      if (!check && set.isCheck(team.other())) {
        continue;
      }

      // get the board set's hash for this move.
      hash = set.hash();
     
      // Load the move into the returned array.
      ret.add(new Move(hash, 0, pos.getBoard(), pos.getHoriz(), pos.getVert(),
          MoveTypes.MOVE));
    }
View Full Code Here

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

    if (!Boards.inRange(boardMove, horizDest, vertDest)) {
      return ret;
    }

    // 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) {
View Full Code Here

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

      if (!Boards.inRange(boardMove, horizDest, vertDest)) {
        break;
      }

      // 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.
      BoardPiece destPiece = boardDest.get(vertDest, horizDest);

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

        score = destPieceDef.getValue();
      }

      // CAPTURE can only capture, MOVE can only move.
      if ((score == 0 && getType() == MoveTypes.CAPTURE)
          || (score > 0 && getType() == MoveTypes.MOVE)) {
        break;
      }

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

      // Validate for check condition -- the move cannot place your own
      // king in check.
      if (!check && set.isCheck(team.other())) {
        continue;
      }

      // Get the hash for the board set for this move.
      hash = set.hash();

      MoveTypes type = null;

      // The user will be told if the move captures or just moves the
      // piece.
View Full Code Here

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

    if (!Boards.inRange(boardMove, horizDest, vertDest)) {
      return ret;
    }

    // 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.
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.