Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.13 KB | None | 0 0
  1.   def tryToMove(board: Board, movementAndDestinations: List[(MovementClass, Field)], move: MovementClass): Unit = {
  2.     val lastField = movementAndDestinations.head._2
  3.     //    val newField = move.move(lastField.getColumn(), lastField.getRow())
  4.     //    if (!board.isInRange(newField)) {
  5.     //      return;
  6.     //    }
  7.     val newLastField = new Field(move.move(lastField.getColumn(), lastField.getRow()));
  8.  
  9.     tryAllPossibilities(board, (move, newLastField) :: movementAndDestinations);
  10.   }
  11.  
  12.   def tryAllPossibilities(board: Board, movementAndDestinations: List[(MovementClass, Field)]): Unit = {
  13.     println(movementAndDestinations.size)
  14.     println(movementAndDestinations)
  15.  
  16.     Movement.values.foreach(m => {
  17.       if (canMove(board, movementAndDestinations, m)) {
  18.         val lastField = movementAndDestinations.head._2
  19.         //        tryToMove(board, movementAndDestinations, m)
  20.         val newLastField = new Field(m.move(lastField.getColumn(), lastField.getRow()));
  21.         movementAndDestinations = (m, newLastField) :: movementAndDestinations);
  22.       }
  23.     });
  24.     tryAllPossibilities(board, movementAndDestination);
  25.   };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement