JAVA project

profilebhihu45
project.docx

Purpose:

The purpose of this project is to provide non-trivial practice in the use of Java programming constructs discussed from the beginning of the course through Module 05 and have a bit of fun doing it.

Resources Needed:

You will need a computer system with Java 7 or greater SE edition run-time and JDK. You may optionally use a Java IDE for example NetBeans, Eclipse, etc. However application builders are not allowed.

Submitted Files:

Design and Analysis:

This word-processed document is required to be written in APA style minus the Abstract section. The file formats accepted will be announced at project assignment. The length of the document should be between 1.5 and 2 pages plus a reference section. The following subjects should be discussed in this order:

1. General program design. How is the program organized? What major data structures were used? How are commands processed? How is the PacMan’s state maintained? Etc.

2. What alternative approaches were considered and why were they rejected?

3. What did you learn from doing this project and what would you do differently?

Source file:

All Java source will be in a single text file which can be compiled and executed in a standard Java 8 or later SE environment. Multiple methods can be used but all user-created methods must be contained in the single Java text file.

The format of the Java source must meet the general Java coding style guidelines discussed so far during the course. Please use course office hours or contact the instructor directly if there are any coding style questions.

Submit file:

The submit file is to be a Zip file containing both your design and analysis document and your single Java source text file. Any appropriate file name for this Zip file is acceptable.

Program Specification:

1. Create a new Java program which implements a simple PacMan-type text game which contains the following functionality:

A) At program startup, constructs and displays a 2-dimensional grid with the size dynamically specified by the user (X and Y sizes can be different). Places the PacMan in the upper-left corner of the grid facing left All grid cells should have the empty cell character of ‘.’ except for the start position of the PacMan which will have the appropriate PacMan symbol (see below). Also 10% of your grid should contain cookies randomly located on the grid except for the initial PacMan position. The grid must be displayed after each command.

B) Use these symbols for the grid:

1. Cookie symbol – shows were cookies are in the grid ('O')

2. Empty symbol – shows empty unvisited grid cells ('.') (dot)

3. Visited symbol – shows grid cells where the PacMan has visited (' ') (space)

4. PacMan symbol depends on the current PacMan facing direction.

1. Left ‘>’

2. Up ‘V’

3. Right ‘<’

4. Down ‘^’

C) A menu of commands must be provided and must be displayed when appropriate. At a minimum the menu should consists of the following commands (the command number is what the user should enter to execute the command):

1. Menu – Display the menu of commands.

2. Turn Left – turns the PacMan left (counter-clockwise) but the PacMan stays in its current location

1. Current: up, new: left

2. Current: right, new up

3. Current: down, new right

4. Current: left, new down

3. Turn Right – turns the PacMan right (clockwise) but the PacMan stays in its current location

1. Current: up, new: right

2. Current: right, new down

3. Current: down, new left

4. Current: left, new up

4. Move – Moves the PacMan one grid location in the facing direction if possible.

5. Exit – exits the program displaying the game statistics of the number of total moves and the average number of moves per cookie obtained.

2. The main processing cycle is the following:

A) The grid must be displayed after each command showing the effects of the command.

B) Optionally display the list of commands

C) Display the grid

D) Accept user input. Code will be provided for reading user input.

1. If an invalid command is entered, an appropriate error message should be displayed and the

menu of commands and grid gets redisplayed. An invalid command does not count as a command in the statistics.

2. Process the command and add one to the number of commands entered if it is an action command (move or turn).

3. If the user enters the Exit command, the program will display the number of commands and the average number of commands per cookie.

E) If the resulting move places the PacMan over a cookie, indicate the cookie was eaten and add one to the number of cookies eaten for the program statistics.

3. Observe the PacMan demonstration for an example of one implementation.

4. Create a compressed zipped folder containing your Design and Analysis document and your Java source file.

5. Submit your compressed zipped folder as directed by your instructor.

Assessment:

60%

70%

80%

90%

100%

Weight

Design &

Majority

All but one

All document

All

All document

20%

Analysis

document

document

subjects

document

subjects

Document

subjects

subject

covered with

subjects

covered with

covered with

covered

accurate

covered

insightful

accurate

with

information.

with

and accurate

information.

accurate

Maybe some

insightful

information.

Some fluff.

information

fluff.

and accurate

Document is

Document is

. Maybe

Document is

information.

of specified

over half the

some fluff.

close to the

Document is

length and

specified

Document

specified

of specified

properly

length with 2-4

is close to

length with

length with

formatted to

minor APA

the

1-3 minor

1-3 minor

APA style.

style or other

specified

APA style or

APA style or

minor issues.

length with

other minor

other minor

2-4 minor

issues.

issues.

APA style

or other

minor

issues.

Program

All but two

All but one

All but two

All but one

All specified

55%

Correctness

major specified

major

minor

minor

features work

features work

specified

specified

specified

with neat and

but a noble

features

features

features

easy to

effort is made.

work but a

work. For

work. For

understand

For example

noble effort

example the

example the

information

the PacMan

is made.

PacMan

PacMan

display.

will not move

For

facing is not

facing is not

up or down the

example

always

always

grid and the

the

correct or the

correct or

PacMan can

PacMan

display of the

the display

move off the

will not

grid is a little

of the grid is

grid.

move up or

off.

a little off.

down the

grid or the

PacMan

can move

off the

grid.

Code Style

Most

Most

Most

Functionalit

Functionality 25%

functionality

functionalit

functionality

y properly

properly

not properly

y properly

properly

segmented

segmented

segmented into

segmented

segmented

into

into methods.

methods.

into

into methods.

methods.

All variable

Some variable

methods.

Most

Most

use proper

use proper

Most

variable use

variable use

names and

names and

variable

proper names

proper

types.

types. Some

use proper

and types.

names and

Appropriate

commenting.

names and

Appropriate

types.

commenting.

Some use

types.

commenting.

Appropriate

Proper

proper

Some

Mostly use

commenting

indentation

indentation

commentin

proper

. Mostly

line

line

g. Some

indentation

use proper

continuation,

use proper

line

indentation

etc.

indentation

line

line

If you have any questions about the specification of this project, contact your instructor before the project is due.