public void run() {
            String command;
            try {

                while (true) {

                    command = input.readLine();

                    if (command.startsWith("MOVE")) {
                        System.out.println(command);

                        //TODO make the split command more readable
                        if (legalMove(Integer.parseInt(command.split(" ")[1]), this)) {
                            output.println("LEGAL_MOVE");
                            checkEndOfGame();
                        } else {
                            output.println("MESSAGE Illegal move");
                        }


                    } else if (command.startsWith("RESET")) {
                        reset();
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }


        }