Please do the following to complete this assignment.
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.
You will need a computer system with Java 8 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.
Design and Analysis:
This word-processed document is required to be written in APA style minus the Abstract section. The file format can be ODT, PDF, DOC, or DOCX. 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:
- 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. This section should take about ½ to 2/3 of the paper content. Do not repeat the project specifications (assume the reader is knowledgeable of the project specifications).
- What alternative approaches were considered and why were they rejected?
- What did you learn from doing this project and what would you do differently?
All Java source will be in a single text file containing a single public class which can be compiled and executed in a standard Java 8 or later SE environment. Multiple methods can be used but all usercreated methods must be in a single Java public class 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.
The submit file is to be a Zip file containing both your design and analysis document and your single Java source text file. Name your Zip file MiniProject1_<Blackboard ID><Section Number> for example: MiniProject1_jdealjr182.zip (note with Windows the .zip extension is added automatically).
It is encouraged to discuss technical or small design parts of this project with your fellow students.
However the resulting design and implementation must be your own. For example, it is acceptable to discuss different ways of maintaining the PacMan state but not detailed design or implementation information on processing the Move command. When in doubt, ask during office hours or contact your instructor.
- Create a new Java program which implements a simple PacMan-type text game which contains the following functionality:
- At program startup, constructs and displays a 2-dimensional grid using standard array(s) (no collection classes allowed) 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 8% of your grid (rounded down if necessary) should contain cookies randomly located on the grid except for the initial PacMan position. The grid must be displayed after each command.
- Use these symbols for the grid:
- Cookie symbol – shows were cookies are in the grid (‘O’)
- Empty symbol – shows empty unvisited grid cells (‘.’) (dot)
- Visited symbol – shows grid cells where the PacMan has visited (‘ ‘) (space)
- PacMan symbol depends on the current PacMan facing direction.
- Left ‘>’
- Up ‘V’
- Right ‘<’
- Down ‘^’
- The following menu of commands must be provided and must be displayed when appropriate. The command number is what the user should enter to execute the command. Just display the command number and text (ex. 1: Menu), not the explanation of what the command does:
- Menu – Display the menu of commands.
- Turn Left – turns the PacMan left (counter-clockwise) but the PacMan stays in its current location
- Current: up, new: left
- Current: right, new up
- Current: down, new right
- Current: left, new down
- Turn Right – turns the PacMan right (clockwise) but the PacMan stays in its current location
- Current: up, new: right
- Current: right, new down
- Current: down, new left
- Current: left, new up
- Move – Moves the PacMan one grid location in the facing direction if possible. Adds one to the count of move commands if successful or not. If the move command is successful, the previous location is replaced with Visited Symbol (see above). If the move command results in the PacMan moving to a cell where a cookie is located, the cookie is “eaten” and the number of cookies eaten is increased by one.
- Exit – exits the program displaying the game statistics of the number of total moves and the average number of moves per cookie obtained.
- The main processing cycle is the following:
- The grid must be displayed after each command showing the effects of the command. B) Optionally display the list of commands
- Display the grid
- Accept user input. Code will be provided for reading user input.
- If an invalid command number 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.
- Process the command and add one to the number of move commands entered if it is a move command.
- 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.
- Observe the PacMan demonstration for an example of one implementation.
- Create a compressed zipped folder containing your Design and Analysis document and your Java
- Submit your compressed zipped folder as directed by your instructor. Assessment:
60% 70% 80% 90%
Design & Majority All but one All document All All document 15%
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 minor issues. length with other minor or other 2-4 minor issues. minor
APA style issues.
or other minor issues.
Program All but two All but one All but two All but one All specified 60%
Correctness major specified major minor minor features work
features work specified specified specified with neat and
Note: but a noble features features features easy to
Compilation effort is made. work but a work. For work. For understand
errors and For example noble effort example the example the information warnings are part the PacMan is made. PacMan PacMan display. of this will not move For facing is not facing is not evaluation. 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.
If you have any questions about the specification of this project, contact your instructor before the project is due.