import java.util.*;

public class TicTacToeInteraction {

    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        TicTacToe game = new TicTacToe();

        Iterator<ArrayList<BoardState>> bestMoveDictionaryKeyIterator = game.getBestMoveDictionary().getKeyIterator();
        while (bestMoveDictionaryKeyIterator.hasNext()) {
            ArrayList<BoardState> key = bestMoveDictionaryKeyIterator.next();
            displayBoard(key);
            System.out.println(game.getBestMoveDictionary().getValue(key) + 1);
            System.out.println();
        }

        List<BoardState> boardState;
        int userInput;
        displayBoard(game.getCurrentBoardState());
        while (game.getWinner() == null) {
            do {
                System.out.print("Where would you like to place an X? ");
                userInput = keyboard.nextInt();
            } while (!(0 < userInput && userInput <= 9));
            game.placeX(userInput);
            game.makeOpponentMove();
            boardState = game.getCurrentBoardState();
            displayBoard(boardState);
        }
        System.out.println(String.format("%s is the winner", game.getWinner()));
    }

    private static void displayBoard(List board) {
        for (int i = 0; i < board.size(); i++) {
            if (board.get(i) == null) {
                System.out.print("_ ");
            } else {
                System.out.print(board.get(i) + " ");
            }
            if (i % 3 == 2) {
                System.out.println();
            }
        }
    }
}

@@ -731,32 +731,12 @@
 le (
-game.getWinner() == null
+true
 ) %7B%0A
@@ -928,24 +928,47 @@
 put %3C= 9));%0A
+%0A            try %7B%0A    
             
@@ -1007,32 +1007,397 @@
     
-game.makeOpponentMove();
+    if (game.getWinner() != null) %7B%0A                    break;%0A                %7D%0A%0A                game.makeOpponentMove();%0A                if (game.getWinner() != null) %7B%0A                    break;%0A                %7D%0A            %7D catch (IllegalArgumentException error) %7B%0A                System.out.println(String.format(%22There is already a mark at position %25d%22, userInput));%0A            %7D%0A
 %0A   
@@ -1487,32 +1487,116 @@
 ate);%0A        %7D%0A
+        boardState = game.getCurrentBoardState();%0A        displayBoard(boardState);%0A
         System.o

Improve UI logic