Write a program that takes a command line parameter

Assignment Help JAVA Programming
Reference no: EM132081369

You need question number 6 answered, but You do know that question #6 referenced #5 so that is why You supplied you with question #5.

5. Perfect maze. Generate a perfect maze like this one

14-by-14 perfect maze 22-by-22 perfect maze

Write a program Maze.java that takes a command line parameter N, and generates a random N-by-N perfect maze.

A maze is perfect if it has exactly one path between every pair of points in the maze, i.e., no inaccessible locations, no cycles, and no open spaces. Here's a nice algorithm to generate such mazes.

Consider an N-by-N grid of cells, each of which initially has a wall between it and its four neighboring cells.

For each cell (x, y), maintain a variable north[x][y] that is true if there is wall separating (x, y) and (x, y + 1). We have analogous variables east[x][y], south[x][y], and west[x][y] for the corresponding walls.

Note that if there is a wall to the north of (x, y) then north[x][y] = south[x][y+1] = true. Construct the maze by knocking down some of the walls as follows:

a. Start at the lower level cell (1, 1).

b. Find a neighbor at random that you haven't yet been to.

c. If you find one, move there, knocking down the wall. If you don't find one, go back to the previous cell.

d. Repeat steps ii. and iii. until you've been to every cell in the grid.

Hint: maintain an (N+2)-by-(N+2) grid of cells to avoid tedious special cases.

6. Getting out of the maze. Given an N-by-N maze (like the one created in the previous exercise), write a program to find a path from the start cell (1, 1) to the finish cell (N, N), if it exists. To find a solution to the maze, run the following algorithm, starting from (1, 1) and stopping if we reach cell (N, N).

explore(x, y)

-------------

- Mark the current cell (x, y) as "visited."

- If no wall to north and unvisited, then explore(x, y+1).

- If no wall to east and unvisited, then explore(x+1, y).

- If no wall to south and unvisited, then explore(x, y-1).

- If no wall to west and unvisited, then explore(x-1, y).

Reference no: EM132081369

Questions Cloud

Shares traded in the public securities market : Make-it Corporation has shares traded in the public securities market. Under the Securities Act of 1933, which one of the following is a security?
Discuss whether the verbal statement : Discuss whether the verbal statement and the writing on the napkin by two different CEO would be considered a valid and enforceable contract.
Create some jobs to control show the multi - tasking : Create some jobs - Type "cat" command in the terminal , and press ctrl - c to terminate it. Type "jobs" command and you will see nothing.
Discuss whether either a verbal statement or the writing : Discuss whether either a verbal statement or the writing on the napkin would fall under the Uniform Commercial Code (U.C.C.). Why or why not?
Write a program that takes a command line parameter : Write a program Maze.java that takes a command line parameter N, and generates a random N-by-N perfect maze.
Create a new project folder that will contain the helper : Create a new Project folder that will contain the 3 Helper classes: the PalindromeHelper, the ReversePoemHelper, and the AdoptAPetHelper.
Create an application which adds assignments : Which Adds, Edits, and Deletes assignments onto a storage medium, with grades per student-per assignment.
Compose a program that writes the coordinates of a random : Compose a program that writes the coordinates of a random point (a, b, c) on the surface of a sphere. To generate such a point, use Marsaglia's method.
Find the name of each trip containing the word pond : How many current reservations does Colonial Adventure Tours have and what is the total number of persons for all reservations?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd