Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Four in a Row CS-151 Extra credit Due Date: 19 April 1:40pm (before class) Value: Basic 5pts, Advanced 10pts Assignment: Create a FourInARow game


imageimage

Four in a Row CS-151 Extra credit Due Date: 19 April 1:40pm (before class) Value: Basic 5pts, Advanced 10pts Assignment: Create a FourInARow game (similar to Connect 4, Hasbro). You are provided with a graphics driver class "Game.java" which has the following UML: Game - SEPARATION: int=30 DIAMETER: int 60 -gameSize: int grid: int[][] + Game(): void + setSpot(int int.inc): void + setGrid( int[][]): void Game.java is controlled by a 5x5 2 dimensional array. Creating a Game object will start the graphics and open a window with the game: Once the graphics window is created, you will need to mouse click inside the terminal window to re-focus that window for text entry. o set Grid(int [][]) You will need to use a 2D array of int[ ] [ ] to keep track of the game. You can update the graphics using either: o setSpot(int x, int y, int value) int x and int y are the cartesian coordinates of the game spot to update. Value is the player to assign that spot (1: CCSUblue, 2:red) you can pass a 5x5 2 dimensional array with the following values: . 0: Empty space 1: Player 1 (CCSUblue) 2: Player 2 (red) Basic Requirements (5 pts): Create a class which runs a single game. Each game turn asks the next player for what column they choose and must include input validation to handle bad input, then update the game graphics appropriately. After each turn check for winning conditions (many if statements) and announce a winner or go to the next turn. Advanced Requirements (5 additional points, for 10 total): All basic requirements Keep track of wins by each player Show a menu to play another game, reset scores, or exit. Files: You are provided with the following files: Game.java Graphics driver. UML and discussion above. FourInARowBasic.class, FourInARow Advanced.class These files are provided to give you an example of the finished project in operation. You can run these by saving them to your folder and using the command line to execute them (they are already compiled). Your completed project should operate similar to the solutions given. If you choose to try the advanced version, I recommend you do the basic version first and once it's working then add the additional features for the advanced version.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting Tools for Business Decision Making

Authors: Paul D. Kimmel, Jerry J. Weygandt, Donald E. Kieso, Barbara Trenholm, Wayne Irvine

7th Canadian edition

1119368456, 978-1119211587, 1119211581, 978-1119320623, 978-1119368458

More Books

Students also viewed these Computer Network questions