Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Maze Class You shall define the Maze class. The maze is a 20 x 50 matrix represented by a 2-dimensional Entity array (The Entity

  1. The Maze Class

You shall define the Maze class. The maze is a 20 x 50 matrix represented by a 2-dimensional Entity array (The Entity Class is defined in the next paragraph). Walls in the maze are represented by * and empty positions by blank spaces. The maze shall be read from a text file Maze.txt (The Maze.txt file is provided). A squirrel is able to move to empty spaces in the maze.

**************************************************

******************** **********************

******************** **********************

******************** **********************

*********** ***********

*********** ***********

* **

* **

* **

* ********************** **

* ********************** **

* ********************** **

* ********************** **

* **

* **

* **

***** ************** ********

************ *************

***** *********

**************************************************

The Maze class defines the following attributes:

  1. Max_Maze_Row: This class variable is a constant variable that defines the maximum number of rows in the maze (it should be set to 20 rows).
  2. Max Maze Column: This class variable is a constant variable that defines the maximum number of columns in the maze (it should be set to 50 columns).
  3. maze[][] : This class variable shall be defined as a 2-dimentional Entity array that contains the full maze and the entities.

The Maze class implements the following methods:

public static void create(String filename)

This method reads the file passed to the method (e.g. Maze.txt) and initializes the 2-dimentional array with the maze content provided in the file.

public static void display()

This method displays the maze structure and the containing entities.

public static boolean available(int row, int col)

This method takes a row and a column and determines if the location is a blank space. If it is, it returns true; otherwise, it returns false.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic management concepts

Authors: Fred david

13th Edition

9780136120988, 136120997, 136120989, 978-0136120995

Students also viewed these Databases questions

Question

An effective clustering methods produces clusters with

Answered: 1 week ago