Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is for a simple pacman type text game in java 1. Create a new Java program which implements a simple PacMan-type text game which
This is for a simple pacman type text game in java
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 20% of your grid should contain cookies randomly located on the grid except for the initial PacMan position. Amenu of commands then the grid must be displayed. 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 'N' 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 1. Turn Left turns the PacMan left 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 2. Turn Right - turns the PacMan right 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 3. 4. Move - Moves the PacMan one grid location in the facing direction if possible Exit - exits the program displaying the game statistics of the number of total moves and the average number of moves per cookie obtained
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started