Prog04 - Name George Corser Program CSC 375 Program...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//------------------------------------------------------------------------ // Name: George Corser // Program: CSC 375 Program 4 (Prog04.cpp) // Due Date: Friday, April 3, 2009 (04/3/2009) // Compiler: Bloodshed Dev-C++ 4.9.9.2 // // Comments: MAZE GENERATION (PARENT-POINTER GENERAL TREE) // // Two versions of this program, one using path compression and // the weighted union rule (VERSION 1, below) and the other using // neither (VERSION 2, below), require recompiling with the // respective header files, uf.h and ufs.h. (See below.) // // This program generates a maze based on command line input. // // prog04 rseed rowsize colsize // // where rseed is the random-number seed, rowsize is the number // of rows in the maze, and colsize is the number of columns. // Connections within the maze are determined by a parent-pointer // general tree representation implemented as an array. // The array is a dynamically allocated general tree, called gt. // Let D = (rowsize * colsize) be the dimension of the array (gt). // gt[0-(D-1)] - the array indexes of the node's parent // gt[D-(2D-1)] - north walls (0=open, 1=closed) // gt[2D-(3D-1)] - south walls (0=open, 1=closed) // gt[3D-(4D-1)] - east walls (0=open, 1=closed) // gt[4D-(5D-1)] - west walls (0=open, 1=closed) // // The walls for the beginning of the maze and the end of the // maze were deliberately omitted. The maze is assumed to begin // at 0,0 and terminate at (n-1, n-1). // //------------------------------------------------------------------------ #include <iostream> // for cout calls #include <iomanip> // for cout formatting, setw() #include <cstdlib> // for random number generation #include <stdlib.h> #define TRUE 1 #define FALSE 0 #define ROOT -1 #define RAND_ROW 0+(int) (((float) rowsize) *rand()/(RAND_MAX+1.0))
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Prog04 - Name George Corser Program CSC 375 Program...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online