Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am simply posting this again to get a second opinion to bounce stuff informaiton and ideas off of. I need to make a checkers

I am simply posting this again to get a second opinion to bounce stuff informaiton and ideas off of. I need to make a checkers board in JAVA, The main idea is

create 3 classes

Board

Square Piece

Board Class:

Design Board owns the squares. The board will create and manage the squares. The squares will contain, but wont exclusively own the Pieces. But theyll be our holders. Pieces for now will be very simple a name and 1 function. See functions below.

Board (Something like this but willl need colors)

/* String[][] grid = new String[8][8];

for (int i = 0; i < 8; i++) {

for (int j = 0; j < 8; j++) {

grid[i][j] = (i + 1) + "_" + (j + 1);

}

}

for (int i = 0; i < 8; i++) {

for (int j = 0; j < 8; j++) {

System.out.print(grid[i][j] + " ");

}

System.out.println();

} */

Variables:

Squares

Functions:

SetPieceOnSpace

Takes a piece as input

Sets the piece on given coordinates

RemovePieceFromSpace

Takes coordinates as input

Removes the piece at those coordinates and places an Empty piece now

Constructor

Sets the board by default for every board we create

Square

Variables:

Piece

Functions:

GetPiece

Returns the piece on the square

SetPiece

Sets a piece on the square

Takes a piece as input

Constructor

Generic constructor

Specific constructor Piece

Points ( black and white pieces) or what ever color you have facing each other

Variables (total pieces / aka piece count pet side)

Name

Color

Functions: ( doesnt have to work like a checkers board just needs to be set up with pieces as such) Needs ability to replace pieces code like this to replace a square with user input)

Move /*

int x = Integer.parseInt(newCoordinates[0]) - 1;

int y = Integer.parseInt(newCoordinates[1]) - 1;

String temp = grid[x][y];

grid[x][y] = grid[a][b];

grid [a][b]= temp; */

As long as the piece move to the coordinates specified youve meet the criteria.

Objective: youll setup the board, display it, and ask the user to type a piece name, enter coordinates to move that piece. Remove the piece from its original position, replacing it with an empty, and placing it on the new square. Youll then print the board, and ask the user if theyd like to keep going or quit.

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

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago