Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing this code as practice for an exam, my code is very awful and I have no clue if I am doing it

Need help writing this code as practice for an exam, my code is very awful and I have no clue if I am doing it correcly, hence the question is to do the following:

These are all the files given:

***ArrayStack.java

/** * @author Lewis and Chase * * Represents an array implementation of a stack. */ public class ArrayStack implements StackADT { /** * constant to represent the default capacity of the array */ private final int DEFAULT_CAPACITY = 100; /** * int that represents both the number of elements and the next * available position in the array */ private int top; /** * array of generic elements to represent the stack */ private T[] stack; /** * Creates an empty stack using the default capacity. */ public ArrayStack() { top = 0; stack = (T[])(new Object[DEFAULT_CAPACITY]); } /** * Creates an empty stack using the specified capacity. * @param initialCapacity represents the specified capacity */ public ArrayStack (int initialCapacity) { top = 0; stack = (T[])(new Object[initialCapacity]); } /** * Adds the specified element to the top of this stack, expanding * the capacity of the stack array if necessary. * @param element generic element to be pushed onto stack */ public void push (T element) { if (size() == stack.length) expandCapacity(); stack[top] = element; top++; } /** * Removes the element at the top of this stack and returns a * reference to it. Throws an EmptyCollectionException if the stack * is empty. * @return T element removed from top of stack * @throws EmptyCollectionException if a pop is attempted on empty stack */ public T pop() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("Stack"); top--; T result = stack[top]; stack[top] = null; return result; } /** * Returns a reference to the element at the top of this stack. * The element is not removed from the stack. Throws an * EmptyCollectionException if the stack is empty. * @return T element on top of stack * @throws EmptyCollectionException if a peek is attempted on empty stack */ public T peek() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("Stack"); return stack[top-1]; } /** * Returns true if this stack is empty and false otherwise. * @return boolean true if this stack is empty, false otherwise */ public boolean isEmpty() { return (top == 0); } /** * Returns the number of elements in this stack. * @return int the number of elements in this stack */ public int size() { return top; } /** * Returns a string representation of this stack. * @return String representation of this stack */ public String toString() { String result = ""; for (int scan=0; scan < top; scan++) result = result + stack[scan].toString() + " "; return result; } /** * Creates a new array to store the contents of this stack with * twice the capacity of the old one. */ private void expandCapacity() { T[] larger = (T[])(new Object[stack.length*2]); for (int index=0; index < stack.length; index++) larger[index] = stack[index]; stack = larger; } } 

***EmptyCollectionException.java

/** * @author Lewis and Chase * * Represents the situation in which a collection is empty. */ public class EmptyCollectionException extends RuntimeException { /** * Sets up this exception with an appropriate message. * @param collection String representing the name of the collection */ public EmptyCollectionException (String collection) { super ("The " + collection + " is empty."); } }

***StackADT.java

/** * @author Lewis and Chase * * Defines the interface to a stack data structure. */ public interface StackADT { /** Adds one element to the top of this stack. * @param element element to be pushed onto stack */ public void push (T element); /** Removes and returns the top element from this stack. * @return T element removed from the top of the stack */ public T pop(); /** Returns without removing the top element of this stack. * @return T element on top of the stack */ public T peek(); /** Returns true if this stack contains no elements. * @return boolean whether or not this stack is empty */ public boolean isEmpty(); /** Returns the number of elements in this stack. * @return int number of elements in this stack */ public int size(); /** Returns a string representation of this stack. * @return String representation of this stack */ public String toString(); }

***Labyrinth.java

