Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def tryToMove(board: Board, movementAndDestinations: List[(MovementClass, Field)], move: MovementClass): Unit = {
- val lastField = movementAndDestinations.head._2
- // val newField = move.move(lastField.getColumn(), lastField.getRow())
- // if (!board.isInRange(newField)) {
- // return;
- // }
- val newLastField = new Field(move.move(lastField.getColumn(), lastField.getRow()));
- tryAllPossibilities(board, (move, newLastField) :: movementAndDestinations);
- }
- def tryAllPossibilities(board: Board, movementAndDestinations: List[(MovementClass, Field)]): Unit = {
- println(movementAndDestinations.size)
- println(movementAndDestinations)
- Movement.values.foreach(m => {
- if (canMove(board, movementAndDestinations, m)) {
- val lastField = movementAndDestinations.head._2
- // tryToMove(board, movementAndDestinations, m)
- val newLastField = new Field(m.move(lastField.getColumn(), lastField.getRow()));
- movementAndDestinations = (m, newLastField) :: movementAndDestinations);
- }
- });
- tryAllPossibilities(board, movementAndDestination);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement