Question
THIS IS A JAVA ASSIGNMENT Your task is to design a general program for managing board games with two players. Your program should be flexible
THIS IS A JAVA ASSIGNMENT Your task is to design a general program for managing board games with two players. Your program should be flexible enough to handle games such as tic-tac-toe or chess. The Game interface given below describes a board game.
public interface Game
{
boolean isValidMove(String move);
void executeMove(String move);
boolean gameOver();
void displayBoard();
int determineWinner();
}
For this problem, you will be providing an implementation of the Game interface for Tic-TacToe. Create a class called GamePlayer that would manage a Game reference without knowing which game is played, and process the moves from both players. The GamePlayer class would handle the logic for playing the game - getting the players moves, switching player turns, and printing the winner. Create a class TicTacToeGame that implements the Game interface and provides the logic for playing TicTacToe. Also, include a TicTacToe class that serves as the driver class. The main method in the driver class should not contain any significant logic and should only be used to start the game
THIS IS A JAVA ASSIGNMENT
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started