import java.io.*; import java.util.*; import javax.swing.JFrame; import javax.swing.JPanel; /** * The Labyrinth class creates a window that shows a hexagon-tile based Labyrinth.

* * The Labyrinth is built from a file with the following specifications:

*

    *
  • The first line has the number of rows and cols
  • * *
  • Each subsequent line (there will be the same number of lines as rows)
  • * * (Note: because this Labyrinth is based on hexagons, each alternating row is * offset from the left side by half a hexagon, indicated by a space in the input file) *
* * @author CS1027 * */ public class Labyrinth extends JFrame { private static final long serialVersionUID = 1L; //Characters used by the input and output files private static final char UNVISITED_CHAR = 'U'; private static final char TREASURE_CHAR = 'T'; private static final char END_CHAR = 'E'; private static final char START_CHAR = 'S'; private static final char WALL_CHAR = 'W'; private static final char END_PROCESSED_CHAR = 'G'; private static final char PROCESSED_CHAR = 'P'; private static final char PUSHED_CHAR = 'H'; private static final String MY_TITLE = "Labyrinth"; //Default time delay when repainting the Labyrinth to reflect hexagon changes public static final int DEFAULT_TIME_DELAY = 1; private int timeDelay = DEFAULT_TIME_DELAY; protected Hexagon start; private Hexagon[][] hexLabyrinth; /** * Constructor to build a Graphical Labyrinth with hexagonal tiles * from a file containing a Labyrinth specification * @param inFile * @throws UnknownLabyrinthCharacterException * @throws FileNotFoundException * @throws IOException */ public Labyrinth(String inFile) throws UnknownLabyrinthCharacterException, FileNotFoundException, IOException{ // set up GUI aspects of the Labyrinth component super("Labyrinth"); super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(); // set up the file reader and read the first line BufferedReader in; String line=""; in = new BufferedReader(new FileReader(inFile)); line = in.readLine(); // Tokenize the first line to get the row and column StringTokenizer lineTokens = new StringTokenizer(line); // First line is the number of rows then the number of columns int row = Integer.parseInt(lineTokens.nextToken()); int col = Integer.parseInt(lineTokens.nextToken()); // The hexagons form a linked structure, and we don't // use the 2D array for anything after building the labyrinth // .....except to output the result to a file hexLabyrinth = new Hexagon[row+2][col+2]; // HexLayout will arrange the Hexagons in the window p.setLayout(new HexLayout(row, col, 4)); // for each row for (int r = 1; r

***Hexagon.java

import java.awt.Color; /** * This class represents a pointed-top Hexagon tile used to make up a Maze object. * 

* Each tile has a type. It can be a Wall, Start, End, Unvisited, Visited or Pushed tile. * Each tile type will be a different colour: black, green, red, cyan, blue and magenta respectively. *

* Hexagon tiles know about their neighbors (if set using setNeighbor method). *

* The neighbors of a tile are accessed by an index 0-5 inclusive. *

    *
  • The hexagons are pointed-top in orientation, the 0 index is the upper-right side
  • *
  • Indexes for the sides progress incrementally clockwise from the 0 index, to 5 on the upper-left side *
* Eg.

* 5 / \ 0

* 4 | | 1

* 3 \ / 2

* @author CS1027 * */ public class Hexagon extends HexComponent { // constants private static final Color WALL_COLOR = Color.BLACK; private static final Color START_COLOR = Color.GREEN; private static final Color END_COLOR = Color.RED; private static final Color UNVISITED_COLOR = Color.CYAN; private static final Color PROCESSED_COLOR = Color.BLUE; private static final Color PUSHED_COLOR = Color.MAGENTA; private static final Color END_PROCESSED_COLOR = Color.ORANGE; private static final Color TREASURE_COLOR = Color.YELLOW; //enum to represent available hexagon types public static enum HexType{WALL, START, END, UNVISITED, PROCESSED, PUSHED, END_PROCESSED, TREASURE}; // Attributes private HexType type; // Stores the type of Hexagon this currently is private boolean isStart; // Is this the start? private boolean isEnd; // Is this the end? private Hexagon[] neighbors; // Stores the hexagons which surround this one on each of 6 sides /** * Create a Hexagon tile of the specified type * @param t the HexType to create */ public Hexagon(HexType t){ this.type = t; this.isStart = t==HexType.START; this.isEnd = t==HexType.END; //set the initial color based on the initial type this.setColor(this.type); //allocate space for the neighbor array this.neighbors = new Hexagon[6]; } /** * Set the neighbor for this hexagon using the neighbor index. * * The index for the neighbor indicates which side of the hexagon * this new neighbor is on. 0-5 inclusive. * * @param neighbor The new Hexagon neighbor * @param i The index specifying which side this neighbor is on (0-5 inclusive) * @throws InvalidNeighborIndexException When an index is specified that is not 0-5 inclusive. */ public void setNeighbour(Hexagon neighbor, int i) throws InvalidNeighbourIndexException{ if (0<=i && i <=5) this.neighbors[i] = neighbor; else throw new InvalidNeighbourIndexException(i); } /** * Returns the neighbor for this hexagon using the neighbor index * * The index for the neighbor indicates which side of the hexagon * the neighbor to get is on. 0-5 inclusive. * * @param i The index indicating the side of the hexagon this neighbor is on * @return The hexagon the is on the i-th side of the current hexagon, or null if no neighbor * @throws InvalidNeighbourIndexException When an index is specified that is not 0-5 inclusive. */ public Hexagon getNeighbour(int i) throws InvalidNeighbourIndexException{ if (0<=i && i <=5) return this.neighbors[i]; else throw new InvalidNeighbourIndexException(i); } /** * This method checks if the current hexagon is a Wall tile. * @return true if this is a Wall tile, false otherwise. */ public boolean isWall(){ return type == HexType.WALL; } /** * This method checks if the current hexagon is a Visited tile. * @return true if this is a Visited tile, false otherwise. */ public boolean isProcessed(){ return type == HexType.PROCESSED; } /** * This method checks if the current hexagon is an Unvisited tile. * @return true if this is an Unvisited tile, false otherwise. */ public boolean isUnvisited(){ return type == HexType.UNVISITED || (this.isEnd() && type==HexType.END); } /** * This method checks if the current hexagon is a Start tile. * @return true if this is a Start tile, false otherwise. */ public boolean isStart(){ return this.isStart; } /** * This method checks if the current hexagon is an End tile. * @return true if this is an End tile, false otherwise. */ public boolean isEnd(){ return this.isEnd; } /** * This method gets the hexagon type and returns a HexType * value, which can be checked against the enum above * @return HexType value - see the enum */ public HexType getHexagonType() { return this.type; } /** * This method sets the tile to be a Pushed tile * and updates the tile's colour */ public void setPushed(){ this.type = HexType.PUSHED; this.setColor(this.type); } /** * This method set the tile to be a Visited tile * and updates the tile's colour */ public void setProcessed(){ this.type = HexType.PROCESSED; if (isEnd){ this.type = HexType.END_PROCESSED; } this.setColor(this.type); } /** * Helper method to set the current tile color based on the * type of tile. * @param t The type to use to set the color */ private void setColor(HexType t){ switch(t){ case WALL: this.setBackground(WALL_COLOR); break; case START: this.setBackground(START_COLOR); break; case END: this.setBackground(END_COLOR); break; case UNVISITED: this.setBackground(UNVISITED_COLOR); break; case PROCESSED: this.setBackground(PROCESSED_COLOR); break; case PUSHED: this.setBackground(PUSHED_COLOR); break; case END_PROCESSED: this.setBackground(END_PROCESSED_COLOR); break; case TREASURE: this.setBackground(TREASURE_COLOR); break; default: this.setBackground(WALL_COLOR); break; } this.setForeground(Color.black); } }

***Hexcomponent.java

import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Point; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.event.MouseEvent; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JToggleButton; import javax.swing.SwingUtilities; /** * A six sided component. This is not guaranteed to be a perfect hexagon, it is just guaranteed to have six sides in * the form of a hexagon. To be a perfect hexagon the size of this component must have a height to width ratio of * 1 to 0.866 * * @author keang * @date 5 Jun 2009 * */ public class HexComponent extends JComponent{ private static final long serialVersionUID = 4865976127980106774L; private Polygon hexagon = new Polygon(); @Override public boolean contains(Point p) { return hexagon.contains(p); } @Override public boolean contains(int x, int y) { return hexagon.contains(x, y); } @Override public void setSize(Dimension d) { super.setSize(d); calculateCoords(); } @Override public void setSize(int w, int h) { super.setSize(w, h); calculateCoords(); } @Override public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); calculateCoords(); } @Override public void setBounds(Rectangle r) { super.setBounds(r); calculateCoords(); } @Override protected void processMouseEvent(MouseEvent e) { if ( contains(e.getPoint()) ) super.processMouseEvent(e); } private void calculateCoords() { int w = getWidth()-1; int h = getHeight()-1; int ratio = (int)(h*.25); int nPoints = 6; int[] hexX = new int[nPoints]; int[] hexY = new int[nPoints]; agressiveCoords(w, h, ratio, hexX, hexY); hexagon = new Polygon(hexX, hexY, nPoints); } private void agressiveCoords(int w, int h, int ratio, int[] hexX, int[] hexY) { hexX[0] = w/2; hexY[0] = 0; hexX[1] = w; hexY[1] = ratio; hexX[2] = w; hexY[2] = h - ratio; hexX[3] = w/2; hexY[3] = h; hexX[4] = 0; hexY[4] = h - ratio; hexX[5] = 0; hexY[5] = ratio; } @Override protected void paintComponent(Graphics g) { g.setColor(getBackground()); g.fillPolygon(hexagon); g.setColor(getForeground()); g.drawPolygon(hexagon); } @Override protected void paintBorder(Graphics g) { // do not paint a border } }

***HexLayout.java

import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; /** * This layout manager is based on java.awt.GridLayout * * The GridLayout class is a layout manager that * lays out a container's components in a hexagonal grid. * The container is divided into equal-sized hexagons, * and one component is placed in each hexagon. * * * * * @author keang * @date 5 Jun 2009 * */ public class HexLayout implements LayoutManager, java.io.Serializable { private static final long serialVersionUID = -858342723067286796L; /** * This is the gap (in pixels) which specifies the space * between components. They can be changed at any time. * This should be a non-negative integer. * * @serial * @see #getHgap() * @see #setHgap(int) */ int cgap; /** * This is the number of rows specified for the grid. The number * of rows can be changed at any time. * This should be a non negative integer, where '0' means * 'any number' meaning that the number of Rows in that * dimension depends on the other dimension. * * @serial * @see #getRows() * @see #setRows(int) */ int rows; /** * This is the number of columns specified for the grid. The number * of columns can be changed at any time. * This should be a non negative integer, where '0' means * 'any number' meaning that the number of Columns in that * dimension depends on the other dimension. * * @serial * @see #getColumns() * @see #setColumns(int) */ int cols; /** * Creates a grid layout with a default of one column per component, * in a single row. * @since JDK1.1 */ public HexLayout() { this(1, 0, 0); } /** * Creates a grid layout with the specified number of rows and * columns. All components in the layout are given equal size. * 

* One, but not both, of rows and cols can * be zero, which means that any number of objects can be placed in a * row or in a column. * @param r the rows, with the value zero meaning * any number of rows. * @param c the columns, with the value zero meaning * any number of columns. */ public HexLayout(int r, int c) { this(r, c, 0); } /** * Creates a grid layout with the specified number of rows and * columns. All components in the layout are given equal size. *

* In addition, the gap between components is set to the * specified value. *

* One, but not both, of rows and cols can * be zero, which means that any number of objects can be placed in a * row or in a column. *

* All GridLayout constructors defer to this one. * @param r the rows, with the value zero meaning * any number of rows * @param c the columns, with the value zero meaning * any number of columns * @param hgap the gap around the component * @exception IllegalArgumentException if the value of both * rows and cols is * set to zero */ public HexLayout(int r, int c, int hgap) { if ((r == 0) && (c == 0)) { throw new IllegalArgumentException("rows and cols cannot both be zero"); } this.rows = r; this.cols = c; this.cgap = hgap; } /** * Gets the number of rows in this layout. * @return the number of rows in this layout */ public int getRows() { return rows; } /** * Sets the number of rows in this layout to the specified value. * @param r the number of rows in this layout * @exception IllegalArgumentException if the value of both * rows and cols is set to zero */ public void setRows(int r) { if ((r == 0) && (this.cols == 0)) { throw new IllegalArgumentException("rows and cols cannot both be zero"); } this.rows = r; } /** * Gets the number of columns in this layout. * @return the number of columns in this layout */ public int getColumns() { return cols; } /** * Sets the number of columns in this layout to the specified value. * Setting the number of columns has no affect on the layout * if the number of rows specified by a constructor or by * the setRows method is non-zero. In that case, the number * of columns displayed in the layout is determined by the total * number of components and the number of rows specified. * @param c the number of columns in this layout * @exception IllegalArgumentException if the value of both * rows and cols is set to zero */ public void setColumns(int c) { if ((c == 0) && (this.rows == 0)) { throw new IllegalArgumentException("rows and cols cannot both be zero"); } this.cols = c; } /** * Gets the gap between components. * @return the gap between components */ public int getGap() { return cgap; } /** * Sets the gap between components to the specified value. * @param gap the gap between components */ public void setGap(int gap) { this.cgap = gap; } /** * Adds the specified component with the specified name to the layout. * @param name the name of the component * @param comp the component to be added */ public void addLayoutComponent(String name, Component comp) { // do nothing } /** * Removes the specified component from the layout. * @param comp the component to be removed */ public void removeLayoutComponent(Component comp) { // do nothing } /** * Determines the preferred size of the container argument using * this grid layout. *

* The preferred width of a grid layout is the largest preferred width * of all of the components in the container times the number of columns, * plus the horizontal padding times the number of columns minus one, * plus the left and right insets of the target container, plus the width * of half a component if there is more than one row. *

* The preferred height of a grid layout is the largest preferred height * of all of the components in the container plus three quarters of the * largest minimum height of all of the components in the container times * the number of rows greater than one, * plus the vertical padding times the number of rows minus one, plus * the top and bottom insets of the target container. * * @param parent the container in which to do the layout * @return the preferred dimensions to lay out the * subcomponents of the specified container * @see java.awt.GridLayout#minimumLayoutSize * @see java.awt.Container#getPreferredSize() */ public Dimension preferredLayoutSize(Container parent) { synchronized ( parent.getTreeLock() ) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); int nrows = rows; int ncols = cols; if ( nrows > 0 ) { ncols = (ncomponents + nrows - 1) / nrows; } else { nrows = (ncomponents + ncols - 1) / ncols; } int w = 0; int h = 0; for ( int i = 0; i < ncomponents; i++ ) { Component comp = parent.getComponent(i); Dimension d = comp.getPreferredSize(); if ( w < d.width ) { w = d.width; } if ( h < d.height ) { h = d.height; } } int dx = insets.left + insets.right + ncols * w + (ncols - 1) * cgap; int dy = insets.top + insets.bottom + nrows * h + (nrows - 1) * cgap; if ( nrows > 1 ) { dx = dx + (int)(w * 0.5f); dy /= nrows; dy = dy + (int)(dy * (nrows - 1) * 0.75f); } return new Dimension(dx, dy); } } /** * Determines the minimum size of the container argument using this * grid layout. *

* The minimum width of a grid layout is the largest minimum width * of all of the components in the container times the number of columns, * plus the horizontal padding times the number of columns minus one, * plus the left and right insets of the target container, plus the width * of half a component if there is more than one row. *

* The minimum height of a grid layout is the largest minimum height * of all of the components in the container plus three quarters of the * largest minimum height of all of the components in the container times * the number of rows greater than one, * plus the vertical padding times the number of rows minus one, plus * the top and bottom insets of the target container. * * @param parent the container in which to do the layout * @return the minimum dimensions needed to lay out the * subcomponents of the specified container * @see java.awt.GridLayout#preferredLayoutSize * @see java.awt.Container#doLayout */ public Dimension minimumLayoutSize(Container parent) { synchronized ( parent.getTreeLock() ) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); int nrows = rows; int ncols = cols; if ( nrows > 0 ) { ncols = (ncomponents + nrows - 1) / nrows; } else { nrows = (ncomponents + ncols - 1) / ncols; } int w = 0; int h = 0; for ( int i = 0; i < ncomponents; i++ ) { Component comp = parent.getComponent(i); Dimension d = comp.getMinimumSize(); if ( w < d.width ) { w = d.width; } if ( h < d.height ) { h = d.height; } } int dx = insets.left + insets.right + ncols * w + (ncols - 1) * cgap; int dy = insets.top + insets.bottom + nrows * h + (nrows - 1) * cgap; if ( nrows > 1 ) { dx = dx + (int)(w * 0.5f); dy /= nrows; dy = dy + (int)(dy * (nrows - 1) * 0.75f); } return new Dimension(dx, dy); } } /** * Lays out the specified container using this layout. *

* This method reshapes the components in the specified target * container in order to satisfy the constraints of the * GridLayout object. *

* The grid layout manager determines the size of individual * components by dividing the free space in the container into * equal-sized portions according to the number of rows and columns * in the layout. The container's free space equals the container's * size minus any insets and any specified horizontal or vertical * gap. All components in a grid layout are given the same size. * * @param parent the container in which to do the layout * @see java.awt.Container * @see java.awt.Container#doLayout */ public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); int nrows = rows; int ncols = cols; if ( ncomponents == 0 ) { return; } if ( nrows > 0 ) { ncols = (ncomponents + nrows - 1) / nrows; } else { nrows = (ncomponents + ncols - 1) / ncols; } int w = parent.getWidth() - (insets.left + insets.right); int h = parent.getHeight() - (insets.top + insets.bottom); w = (int)((w - (ncols - 1) * cgap) / (ncols + (nrows>1?0.5f:0.0f))); float effectiveRows = 1 + ((nrows - 1) * 0.75f); h = (int)((h - (nrows - 1) * cgap) / effectiveRows); int xoffset = (w+cgap)/2; int yoffset = (int)(h * 0.75f); boolean staggeredRow = false; for ( int r = 0, y = insets.top; r < nrows; r++, y += yoffset + cgap ) { int offset = 0; if ( staggeredRow ) offset = xoffset; for ( int c = 0, x = insets.left; c < ncols; c++, x += w + cgap ) { int i = r * ncols + c; if ( i < ncomponents ) { parent.getComponent(i).setBounds(x+offset, y, w, h); } } staggeredRow = !staggeredRow; } } } /** * Returns the string representation of this grid layout's values. * @return a string representation of this grid layout */ public String toString() { return getClass().getName() + "[gap=" + cgap + ",rows=" + rows + ",cols=" + cols + "]"; } }

Therefore, with the following codes given complete the following tasks.

Task1= When working with labyrinths and hexagons, there are two situations that come up. 1. UnknownLabyrinthCharacterException a. As you can see in the Labyrinth file, the constructor may throw this exception while reading the file describing the labyrinth. 2. InvalidNeighbourIndexException a. This is to cover the case where an entity requests a neighbour that is not 0-5 inclusive. Your task is to create these two exceptions as .java files.

Task2= You will create a class SearchForExit that has a main method only, which implements the Labyrinth solving algorithm here Algorithm for SearchForExit Create a Labyrinth object reference Try to open a new Labyrinth from one of the Labyrinth files provided ( The Labyrinth should now be initialized ) Create a Hexagon reference and get the start Hexagon tile from the Labyrinth ( Using an array stack of Hexagons, we will solve the Labyrinth. ) Create the stack and push the starting tile. Create a boolean variable that we will use to keep track of whether we have found the end Create a reference for the current Hexagon that we will process Create a counter to keep track of how many steps it takes us to solve the Labyrinth Now, while our stack is not empty, and while we have not found the end o pop the top of the stack to get the current hexagon tile o increment the step counter o if the current hexagon tile is an end tile, make the found end boolean variable true o otherwise, for each of the possible six neighbours of the current tile if the neighbour exists and is unvisited push the neighbouring hexagon tile to the Labyrinth solving stack and set the neighbouring hexagon tile to be a pushed tile type o set the current hexagon tile to "processed", now that we are done with it o Note: each time through we need to update the Labyrinth window with a call to repaint() Once we have searched the Labyrinth using the above algorithm, print out the following using a System.out.println or .format: o If the end was found, or if it was not found o The number of steps that it took to finish o How many tiles were still on the stack Save the labyrinths finished state to a file called processed_ + input file name. o Ex. if laby1.txt were the input file, processed_laby1.txt would be the output name

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

How many multiples of 4 are there between 10 and 250?

Answered: 1 week ago