March 5, 2005
     

Program / Task Name:

   PacMan

Level:

 

 Novice / Advanced

Point Value:

 

 13

Solution(s):

 

 prob10.c

Data File(s):

 

 grid.in, prob10.in

 
C programmers: your program name must be: prob10.exe
JAVA programmers: your program name must be: prob10.class

 

Task Description

Given an input of a grid denoting the starting screen of a simple game of PacMan and an input file with a list of joystick commands (U = Up, D = Down, L= Left, R = Right), your program must calculate the ending score of the game.  Each specific crumb or fruit at a particular location in the grid may only be eaten once per game.

Characters in the grid:

PacMan = P

Ghost = @ (you lose! game over)

Wall = # (blocks movement)

Portal = ] or [ (sends Pacman to opposite side of grid)

Crumb = . = 1 pt.

Target = * = 10 pts

Cherries = % = 25 pts

Watermelon = O = 50 pts

 

Program Input

Grid input file (grid.in):

 

Moves input file (prob10.in):

RUUURRRRRLLLLLLLL

 

Program Output

81 pts.

 

 

   
  (c) 2005 Hewlett-Packard Company