What horizontal row the chip is sitting in the chip may


Assignment: Structured Programming Using Procedural Languages

Project

For your second project, you are going to write a simple program. You are going to design game that has a "chip" that will move on the game's "board". Like the DotCom object we built in our Week Six Lab, the game will not have any graphical elements. Instead, the program will communicate to the user via the monitor what actions need to be done (i.e., the board must be imagined by the user). After each action of the chip on the board, the program will respond if it was successful or not.

The size of the board in this game is 64 square locations. So, each side of the board has 8 rows of spaces we can place the chip. A visualization of the board and a chip:

Now, the only thing this chip is going to do is move around the board. The chip has rules about its movement and you will have to develop the algorithms to move the chip as described:

1. The chip will start by being "placed" on one location on the board (like above).

a. When being placed on the board, the new chip will need to know:

i. The number of total squares in the board.

ii. What horizontal row the chip is sitting in.

iii. What vertical row the chip is sitting in.

2. The chip may move in any direction on the board: horizontally, vertically, or diagonally.

a. When the chip moves in a vertical or horizontal direction, it moves 2 spaces in that direction.

b. When the chip moves in a diagonal direction, it moves 1 space in that direction.

3. The chip may not move off the board. If an attempt to move off the board occurs, the chip will move as far as it can and then stop at the board's edge.

4. Each time the chip moves, a message will be display to the screen (i.e.; System.out). There are two types of messages that will be displayed; if the move worked or if it bumped into an edge.

a. When a move is successful, the message "Good Move" will be displayed to the user.

b. When a move is not successful, the message will tell the user what edge of the board they bumped into.

i. "Hit left edge"

ii. "Hit right edge"

iii. "Hit top edge"

iv. "Hit bottom edge"

c. In addition to being displayed to the screen, the same message will also be returned to the method's caller (i.e., via a String object).

5. The chip will answer what row it is on for the horizonal or vertical direction when asked.

As you did in Project one, you are going to have to create a tester program to test out all the different algorithms you created in you class. But this time, you do not need to submit that program. I am only going to be assessing your "Chip" class for this project. Make sure you test out all the functionality that you design. I have my own tester program that is going to call your class. It will test out all the functionality requested when I am grading.

Just to reiterate what I have said, there are going to be many ways to solve this problem. That is fine and expected. We all see things within our environment differently, and that characteristic is more of a benefit in a team of programmers, than a negative.

Do not wait to start this assignment. This might seem simple on the surface, but there is a lot of conditional decisions to make it work as described. Spend time to map it out before doing to much coding of the process.

What to turn in:

1. A digital copy of your Java source code (submitted via Sakai as an attachment). For this first assignment, please submit the source code for the class you created. You can attach the file you created to Sakai. You also can place it in a zip file if you wish. Please do not submit your source code pasted in a Word document. Text files only (.java or .txt).

Attachment:- Project.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: What horizontal row the chip is sitting in the chip may
Reference No:- TGS02712698

Expected delivery within 24 Hours