Creating a simple chess program

Assignment Help JAVA Programming
Reference no: EM132316531

JAVA Assignment -

For this assignment you will start creating a simple chess program. Your program will consist of 11 java files in 3 packages: In package until1228

  • Menu.java
  • Utilities.java

You will not need to change anything in until1228 (as long as it was working for the last assignment). In a package named a05

  • ChessDriver.java will be the main file for this assignment. Provided this file below, notice how it uses the Menu class you created in the last assignment.

In a package named chess:

  • Piece.java an abstract class representing a chess piece. All the chess pieces will inherit from this class.
  • Has 2 protected boolean instance variables one for the color of the piece and one that tracks if the piece has been moved yet.
  • Has 2 protected integer instance variable representing the coordinates of the piece.
  • Has a protected Board instance variable that is a reference to the board the piece is on.
  • Has a 4 parameter constructor which takes the board, a boolean for its color, and 2 integers for its coordinates. The constructor should also initialize the boolean hasBeenMoved to false.
  • Has a move method that takes 2 integer parameters and moves the piece to that location if such a move is a valid move.

If there is already a piece at the destination location that piece will be removed from the board.

  • Has an abstract boolean method isValidMove which takes 2 integer parameters and returns true if the piece can move to that location.
  • Has an abstract char method getSymbol that takes no parameters and returns the symbol of the piece (k for King, q for Queen, r for Rook, b for Bishop, n for Knight, p for Pawn).

If the piece is white the symbol should be uppercase, if the piece is black the symbol should be lowercase.

  • King.java, Queen.java, Rook.java, Bishop.java, Knight.java, Pawn.java
  • Each has a 4 parameter constructor which takes the board, a boolean for its color, and 2 integers for it coordinates. This constructor can just make use of the Piece constructor.
  • Each has an implementation of the isValidMove method. For this week these methods will just always return true. (We will worry about fixing this to follow chess rules next week).
  • Each has an implementation of the getSymbol method which returns the correct symbol based on the piece type and color.
  • Board.java defines a chess board object.
  • Has a protected 8 by 8 2d array of Piece objects representing the positions on a chess board
  • Has a single zero parameter constructor that creates the 2d array and then creates all the pieces and puts them in their proper starting position in the array.
  • Has a display method that prints a representation of the board to the screen, the format for the display can be seen in the sample output.
  • Has a move method that moves a piece to a new location (using the move method of the piece). This method takes 4 parameters: coordinates of the piece and coordinates to move the piece to. The method will print error messages if the coordinates are not on the board or if there is no piece at the first coordinates location.

Attached a sample run of the program, note that coordinates on the board are ordered column then row. So 3 7 is column 3 and row 7.

IMPORTANT: You will submit a single .jar file make sure that:

1) The jar file runs. In project properties under run make sure the main class is set to a05.ChessDriver

2) The jar file includes all your source code. In project properties under packaging make sure .java files are not excluded.

Attachment:- Assignment Files.rar

Reference no: EM132316531

Questions Cloud

Outline techniques for dealing with customers : Outline techniques for dealing with customers including customers with specific needs.
Submit complete case analysis of case in drucker : Complete and submit your case analysis of Case 2 in the Drucker, Peter F. (2009). Management Cases, Revised ed. New York, NY: Collins Business,
Case - detect excessive shock using phones sensor data : Calculate the time of operation between each stop and start - identify the orientation of the phone to display in debug - Process of app deployment
Determine for the month of march cost per equivalent unit : Alpha Company, on March 1, 2017 has a beginning Work in Process inventory of zero. All materials are added into production at the beginning.
Creating a simple chess program : JAVA Assignment - For this assignment you will start creating a simple chess program. Your program will consist of 11 java files in 3 packages
Discuss the individual reflection assignment : Discuss the Individual Reflection Assignment, Individual Reflection Assignment, Individual reflective journal
Discuss the steps involved in the audit planning process : Explain the incentives, opportunities and attitudes the auditor should be aware of in considering the risk of misappropriation of asset fraud.
Develop future state value stream map for the service : Develop a future state value stream map for the service(Human service). Reflect on the challenges encountered when developing the future state map.
What are the weapons of competition : What are the "weapons of competition" that rival companies in your industry (UBER) can use to gain sales and market share?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Prepare a program for sorted list

Code a doubly links, sorted list (in ascending order). Each item of the list will just store int. You need to code three classes: Node, SortedList, and GroupProject

  Define an enum type in the librarybook class

Define a class variable, totalTVs, whose purpose is to keep track of the total number of Television objects constructed during execution of a program that uses the Television class - Define an enum type in the LibraryBook class corresponding to the..

  Create a class called employee with name idno address and

create a class called employee with name idno address and phone number as attributes. create the setter and getter

  What is object in javascript

Q1 What is Object in JavaScript ? Q2 Write one purpose of using spreadsheets? Q3 Write one purpose of using spreadsheets?

  A simple database in c language using file hadling

Provide a simple database in C language using file hadling for Blood Bank Management which creates a file in which we can read , write , apend.

  Write a program that plots a bar chart for comparing mtbfs

Write a program that plots a bar chart for comparing the MTBFs of different elevator models. The data to be displayed is prepared in a file: Each line consists of the model's letter and the MTBF that has been measured for that file.

  Creat a class that saves the grades

Creat a class that saves the grades of students in an array, and contains a few methods that do some statistics on these grades. Your task is to create this class, and create client testing class that does all the necessary tests of its methods.

  Modify the given program to use a loop to output

This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height

  Produce a java implementation of the gui

For your Assignment 2 Part 1 submission you are required to produce a Java implementation of the GUI for the Agriculture image viewer component of your overall Agriculture File Storing and Management (FSM) System.

  What are the benefits of documenting

What are the benefits of documenting our programs in Java?

  Use of width and height attributes in an element

Which of the following will occur if you do not use the width and height attributes in an element?

  Write a program displaying a text file that is in a text are

Write a program displaying a text file that is in a text area. The user enteres a file name in a text field and clicks the view button; the file is then displayed in the text area. Do not use BufferedInputStream.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd