The program: Dungeon Generator

  • Due May 4th (Thur.), 2017, 11:59pm

Files

The following script is used to generate these random dungeons.

#!/bin/bash
for i in `seq 5 100`;
do
    java MakeDungeon $i 3 > dungeon_$i.txt
done

Change logs

  • Example output provided on April 29.
  • A bug is fixed in PA004-v2.7z on April 26.
  • Assignment created on April 20, 2017, at 0:11 AM

Description

  • Use union-find data structure to randomly generate dungeons that can be used in PA002.
  • The main challenge is to ensure that all rooms are connected by the corridors.
  • In this assignment, you have 4 main tasks
    1. Creating R disjoint rooms, here R is a user parameter
    2. Creating a corridor connecting a pair of rooms. The corridor simply is shortest Manhattan path connecting the centers of the rooms.
    3. Joining all rooms passed by a given corridor
    4. Placing the monster and rogue in random room sites.

Example output

This is what you should see when you run the given code without modification. (note: the given code uses random number generator, so you will see a different dungeon)

| => java MakeDungeon 40 10
40








                                                                        M       
                                    @                                           
          . . . . . . .                                                         
          . . . . . . .                                                         
          . . . . . . .                                                         
          . . . . . . .                             . . . .                     
          . . . . . . .                             . . . .                     
          . . . . . . .                             . . . .                     
                        . . . . . . . . . . . . . . . . . .                     
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                        . . . . . . . . . . . . . . .                           
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
                                      . . . . . . . . . . . . . .               
                                      . . . . . . . . . . . . . .               







Copyright: created by jmlien on 2017.04.20 AD at 00:19:17

To hand in

You will submit on blackboard.

  • Your submission should include your (well organized and well commented) source cod
  • Complete README.txt
  • You should include both source code and a binary called "310pa4.jar".
  • A terminal session showing you running your program with sample input that will be posted on this website
  • Your should zip all the files in a file called "PA4.Firstname.Lastname.zip"
  • Your TAs should be able to run your program by typing: "java -jar 310pa4.jar"

Rubrics

  • Create R rooms and make sure that all rooms are disjoint (20%)
  • Create a corridor connecting two rooms r1 and r2 if r1 and r2 are not already connected (20%)
  • Given a corridor, connect all the rooms that the corridor passing by (40%)
  • Find a random site in the room (10%)
  • README.txt 5%
  • Code organization/comments 5%
  • Total points: 100