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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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