package li.seiji.minichess.player;

import com.sun.media.sound.InvalidFormatException;
import li.seiji.minichess.Board;
import li.seiji.minichess.move.Move;
import li.seiji.minichess.move.MoveValidator;

import java.util.Scanner;

public class HumanPlayer implements IPlayer {

    public void start() {}

    @Override
    public Move getMove(Board state) {
        Move move = null;
        Scanner reader = new Scanner(System.in);

        do {
            String moveString = reader.nextLine();
            try {
                move = new Move(moveString);
            } catch (InvalidFormatException e) {
                System.out.println("Not a valid move string");
            }
        } while (move == null || !MoveValidator.isMoveValid(state, move));

        reader.close();
        return move;
    }

    @Override
    public void setMove(Board state, Move move) {}

}

@@ -279,29 +279,105 @@
     
-public void start() %7B
+Scanner scanner = null;%0A%0A    public void start() %7B%0A        scanner = new Scanner(System.in);%0A    
 %7D%0A%0A 
@@ -457,57 +457,8 @@
 ull;
-%0A        Scanner reader = new Scanner(System.in);
 %0A%0A  
@@ -500,20 +500,21 @@
 tring = 
-read
+scann
 er.nextL
@@ -789,32 +789,8 @@
 );%0A%0A
-        reader.close();%0A
     

Fix weird Scanner exception