Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 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 15% 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. 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 a move command. 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

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: 1. General program design. How is the program organized? What major data structures were used? How are commands processed? How is the PacMans 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). 2. What alternative approaches were considered and why were they rejected?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

How would you expect a recession to affect asset management ratios?

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago