Creating Maze using java GUI

Closed Posted Oct 25, 2007 Paid on delivery
Closed Paid on delivery

The Work is to develop a Java application that is capable of drawing a maze. This maze can be navigated and edited by the user. Additionally, some ??rats?? (from none to two, inclusive) may roam around the maze.

## Deliverables

This will be a graphical application (not an Applet) that draws a maze that can be navigated by a single user. Maze data is stored in human readable text files that the application reads. See the maze data file specification (below) for more information on the file format. When the program first starts, no maze is shown. A maze file will need to be loaded before anything is shown. Once a data file is loaded, the maze is drawn on the screen using Java Graphics. The starting and finishing positions will be indicated on the map. The current position of the user should also be indicated on the map. Initially the user will begin at the indicated starting position for that map. If the application window is resized, the maze should automatically scale itself to fit the new size. User movements are controlled by mouse clicks on the map and must follow some simple rules. The user may only move one square at a time. The user may only move to an adjacent square. The user may only move vertically or horizontally. (No diagonal movement is permitted.) The user cannot move through walls. If the user attempts to make an illegal move, a dialog box should warn the user (e.g.: “Illegal move! Try again.??), and the move should be ignored. If a wall blocks the move, a similar dialog should be displayed warning the user (e.g.: “Move blocked by wall!??) and the move ignored. Once a user has visited a maze square, the background colour for that square will change indicating that it has been visited. When the user reaches the marked finishing position, a dialog will be displayed indicating how many moves the user took to reach the finish. A small number (0-2) of “rats?? may also be wandering around the maze. Rats move randomly every time the user moves. The user cannot control the rats in the maze. Rats never collide with walls (they always make legal moves) and no error messages need to be shown for the rats, but rats must obey the same rules for movement as the user. The rats and the users never interact with each other, therefore the user can be in the same square as a rat with no errors. Menus:- The application will provide three menus: 1. File 2. Options 3. Help The “Load?? option will display a file-choosing dialog. Once an appropriate maze data file is selected, the maze will then be loaded and displayed. The “SaveAs?? option displays a file choosing dialog that allows the user to save the currently loaded maze as a new maze data file. The Play radio button changes the game into Play mode. In Play mode, the user can navigate the maze. The Edit radio button changes the game into Edit mode. In Edit mode, the user can change the position of walls in the maze. The Exit option will shutdown the application. If the current loaded maze file has been edited, the application will prompt the user to confirm the exit action. The same prompt will also be displayed if the user attempts to quit the application using the x button in the top right corner of the application window without saving. “Play Mode?? is the default mode for the game. Options Menu:- The Options menu allows the user to select how many computer controlled “rats?? will be in the maze. The available options are: “no rats?? “one rat?? “two rats??. “No Rats?? is the default option. Help Menu:- When the Help menus About button is pressed, a modal dialog will display the name of the application, the authors name and the version number. When the Help menus Help option is selected, a dialog will be shown that explains how a user can navigate the maze. This information should be kept in a separate text file that the dialog loads and displays. Note: You are not required to make your version of the assignment look identical to the screen shots provided. However, your assignment must provide the same functionality. Ant:- Your Ant script (“[url removed, login to view]?) for this assignment should include the usual “build??, “run??, and “clean?? targets. It should also contain a “dist?? target that creates a distributable version of your assignment. This distributable should be a self-executable JAR file of your assignment. Don’t forget to include any “[url removed, login to view]? files your program might need inside the JAR. Maze data files don’t need to be included in the JAR. Maze Data File Specification The maze file consists of three parts. Maze dimensions Start and Finish positions Maze data Maze dimensions The first line of the maze file contains the maze dimensions specified as (columns) (rows). The two values are separated by a space. The maze may be of an arbitrary size, so it should not be assumed that the values will be single digits: They may be more (e.g. a 15 by 10 Maze). Start and Finish positions The second line of the maze file describes the start and finish positions. The start and finish positions are represented by two pairs of numbers. The first pair represents the start position as (start column) (start row). The second pair similarly represents the finish column and the finish row. Note that each number is space separated. In a large maze, the start or end coordinates might be larger than single digit numbers. Maze data Finally the maze data is represented as pairs of numbers indicating the presence of the east and south walls, in that order, for each room in the maze. Each row of data in this section represents a row of cells/rooms in the maze. Each pair of numbers in a row represents one cell/room. In this section, the value 0 indicates no wall is present. The value 1 indicates that a wall is present. Each pair is space separated to make it easier to read, but the paired numbers are not separated. This is because they can only ever be single digit numbers (0 or 1). Format Maze data must be stored as text data (not binary) and the file should have the “.txt?? extension. Maze files may have any name. Example maze data file (“[url removed, login to view]?) … 6 5 0 0 3 2 10 00 01 01 01 10 10 10 00 01 10 10 10 10 01 11 10 10 10 01 01 01 11 10 01 01 01 01 01 11

## Platform

Windows XP ,java

Engineering Game Consoles Game Design Java MySQL PHP Software Architecture Software Testing

Project ID: #3415209

About the project

Remote project Active Nov 6, 2007