import java.util.Scanner; /** * Implements the interface for the game of TicTacToe. In other words, this class * performs all of the necessary input/output. * * @author cs161 * @version spring2019 */ public class TicTacToeController{ private static void printWelcome(){ System.out.println("=============== WELCOME TO TIC TAC TOE ==============="); System.out.println("Two players (x and o) will compete to be the first"); System.out.println("to place 3 of their mark in the same row, column, or diagonal"); System.out.println(); } private static boolean oneRound(Scanner scan, TicTacToe game){ System.out.print("Enter row: "); int row = scan.nextInt(); System.out.print("Enter col: "); int col = scan.nextInt(); game.move(row, col); game.printBoard(); boolean isOver = game.gameOver(); if(isOver){ String winner = game.winner(); System.out.println("The outcome was: " + winner); } return isOver; } public static void main(String[] args){ printWelcome(); TicTacToe game = new TicTacToe(); game.printBoard(); Scanner scan = new Scanner(System.in); boolean isOver = oneRound(scan, game); if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } if(!isOver){ isOver = oneRound(scan, game); } } }