Discussion Board
There are no previous messagesGo to the following message
Current Forum: Homework 2 Forum
Date: Thu Sep 20 2001 2:45 pm
Author: Danish, Matt R. <mrd@cmu.edu>
Subject: MazeCreator's setRows and setCols methods, once and for all

The purpose of the setRows and setCols methods in the class MazeCreator is still unclear to several members of the class as well as myself. I am going to attempt to summarize what has been posted already to this discussion board and ask for a definitive answer:

setRows and setCols are two methods required by the homework assignment to be present in the class MazeCreator. The description is not very helpful, as it simply states that they alter the rows and columns of the maze.

It is also of note that the two methods are never actually used by the test suite provided to us, MazeApplet.java and Maze.java.

The problem with setRows and setCols is that there is only one methods in the MazeCreator class that uses the row and column values. That method is LoadMaze, and LoadMaze takes row and column values in its parameter list. So, if setRows and setCols were defined to alter the private variables numRows and numCols, any changes made to the private variables would be overwritten when LoadMaze was called, since LoadMaze assigns values to numRows and numCols itself. (Note that strictly speaking, the numRows and numCols variables are also unnecessary). If setRows and setCols were called after LoadMaze, two things would happen: numRows and numCols would not be consistent with what was contained in roomList and wallList, and, in my case, it would be a waste of CPU cycles because I never use the numRows or numCols variables except in LoadMaze.

So, I have a request: Either

  • Show that my reasoning is false and provide a clear description of setRows, setCols, numRows, and numCols
  • Remove setRows, setCols from the assignment and make numRows and numCols optional.

I would sincerely appreciate it if you could provide an answer before 3 pm Friday afternoon because I would like to hand in this assignment before I depart for the weekend.

Thank you

Post response

There are no previous messagesGo to the following message
Current Thread Detail:
MazeCreator's setRows and setCols meth...      Danish, Matt R.      Thu Sep 20 2001 2:45 pm       
Addendum      Danish, Matt R.      Thu Sep 20 2001 2:59 pm       
Re: Addendum      Agarwal, Aditya      Fri Sep 21 2001 2:24 am       

Back to previous screen