View Single Post
Join Date: Jan 2008
Posts: 3,828
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Need help in finding correct method for my program!

 
0
  #9
Dec 1st, 2008
You need to provide the original input file too. It is unfortunate that you are stuck with that maze because you now have to design code that can move and check in eight directions rather than four. Also, how do you know where to start and stop? There are no holes in the side of the maze and nothing in your code that reads from the input file that tells you where to start, plus how do you know when you are done? Is there an 'S' and 'F' in the input file or something? You can't start at (0,0) because that's a wall/asterisk.

void main(void)
{
	string status_mode = "NONE";
	int choice;
	for (int start_loop = 1; start_loop>0; start_loop++)
	{
		if (status_mode != "NONE")
		{
			for (int indexrow=0; indexrow<8; indexrow++)
			{
				for (int indexcol=0; indexcol<16;indexcol++)
				{
					cout <<  gameArray[indexrow][indexcol];
				}
			}
			cout << endl;
		}
		cout << "Active Maze: " << status_mode << endl;
		cout << "1. Select Standard Maze" << endl;
		cout << "2. Select Custom Maze" << endl;
		cout << "3. Find Path" << endl;
		cout << "4. Print Path" << endl;
		cout << "5. End " << endl;

		cin >> choice;

		if (choice == 1)
		{
			status_mode = "STANDARD";
			inputStandard();
			cout << "Standard Mode Selected!" << endl << endl;
		}
		if (choice == 2)
		{
			status_mode = "CUSTOM";
			inputCustom();
			cout << "Custom Mode Selected!" << endl << endl;
		}
		if (choice == 3)
		{
			cout << "DISABLED." << endl << endl;
			findPath();
		}
		if (choice == 4)
		{
			cout << "DISABLED. " << endl << endl;
		}
		if (choice == 5)
		{
			cout << "EXITING!" << endl;
			break;
		}
		if (!cin)
		{
			cout << "ERROR IN INPUT!" << endl;
		}
	}
}

It is int main () , not void main () , even if your compiler lets you get away with it. You have what appears to be an infinite loop. See red code above. If that is intentional, you should probably change it to a while (true) loop so it's more obvious that it is intentional.
Reply With Quote