Question

Purpose of it is to coordinate the interaction between the user and the lower-level functionality of...

Purpose of it is to coordinate the interaction between the user and the lower-level functionality of the game. There are two overloaded constructors, one for constructing a brand new game and one for constructing a game from a file.

w - Move Up

   s - Move Down

   a - Move Left

   d - Move Right

   q - Quit and Save Board

If the user inputs any one of these characters, execute the corresponding move. This should result in a refreshed board printed in the terminal. If the user inputs anything else, for each invalid input, repeat the prompt until the user enters something acceptable.

Starter Code *PLEASE BUILD OFF THIS*

import java.util.*;
import java.io.*;


public class GameManager {

// Instance variables
private Board board; // The actual Pacman board
private String outputFileName; // File to save the board to when exiting

/*
* GameManager Constructor
*
* Purpose: Constructs a GameManager to Generate new game
* Parameter: int boardSize - Integer player want to set as board size.
* String outputBoard - the filename the Board will be saved as.
* Random random - the Random generator player wanna use.
*
*/
GameManager(int boardSize, String outputBoard) throws Exception
{
// TODO
}

/*
* GameManager Constructor
*
* Purpose: Constructs a GameManager to Load a saved game.
* Parameter: String inputBoard - the filename the Board will be inputted.
* String outputBoard - the filename the Board will be saved as.
* Random random - the Random generator player wanna use.
*
*/
GameManager(String inputBoard, String outputBoard) throws Exception
{
// TODO
}


// Main play loop
// Takes in input from the user to specify moves to execute
// valid moves are:
// w - Move up
// s - Move Down
// a - Move Left
// d - Move Right
// q - Quit and Save Board
//
// If an invalid command is received then print the controls
// to remind the user of the valid moves.
//
// Once the player decides to quit or the game is over,
// save the game board to a file based on the outputFileName
// string that was set in the constructor and then return
//
// If the game is over print "Game Over!" to the terminal

/*
* Name: play
* Purpose: Takes in input from the user to specify moves to execute.
* Parameter: Null.
* Return: void.
*
*/
public void play() throws Exception
{
// TODO
}

/*
* Name: printControls()
* Purpose: Print the Controls for the Game.
* Parameter: Null.
* Return: void.
*/
private void printControls()
{
System.out.println(" Controls:");
System.out.println(" w - Move Up");
System.out.println(" s - Move Down");
System.out.println(" a - Move Left");
System.out.println(" d - Move Right");
System.out.println(" q - Quit and Save Board");
System.out.println();
}

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Its allows to use the construter repeatedly and follow the concept of oops. inheritance is use for proper execution

Add a comment
Know the answer?
Add Answer to:
Purpose of it is to coordinate the interaction between the user and the lower-level functionality of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA Only Help on the sections that say Student provide code. The student Provide code has...

    JAVA Only Help on the sections that say Student provide code. The student Provide code has comments that i put to state what i need help with. import java.util.Scanner; public class TicTacToe {     private final int BOARDSIZE = 3; // size of the board     private enum Status { WIN, DRAW, CONTINUE }; // game states     private char[][] board; // board representation     private boolean firstPlayer; // whether it's player 1's move     private boolean gameOver; // whether...

  • For this assignment, your job is to create a simple game called Opoly. The objectives of...

    For this assignment, your job is to create a simple game called Opoly. The objectives of this assignment are to: Break down a problem into smaller, easier problems. Write Java methods that call upon other methods to accomplish tasks. Use a seed value to generate random a sequence of random numbers. Learn the coding practice of writing methods that perform a specific task. Opoly works this way: The board is a circular track of variable length (the user determines the...

  • In a game of Tic Tac Toe, two players take turns making an available cell in...

    In a game of Tic Tac Toe, two players take turns making an available cell in a 3 x 3 grid with their respective tokens (either X or O). When one player has placed three tokens in a horizontal, vertical, or diagonal row on the grid, the game is over and that player has won. A stalemate occurs when all the cells on the grid have been filled with tokens and neither player has achieved a win. Write a program...

  • In a game of Tic Tac Toe, two players take turns making an available cell in...

    In a game of Tic Tac Toe, two players take turns making an available cell in a 3 x 3 grid with their respective tokens (either X or O). When one player has placed three tokens in a horizontal, vertical, or diagonal row on the grid, the game is over and that player has won. A stalemate occurs when all the cells on the grid have been filled with tokens and neither player has achieved a win. Write a program...

  • This is my code for a TicTacToe game. However, I don't know how to write JUnit...

    This is my code for a TicTacToe game. However, I don't know how to write JUnit tests. Please help me with my JUnit Tests. I will post below what I have so far. package cs145TicTacToe; import java.util.Scanner; /** * A multiplayer Tic Tac Toe game */ public class TicTacToe {    private char currentPlayer;    private char[][] board;    private char winner;       /**    * Default constructor    * Initializes the board to be 3 by 3 and...

  • C programming language Purpose The purpose of this assignment is to help you to practice working...

    C programming language Purpose The purpose of this assignment is to help you to practice working with functions, arrays, and design simple algorithms Learning Outcomes ● Develop skills with multidimensional arrays ● Learn how to traverse multidimensional arrays ● Passing arrays to functions ● Develop algorithm design skills (e.g. recursion) Problem Overview Problem Overview Tic-Tac-Toe (also known as noughts and crosses or Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the...

  • JAVA TIC TAC TOE - please help me correct my code Write a program that will...

    JAVA TIC TAC TOE - please help me correct my code Write a program that will allow two players to play a game of TIC TAC TOE. When the program starts, it will display a tic tac toe board as below |    1       |   2        |   3 |    4       |   5        |   6                 |    7      |   8        |   9 The program will assign X to Player 1, and O to Player    The program will ask Player 1, to...

  • This is my code for my game called Reversi, I need to you to make the...

    This is my code for my game called Reversi, I need to you to make the Tester program that will run and complete the game. Below is my code, please add comments and Javadoc. Thank you. public class Cell { // Displays 'B' for the black disk player. public static final char BLACK = 'B'; // Displays 'W' for the white disk player. public static final char WHITE = 'W'; // Displays '*' for the possible moves available. public static...

  • This task involves constructing a Java program that supports interaction via a graphical user interface.The object...

    This task involves constructing a Java program that supports interaction via a graphical user interface.The object is to implement a Scrabble graphical game. The basis for the game is quite simple. Presented with a 6x6 grid of Scrabble tiles, the challenge is for the player(s) to form as many high scoring words as possible.  Words may only be formed from sequences of adjacent tiles.  Two tiles are adjacent if their edges or corners meet.  A tile may...

  • IN JAVA. Write a program that lets the user play the game of Rock, Paper, Scissors...

    IN JAVA. Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT