Package com.ir.objects

Examples of com.ir.objects.Square


    // Create a board
    Board board = new Board();
    //Debug.printBoard(board);
   
    // Create the start and end squares
    Square startSquare = board.getSquare(args[0]);
    Square endSquare = board.getSquare(args[1]);
   
    // If the squares contained incorrect positions, print an error statement
    if (startSquare == null || endSquare == null){
      printError(1);
      return;
View Full Code Here


   * @param path - a Path object containing the path from start to finish
   */
  public static void printPath(Path path){
    List<Square> p = path.getPath();
    for (int i = p.size() - 2; i > 0; i--){
      Square s = p.get(i);
      System.out.print(s.toString() + " ");
    }
    Square s = p.get(0);
    System.out.println(s.toString());
  }
View Full Code Here

   
    // While we still have nodes to explore
    while (!openSet.isEmpty()){
      // Get the node with the lowest f-score from the priority queue
      Node current = openSet.poll();
      Square currentSquare = current.getSquare();
     
      // If we've found the goal, return the path we took to get there
      if (currentSquare.equals(end))
        return reconstructPath(currentSquare);

      // Add current to closedset, and move the chess piece to that square
      closedSet.add(currentSquare);
      chessPiece.move(currentSquare);
View Full Code Here

   * @param currentSquare - the square the chess piece is currently on
   * @return the path to the current square
   */
  public Path reconstructPath(Square currentSquare){
    path.addSquare(currentSquare);
    Square c = null;
    while ((c = cameFrom.get(currentSquare)) != null){
      path.addSquare(c);
      currentSquare = c;
    }
    return path;
View Full Code Here

TOP

Related Classes of com.ir.objects.Square

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.