“Error C1060: compiler is out of heap space” when trying to compile a 550x550 Vector made of 4 character...












1















This program is designed to read an array/vector of strings (e.g. 0101) in a grid to show and solve maze's. It works when inputting a 20x20 array however receives "Error C1060: compiler is out of heap space" when trying to compile and run the 550x550 vector.



I've added /Zm200 to the project properties along with increasing the heap commit size exponentially.



I'm running x64 bit Windows 10 with 8GB RAM and using Visual Studio Professional 2017



// MazeBreaker.cpp : This file contains the 'main' function. Program execution begins && ends there.
//

#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

//Creating Variables

vector<vector<string>> ExampleMaze = {
{"1110", "1100", "1111", "1001", "1101", "1000", "1101", "1010", "1001", "1111", "1010", "1001", "1111", "1110", "1111", "1111", "1101", "1010", "1110", "1100"},
{"0111", "0110", "0010", "0000", "1111", "1000", "1011", "0000", "1010", "1010", "1110", "0011", "0011", "0010", "1001", "1011", "0001", "0110", "1010", "0101"},
{"0110", "1110", "1000", "1100", "1010", "0001", "1111", "1100", "0000", "0010", "0011", "0110", "0000", "1110", "0000", "1000", "1111", "0011", "0001", "1101"},
{"0111", "0011", "0000", "0011", "1111", "0100", "1011", "0011", "1100", "0011", "0111", "0011", "0110", "1001", "1100", "0111", "0000", "1001", "0011", "1111"},
{"0101", "1110", "0001", "1010", "1101", "0001", "0001", "1010", "1000", "1011", "0110", "1000", "0011", "1010", "0100", "0001", "0000", "1001", "1001", "1111"},
{"1100", "0010", "1000", "1000", "0001", "1101", "1010", "1011", "1010", "0110", "0011", "1000", "0000", "1111", "1000", "0011", "1011", "1011", "0111", "1101"},
{"1100", "1110", "0011", "0110", "1100", "0100", "1110", "0010", "0000", "0011", "0110", "1100", "1001", "0001", "0111", "0011", "0000", "0001", "0111", "1101"},
{"1110", "1011", "1011", "0000", "0110", "1101", "1001", "0001", "0100", "0101", "1111", "1101", "0000", "1010", "0110", "0101", "0001", "0011", "0111", "1011"},
{"0110", "1110", "1101", "1100", "0010", "1000", "0010", "0110", "1000", "0110", "0001", "1100", "0001", "0111", "1010", "0110", "0000", "1011", "0110", "0101"},
{"0111", "0101", "0100", "0110", "0001", "1000", "1010", "1001", "0110", "1000", "0110", "1011", "1100", "0011", "1110", "1001", "0100", "0100", "0110", "0101"},
{"1110", "1100", "1110", "0010", "0111", "0100", "1100", "0100", "1101", "1100", "0110", "0101", "1110", "1001", "0111", "0110", "0011", "1011", "1111", "1011"},
{"1111", "0101", "0010", "0101", "0110", "1000", "1100", "1011", "1010", "0001", "1110", "1101", "0100", "1010", "1000", "0000", "1011", "0111", "0010", "0111"},
{"0111", "1111", "1001", "0100", "0101", "0101", "1010", "1100", "1101", "0101", "0011", "0111", "0011", "0000", "1101", "0010", "0101", "1010", "0100", "1111"},
{"1111", "1010", "0000", "0110", "1111", "1000", "1010", "0100", "1110", "0100", "1110", "0110", "0101", "1111", "1010", "1100", "0001", "0011", "0101", "0001"},
{"1101", "1111", "1101", "1110", "0011", "0001", "0101", "1001", "0101", "0101", "1000", "1111", "0111", "0100", "1101", "1010", "0001", "0111", "0001", "1111"},
{"0110", "0001", "1100", "0110", "0110", "0000", "1110", "1011", "1001", "1100", "0100", "1000", "0011", "0010", "0111", "0100", "0100", "0101", "1011", "1011"},
{"0110", "1011", "1101", "0010", "1111", "1101", "1010", "1000", "1000", "1111", "1111", "1011", "0101", "0001", "1101", "1010", "0101", "1011", "0100", "1111"},
{"1100", "1001", "1011", "1010", "1101", "0111", "0100", "0110", "0110", "1100", "1110", "1101", "1110", "0001", "0100", "0001", "0001", "0100", "0111", "1001"},
{"1110", "1101", "1100", "0110", "0100", "1101", "1001", "0110", "1011", "0001", "0100", "0011", "0110", "1111", "1101", "0110", "1100", "1011", "1100", "0011"},
{"0111", "1110", "1110", "0110", "0011", "0111", "0011", "1011", "0110", "0010", "1011", "1011", "0010", "1111", "0111", "0110", "1011", "0010", "0010", "0111"}
};

vector<vector<string>> ExampleMaze2 = {
{"1100", "1010", "1010", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1000", "1001", "1110", "1001", "1101", "1100", "1000", "1010", "1000", "1000", "1010", "1000", "1001", "1110", "1001", "1100", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1101", "1100", "1010", "1010", "1010", "1011", "1100", "1000", "1010", "1001", "1101", "1100", "1010", "1000", "1010", "1010", "1000", "1001", "1110", "1001", "1100", "1000", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1001", "1100", "1011", "1100", "1000", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1110", "1010", "1000", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1000", "1000", "1001", "1110", "1001", "1100", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1011", "1100", "1010", "1000", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1000", "1001", "1100", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1001", "1100", "1010", "1000", "1000", "1010", "1010", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1010", "1010", "1001", "1101", "1100", "1011", "1100", "1001", "1110", "1010", "1000", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1011", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1000", "1001", "1100", "1010", "1000", "1010", "1000", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1011", "1100", "1010", "1001", "1110", "1000", "1011", "1100", "1001", "1100", "1001", "1100", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1110", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1000", "1001", "1100", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1100", "1010", "1001", "1101", "1100", "1001", "1100", "1010", "1001", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1010", "1010", "1011", "1100", "1010", "1010", "1010", "1001", "1100", "1001", "1110", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1000", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1001"},
//..................... * 549

};


vector<string> DrawMaze(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " ";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "| ";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<string> ShowPath(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{
vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 2; j = ++j)
{
string PrintLayers;

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "XXX";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "XST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "XFN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " XX";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
if ((i + 1 == Rows) && (j == 3) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}

}

if (!PrintLayers.empty())
{
//cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<vector<int>> FindPaths(vector<string> MazePath)
{
int xPos = 0;
int yPos = 0;

int TrueXPos = (1 + (xPos * 3));
int TrueYPos = (1 + (yPos * 2));

bool N = true;
bool E = true;
bool S = true;
bool W = true;

vector<string> Path;
string Direction = "N";
Path.push_back(Direction);
int i = 0;

vector<string> DirectionOrder = { "N", "E", "S", "W" };
string TempDirection;
string DirectFrom = "N";
vector<vector<int>> RouteCoords = { {0,0} };

while (((N == true) || (E == true) || (S == true) || (W == true)) && (i < 60))
{
vector<string> Possibilities = {};
N = false;
E = false;
S = false;
W = false;

if ((TrueYPos - 1 > 0) && (TrueYPos - 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos - 1][TrueXPos] != ' ')
{
N = true;
Possibilities.push_back("N");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos +2 > 0) && (TrueXPos + 2 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos + 2] != ' ')
{
E = true;
Possibilities.push_back("E");
}
}

if ((TrueYPos + 1 > 0) && (TrueYPos + 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos + 1][TrueXPos] != ' ')
{
S = true;
Possibilities.push_back("S");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos - 1 > 0) && (TrueXPos - 1 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos - 1] != ' ')
{
W = true;
Possibilities.push_back("W");
}
}



if (MazePath[TrueYPos][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos-1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos+2] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos+1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos-1] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}

for (int z = 0; z < 4; ++z)
{
//cout << "Checking: " << DirectionOrder[z] << " ";
//cout << "N: " << N << " E: " << E << " S: " << S << " W: " << W << endl;

if ((N == true) && (DirectionOrder[z] == "N"))
{
cout << "Move North" << endl;
Direction = "N";
yPos += -1;
DirectFrom = "S";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((S == true) && (DirectionOrder[z] == "S"))
{
cout << "Move South" << endl;
Direction = "S";
yPos += 1;
DirectFrom = "N";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((W == true) && (DirectionOrder[z] == "W"))
{
cout << "Move West" << endl;
Direction = "W";
xPos += -1;
DirectFrom = "E";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((E == true) && (DirectionOrder[z] == "E"))
{
cout << "Move East" << endl;
Direction = "E";
xPos += 1;
DirectFrom = "W";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
}

Path.push_back(Direction);
auto itr = std::find(DirectionOrder.begin(), DirectionOrder.end(), DirectFrom);
if (itr != DirectionOrder.end()) DirectionOrder.erase(itr);
DirectionOrder.push_back(DirectFrom);

RouteCoords.push_back({xPos,yPos});
TrueXPos = (1 + (xPos * 3));
TrueYPos = (1 + (yPos * 2));
i += 1;
}

for (int b = 0; b < RouteCoords.size(); ++b)
{
cout << "{";

for (int c = 0; c < RouteCoords[b].size(); ++c)
{
cout << RouteCoords[b][c] << ",";
}
cout << "},";
}
cout << endl;

return RouteCoords;
}

void MapRoute(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY, vector<vector<int>> RouteCoords)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();
bool AddRoute = false;

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{
AddRoute = false;
for (int c = 0; c < RouteCoords.size(); ++c)
{
if ((RouteCoords[c][0] == k) && (RouteCoords[c][1] == i))
{
AddRoute = true;
}
}

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + " XX";
}
else
{
PrintLayers = PrintLayers + " ";
}
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + "|XX";
}
else
{
PrintLayers = PrintLayers + "| ";
}
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return;
}


int main()
{
//cout << ExampleMaze[0][0][0] << endl;
//DrawMaze(ExampleMaze, 0, 0, 20, 20);
cout << endl;
MapRoute(ExampleMaze2,0,0,20,20,FindPaths(ShowPath(ExampleMaze2, 0, 0, 20, 20)));

}









share|improve this question


















  • 1





    Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

    – Some programmer dude
    Nov 27 '18 at 9:22






  • 2





    As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

    – Some programmer dude
    Nov 27 '18 at 9:24











  • @Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

    – BadgerHobbs
    Nov 27 '18 at 11:25











  • A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

    – Some programmer dude
    Nov 27 '18 at 12:27











  • Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

    – BadgerHobbs
    Nov 27 '18 at 12:47
















1















This program is designed to read an array/vector of strings (e.g. 0101) in a grid to show and solve maze's. It works when inputting a 20x20 array however receives "Error C1060: compiler is out of heap space" when trying to compile and run the 550x550 vector.



I've added /Zm200 to the project properties along with increasing the heap commit size exponentially.



I'm running x64 bit Windows 10 with 8GB RAM and using Visual Studio Professional 2017



// MazeBreaker.cpp : This file contains the 'main' function. Program execution begins && ends there.
//

#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

//Creating Variables

vector<vector<string>> ExampleMaze = {
{"1110", "1100", "1111", "1001", "1101", "1000", "1101", "1010", "1001", "1111", "1010", "1001", "1111", "1110", "1111", "1111", "1101", "1010", "1110", "1100"},
{"0111", "0110", "0010", "0000", "1111", "1000", "1011", "0000", "1010", "1010", "1110", "0011", "0011", "0010", "1001", "1011", "0001", "0110", "1010", "0101"},
{"0110", "1110", "1000", "1100", "1010", "0001", "1111", "1100", "0000", "0010", "0011", "0110", "0000", "1110", "0000", "1000", "1111", "0011", "0001", "1101"},
{"0111", "0011", "0000", "0011", "1111", "0100", "1011", "0011", "1100", "0011", "0111", "0011", "0110", "1001", "1100", "0111", "0000", "1001", "0011", "1111"},
{"0101", "1110", "0001", "1010", "1101", "0001", "0001", "1010", "1000", "1011", "0110", "1000", "0011", "1010", "0100", "0001", "0000", "1001", "1001", "1111"},
{"1100", "0010", "1000", "1000", "0001", "1101", "1010", "1011", "1010", "0110", "0011", "1000", "0000", "1111", "1000", "0011", "1011", "1011", "0111", "1101"},
{"1100", "1110", "0011", "0110", "1100", "0100", "1110", "0010", "0000", "0011", "0110", "1100", "1001", "0001", "0111", "0011", "0000", "0001", "0111", "1101"},
{"1110", "1011", "1011", "0000", "0110", "1101", "1001", "0001", "0100", "0101", "1111", "1101", "0000", "1010", "0110", "0101", "0001", "0011", "0111", "1011"},
{"0110", "1110", "1101", "1100", "0010", "1000", "0010", "0110", "1000", "0110", "0001", "1100", "0001", "0111", "1010", "0110", "0000", "1011", "0110", "0101"},
{"0111", "0101", "0100", "0110", "0001", "1000", "1010", "1001", "0110", "1000", "0110", "1011", "1100", "0011", "1110", "1001", "0100", "0100", "0110", "0101"},
{"1110", "1100", "1110", "0010", "0111", "0100", "1100", "0100", "1101", "1100", "0110", "0101", "1110", "1001", "0111", "0110", "0011", "1011", "1111", "1011"},
{"1111", "0101", "0010", "0101", "0110", "1000", "1100", "1011", "1010", "0001", "1110", "1101", "0100", "1010", "1000", "0000", "1011", "0111", "0010", "0111"},
{"0111", "1111", "1001", "0100", "0101", "0101", "1010", "1100", "1101", "0101", "0011", "0111", "0011", "0000", "1101", "0010", "0101", "1010", "0100", "1111"},
{"1111", "1010", "0000", "0110", "1111", "1000", "1010", "0100", "1110", "0100", "1110", "0110", "0101", "1111", "1010", "1100", "0001", "0011", "0101", "0001"},
{"1101", "1111", "1101", "1110", "0011", "0001", "0101", "1001", "0101", "0101", "1000", "1111", "0111", "0100", "1101", "1010", "0001", "0111", "0001", "1111"},
{"0110", "0001", "1100", "0110", "0110", "0000", "1110", "1011", "1001", "1100", "0100", "1000", "0011", "0010", "0111", "0100", "0100", "0101", "1011", "1011"},
{"0110", "1011", "1101", "0010", "1111", "1101", "1010", "1000", "1000", "1111", "1111", "1011", "0101", "0001", "1101", "1010", "0101", "1011", "0100", "1111"},
{"1100", "1001", "1011", "1010", "1101", "0111", "0100", "0110", "0110", "1100", "1110", "1101", "1110", "0001", "0100", "0001", "0001", "0100", "0111", "1001"},
{"1110", "1101", "1100", "0110", "0100", "1101", "1001", "0110", "1011", "0001", "0100", "0011", "0110", "1111", "1101", "0110", "1100", "1011", "1100", "0011"},
{"0111", "1110", "1110", "0110", "0011", "0111", "0011", "1011", "0110", "0010", "1011", "1011", "0010", "1111", "0111", "0110", "1011", "0010", "0010", "0111"}
};

vector<vector<string>> ExampleMaze2 = {
{"1100", "1010", "1010", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1000", "1001", "1110", "1001", "1101", "1100", "1000", "1010", "1000", "1000", "1010", "1000", "1001", "1110", "1001", "1100", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1101", "1100", "1010", "1010", "1010", "1011", "1100", "1000", "1010", "1001", "1101", "1100", "1010", "1000", "1010", "1010", "1000", "1001", "1110", "1001", "1100", "1000", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1001", "1100", "1011", "1100", "1000", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1110", "1010", "1000", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1000", "1000", "1001", "1110", "1001", "1100", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1011", "1100", "1010", "1000", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1000", "1001", "1100", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1001", "1100", "1010", "1000", "1000", "1010", "1010", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1010", "1010", "1001", "1101", "1100", "1011", "1100", "1001", "1110", "1010", "1000", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1011", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1000", "1001", "1100", "1010", "1000", "1010", "1000", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1011", "1100", "1010", "1001", "1110", "1000", "1011", "1100", "1001", "1100", "1001", "1100", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1110", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1000", "1001", "1100", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1100", "1010", "1001", "1101", "1100", "1001", "1100", "1010", "1001", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1010", "1010", "1011", "1100", "1010", "1010", "1010", "1001", "1100", "1001", "1110", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1000", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1001"},
//..................... * 549

};


vector<string> DrawMaze(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " ";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "| ";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<string> ShowPath(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{
vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 2; j = ++j)
{
string PrintLayers;

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "XXX";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "XST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "XFN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " XX";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
if ((i + 1 == Rows) && (j == 3) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}

}

if (!PrintLayers.empty())
{
//cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<vector<int>> FindPaths(vector<string> MazePath)
{
int xPos = 0;
int yPos = 0;

int TrueXPos = (1 + (xPos * 3));
int TrueYPos = (1 + (yPos * 2));

bool N = true;
bool E = true;
bool S = true;
bool W = true;

vector<string> Path;
string Direction = "N";
Path.push_back(Direction);
int i = 0;

vector<string> DirectionOrder = { "N", "E", "S", "W" };
string TempDirection;
string DirectFrom = "N";
vector<vector<int>> RouteCoords = { {0,0} };

while (((N == true) || (E == true) || (S == true) || (W == true)) && (i < 60))
{
vector<string> Possibilities = {};
N = false;
E = false;
S = false;
W = false;

if ((TrueYPos - 1 > 0) && (TrueYPos - 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos - 1][TrueXPos] != ' ')
{
N = true;
Possibilities.push_back("N");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos +2 > 0) && (TrueXPos + 2 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos + 2] != ' ')
{
E = true;
Possibilities.push_back("E");
}
}

if ((TrueYPos + 1 > 0) && (TrueYPos + 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos + 1][TrueXPos] != ' ')
{
S = true;
Possibilities.push_back("S");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos - 1 > 0) && (TrueXPos - 1 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos - 1] != ' ')
{
W = true;
Possibilities.push_back("W");
}
}



if (MazePath[TrueYPos][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos-1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos+2] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos+1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos-1] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}

for (int z = 0; z < 4; ++z)
{
//cout << "Checking: " << DirectionOrder[z] << " ";
//cout << "N: " << N << " E: " << E << " S: " << S << " W: " << W << endl;

if ((N == true) && (DirectionOrder[z] == "N"))
{
cout << "Move North" << endl;
Direction = "N";
yPos += -1;
DirectFrom = "S";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((S == true) && (DirectionOrder[z] == "S"))
{
cout << "Move South" << endl;
Direction = "S";
yPos += 1;
DirectFrom = "N";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((W == true) && (DirectionOrder[z] == "W"))
{
cout << "Move West" << endl;
Direction = "W";
xPos += -1;
DirectFrom = "E";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((E == true) && (DirectionOrder[z] == "E"))
{
cout << "Move East" << endl;
Direction = "E";
xPos += 1;
DirectFrom = "W";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
}

Path.push_back(Direction);
auto itr = std::find(DirectionOrder.begin(), DirectionOrder.end(), DirectFrom);
if (itr != DirectionOrder.end()) DirectionOrder.erase(itr);
DirectionOrder.push_back(DirectFrom);

RouteCoords.push_back({xPos,yPos});
TrueXPos = (1 + (xPos * 3));
TrueYPos = (1 + (yPos * 2));
i += 1;
}

for (int b = 0; b < RouteCoords.size(); ++b)
{
cout << "{";

for (int c = 0; c < RouteCoords[b].size(); ++c)
{
cout << RouteCoords[b][c] << ",";
}
cout << "},";
}
cout << endl;

return RouteCoords;
}

void MapRoute(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY, vector<vector<int>> RouteCoords)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();
bool AddRoute = false;

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{
AddRoute = false;
for (int c = 0; c < RouteCoords.size(); ++c)
{
if ((RouteCoords[c][0] == k) && (RouteCoords[c][1] == i))
{
AddRoute = true;
}
}

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + " XX";
}
else
{
PrintLayers = PrintLayers + " ";
}
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + "|XX";
}
else
{
PrintLayers = PrintLayers + "| ";
}
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return;
}


int main()
{
//cout << ExampleMaze[0][0][0] << endl;
//DrawMaze(ExampleMaze, 0, 0, 20, 20);
cout << endl;
MapRoute(ExampleMaze2,0,0,20,20,FindPaths(ShowPath(ExampleMaze2, 0, 0, 20, 20)));

}









share|improve this question


















  • 1





    Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

    – Some programmer dude
    Nov 27 '18 at 9:22






  • 2





    As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

    – Some programmer dude
    Nov 27 '18 at 9:24











  • @Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

    – BadgerHobbs
    Nov 27 '18 at 11:25











  • A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

    – Some programmer dude
    Nov 27 '18 at 12:27











  • Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

    – BadgerHobbs
    Nov 27 '18 at 12:47














1












1








1








This program is designed to read an array/vector of strings (e.g. 0101) in a grid to show and solve maze's. It works when inputting a 20x20 array however receives "Error C1060: compiler is out of heap space" when trying to compile and run the 550x550 vector.



I've added /Zm200 to the project properties along with increasing the heap commit size exponentially.



I'm running x64 bit Windows 10 with 8GB RAM and using Visual Studio Professional 2017



// MazeBreaker.cpp : This file contains the 'main' function. Program execution begins && ends there.
//

#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

//Creating Variables

vector<vector<string>> ExampleMaze = {
{"1110", "1100", "1111", "1001", "1101", "1000", "1101", "1010", "1001", "1111", "1010", "1001", "1111", "1110", "1111", "1111", "1101", "1010", "1110", "1100"},
{"0111", "0110", "0010", "0000", "1111", "1000", "1011", "0000", "1010", "1010", "1110", "0011", "0011", "0010", "1001", "1011", "0001", "0110", "1010", "0101"},
{"0110", "1110", "1000", "1100", "1010", "0001", "1111", "1100", "0000", "0010", "0011", "0110", "0000", "1110", "0000", "1000", "1111", "0011", "0001", "1101"},
{"0111", "0011", "0000", "0011", "1111", "0100", "1011", "0011", "1100", "0011", "0111", "0011", "0110", "1001", "1100", "0111", "0000", "1001", "0011", "1111"},
{"0101", "1110", "0001", "1010", "1101", "0001", "0001", "1010", "1000", "1011", "0110", "1000", "0011", "1010", "0100", "0001", "0000", "1001", "1001", "1111"},
{"1100", "0010", "1000", "1000", "0001", "1101", "1010", "1011", "1010", "0110", "0011", "1000", "0000", "1111", "1000", "0011", "1011", "1011", "0111", "1101"},
{"1100", "1110", "0011", "0110", "1100", "0100", "1110", "0010", "0000", "0011", "0110", "1100", "1001", "0001", "0111", "0011", "0000", "0001", "0111", "1101"},
{"1110", "1011", "1011", "0000", "0110", "1101", "1001", "0001", "0100", "0101", "1111", "1101", "0000", "1010", "0110", "0101", "0001", "0011", "0111", "1011"},
{"0110", "1110", "1101", "1100", "0010", "1000", "0010", "0110", "1000", "0110", "0001", "1100", "0001", "0111", "1010", "0110", "0000", "1011", "0110", "0101"},
{"0111", "0101", "0100", "0110", "0001", "1000", "1010", "1001", "0110", "1000", "0110", "1011", "1100", "0011", "1110", "1001", "0100", "0100", "0110", "0101"},
{"1110", "1100", "1110", "0010", "0111", "0100", "1100", "0100", "1101", "1100", "0110", "0101", "1110", "1001", "0111", "0110", "0011", "1011", "1111", "1011"},
{"1111", "0101", "0010", "0101", "0110", "1000", "1100", "1011", "1010", "0001", "1110", "1101", "0100", "1010", "1000", "0000", "1011", "0111", "0010", "0111"},
{"0111", "1111", "1001", "0100", "0101", "0101", "1010", "1100", "1101", "0101", "0011", "0111", "0011", "0000", "1101", "0010", "0101", "1010", "0100", "1111"},
{"1111", "1010", "0000", "0110", "1111", "1000", "1010", "0100", "1110", "0100", "1110", "0110", "0101", "1111", "1010", "1100", "0001", "0011", "0101", "0001"},
{"1101", "1111", "1101", "1110", "0011", "0001", "0101", "1001", "0101", "0101", "1000", "1111", "0111", "0100", "1101", "1010", "0001", "0111", "0001", "1111"},
{"0110", "0001", "1100", "0110", "0110", "0000", "1110", "1011", "1001", "1100", "0100", "1000", "0011", "0010", "0111", "0100", "0100", "0101", "1011", "1011"},
{"0110", "1011", "1101", "0010", "1111", "1101", "1010", "1000", "1000", "1111", "1111", "1011", "0101", "0001", "1101", "1010", "0101", "1011", "0100", "1111"},
{"1100", "1001", "1011", "1010", "1101", "0111", "0100", "0110", "0110", "1100", "1110", "1101", "1110", "0001", "0100", "0001", "0001", "0100", "0111", "1001"},
{"1110", "1101", "1100", "0110", "0100", "1101", "1001", "0110", "1011", "0001", "0100", "0011", "0110", "1111", "1101", "0110", "1100", "1011", "1100", "0011"},
{"0111", "1110", "1110", "0110", "0011", "0111", "0011", "1011", "0110", "0010", "1011", "1011", "0010", "1111", "0111", "0110", "1011", "0010", "0010", "0111"}
};

vector<vector<string>> ExampleMaze2 = {
{"1100", "1010", "1010", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1000", "1001", "1110", "1001", "1101", "1100", "1000", "1010", "1000", "1000", "1010", "1000", "1001", "1110", "1001", "1100", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1101", "1100", "1010", "1010", "1010", "1011", "1100", "1000", "1010", "1001", "1101", "1100", "1010", "1000", "1010", "1010", "1000", "1001", "1110", "1001", "1100", "1000", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1001", "1100", "1011", "1100", "1000", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1110", "1010", "1000", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1000", "1000", "1001", "1110", "1001", "1100", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1011", "1100", "1010", "1000", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1000", "1001", "1100", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1001", "1100", "1010", "1000", "1000", "1010", "1010", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1010", "1010", "1001", "1101", "1100", "1011", "1100", "1001", "1110", "1010", "1000", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1011", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1000", "1001", "1100", "1010", "1000", "1010", "1000", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1011", "1100", "1010", "1001", "1110", "1000", "1011", "1100", "1001", "1100", "1001", "1100", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1110", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1000", "1001", "1100", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1100", "1010", "1001", "1101", "1100", "1001", "1100", "1010", "1001", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1010", "1010", "1011", "1100", "1010", "1010", "1010", "1001", "1100", "1001", "1110", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1000", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1001"},
//..................... * 549

};


vector<string> DrawMaze(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " ";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "| ";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<string> ShowPath(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{
vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 2; j = ++j)
{
string PrintLayers;

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "XXX";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "XST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "XFN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " XX";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
if ((i + 1 == Rows) && (j == 3) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}

}

if (!PrintLayers.empty())
{
//cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<vector<int>> FindPaths(vector<string> MazePath)
{
int xPos = 0;
int yPos = 0;

int TrueXPos = (1 + (xPos * 3));
int TrueYPos = (1 + (yPos * 2));

bool N = true;
bool E = true;
bool S = true;
bool W = true;

vector<string> Path;
string Direction = "N";
Path.push_back(Direction);
int i = 0;

vector<string> DirectionOrder = { "N", "E", "S", "W" };
string TempDirection;
string DirectFrom = "N";
vector<vector<int>> RouteCoords = { {0,0} };

while (((N == true) || (E == true) || (S == true) || (W == true)) && (i < 60))
{
vector<string> Possibilities = {};
N = false;
E = false;
S = false;
W = false;

if ((TrueYPos - 1 > 0) && (TrueYPos - 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos - 1][TrueXPos] != ' ')
{
N = true;
Possibilities.push_back("N");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos +2 > 0) && (TrueXPos + 2 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos + 2] != ' ')
{
E = true;
Possibilities.push_back("E");
}
}

if ((TrueYPos + 1 > 0) && (TrueYPos + 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos + 1][TrueXPos] != ' ')
{
S = true;
Possibilities.push_back("S");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos - 1 > 0) && (TrueXPos - 1 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos - 1] != ' ')
{
W = true;
Possibilities.push_back("W");
}
}



if (MazePath[TrueYPos][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos-1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos+2] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos+1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos-1] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}

for (int z = 0; z < 4; ++z)
{
//cout << "Checking: " << DirectionOrder[z] << " ";
//cout << "N: " << N << " E: " << E << " S: " << S << " W: " << W << endl;

if ((N == true) && (DirectionOrder[z] == "N"))
{
cout << "Move North" << endl;
Direction = "N";
yPos += -1;
DirectFrom = "S";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((S == true) && (DirectionOrder[z] == "S"))
{
cout << "Move South" << endl;
Direction = "S";
yPos += 1;
DirectFrom = "N";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((W == true) && (DirectionOrder[z] == "W"))
{
cout << "Move West" << endl;
Direction = "W";
xPos += -1;
DirectFrom = "E";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((E == true) && (DirectionOrder[z] == "E"))
{
cout << "Move East" << endl;
Direction = "E";
xPos += 1;
DirectFrom = "W";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
}

Path.push_back(Direction);
auto itr = std::find(DirectionOrder.begin(), DirectionOrder.end(), DirectFrom);
if (itr != DirectionOrder.end()) DirectionOrder.erase(itr);
DirectionOrder.push_back(DirectFrom);

RouteCoords.push_back({xPos,yPos});
TrueXPos = (1 + (xPos * 3));
TrueYPos = (1 + (yPos * 2));
i += 1;
}

for (int b = 0; b < RouteCoords.size(); ++b)
{
cout << "{";

for (int c = 0; c < RouteCoords[b].size(); ++c)
{
cout << RouteCoords[b][c] << ",";
}
cout << "},";
}
cout << endl;

return RouteCoords;
}

void MapRoute(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY, vector<vector<int>> RouteCoords)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();
bool AddRoute = false;

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{
AddRoute = false;
for (int c = 0; c < RouteCoords.size(); ++c)
{
if ((RouteCoords[c][0] == k) && (RouteCoords[c][1] == i))
{
AddRoute = true;
}
}

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + " XX";
}
else
{
PrintLayers = PrintLayers + " ";
}
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + "|XX";
}
else
{
PrintLayers = PrintLayers + "| ";
}
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return;
}


int main()
{
//cout << ExampleMaze[0][0][0] << endl;
//DrawMaze(ExampleMaze, 0, 0, 20, 20);
cout << endl;
MapRoute(ExampleMaze2,0,0,20,20,FindPaths(ShowPath(ExampleMaze2, 0, 0, 20, 20)));

}









share|improve this question














This program is designed to read an array/vector of strings (e.g. 0101) in a grid to show and solve maze's. It works when inputting a 20x20 array however receives "Error C1060: compiler is out of heap space" when trying to compile and run the 550x550 vector.



I've added /Zm200 to the project properties along with increasing the heap commit size exponentially.



I'm running x64 bit Windows 10 with 8GB RAM and using Visual Studio Professional 2017



// MazeBreaker.cpp : This file contains the 'main' function. Program execution begins && ends there.
//

#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

//Creating Variables

vector<vector<string>> ExampleMaze = {
{"1110", "1100", "1111", "1001", "1101", "1000", "1101", "1010", "1001", "1111", "1010", "1001", "1111", "1110", "1111", "1111", "1101", "1010", "1110", "1100"},
{"0111", "0110", "0010", "0000", "1111", "1000", "1011", "0000", "1010", "1010", "1110", "0011", "0011", "0010", "1001", "1011", "0001", "0110", "1010", "0101"},
{"0110", "1110", "1000", "1100", "1010", "0001", "1111", "1100", "0000", "0010", "0011", "0110", "0000", "1110", "0000", "1000", "1111", "0011", "0001", "1101"},
{"0111", "0011", "0000", "0011", "1111", "0100", "1011", "0011", "1100", "0011", "0111", "0011", "0110", "1001", "1100", "0111", "0000", "1001", "0011", "1111"},
{"0101", "1110", "0001", "1010", "1101", "0001", "0001", "1010", "1000", "1011", "0110", "1000", "0011", "1010", "0100", "0001", "0000", "1001", "1001", "1111"},
{"1100", "0010", "1000", "1000", "0001", "1101", "1010", "1011", "1010", "0110", "0011", "1000", "0000", "1111", "1000", "0011", "1011", "1011", "0111", "1101"},
{"1100", "1110", "0011", "0110", "1100", "0100", "1110", "0010", "0000", "0011", "0110", "1100", "1001", "0001", "0111", "0011", "0000", "0001", "0111", "1101"},
{"1110", "1011", "1011", "0000", "0110", "1101", "1001", "0001", "0100", "0101", "1111", "1101", "0000", "1010", "0110", "0101", "0001", "0011", "0111", "1011"},
{"0110", "1110", "1101", "1100", "0010", "1000", "0010", "0110", "1000", "0110", "0001", "1100", "0001", "0111", "1010", "0110", "0000", "1011", "0110", "0101"},
{"0111", "0101", "0100", "0110", "0001", "1000", "1010", "1001", "0110", "1000", "0110", "1011", "1100", "0011", "1110", "1001", "0100", "0100", "0110", "0101"},
{"1110", "1100", "1110", "0010", "0111", "0100", "1100", "0100", "1101", "1100", "0110", "0101", "1110", "1001", "0111", "0110", "0011", "1011", "1111", "1011"},
{"1111", "0101", "0010", "0101", "0110", "1000", "1100", "1011", "1010", "0001", "1110", "1101", "0100", "1010", "1000", "0000", "1011", "0111", "0010", "0111"},
{"0111", "1111", "1001", "0100", "0101", "0101", "1010", "1100", "1101", "0101", "0011", "0111", "0011", "0000", "1101", "0010", "0101", "1010", "0100", "1111"},
{"1111", "1010", "0000", "0110", "1111", "1000", "1010", "0100", "1110", "0100", "1110", "0110", "0101", "1111", "1010", "1100", "0001", "0011", "0101", "0001"},
{"1101", "1111", "1101", "1110", "0011", "0001", "0101", "1001", "0101", "0101", "1000", "1111", "0111", "0100", "1101", "1010", "0001", "0111", "0001", "1111"},
{"0110", "0001", "1100", "0110", "0110", "0000", "1110", "1011", "1001", "1100", "0100", "1000", "0011", "0010", "0111", "0100", "0100", "0101", "1011", "1011"},
{"0110", "1011", "1101", "0010", "1111", "1101", "1010", "1000", "1000", "1111", "1111", "1011", "0101", "0001", "1101", "1010", "0101", "1011", "0100", "1111"},
{"1100", "1001", "1011", "1010", "1101", "0111", "0100", "0110", "0110", "1100", "1110", "1101", "1110", "0001", "0100", "0001", "0001", "0100", "0111", "1001"},
{"1110", "1101", "1100", "0110", "0100", "1101", "1001", "0110", "1011", "0001", "0100", "0011", "0110", "1111", "1101", "0110", "1100", "1011", "1100", "0011"},
{"0111", "1110", "1110", "0110", "0011", "0111", "0011", "1011", "0110", "0010", "1011", "1011", "0010", "1111", "0111", "0110", "1011", "0010", "0010", "0111"}
};

vector<vector<string>> ExampleMaze2 = {
{"1100", "1010", "1010", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1000", "1001", "1110", "1001", "1101", "1100", "1000", "1010", "1000", "1000", "1010", "1000", "1001", "1110", "1001", "1100", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1001", "1101", "1100", "1010", "1010", "1010", "1011", "1100", "1000", "1010", "1001", "1101", "1100", "1010", "1000", "1010", "1010", "1000", "1001", "1110", "1001", "1100", "1000", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1000", "1010", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1001", "1100", "1011", "1100", "1000", "1010", "1010", "1010", "1001", "1101", "1100", "1000", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1001", "1110", "1010", "1000", "1010", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1010", "1010", "1000", "1000", "1001", "1110", "1001", "1100", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1011", "1100", "1010", "1000", "1001", "1100", "1010", "1010", "1000", "1001", "1100", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1000", "1001", "1100", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1001", "1100", "1010", "1000", "1000", "1010", "1010", "1000", "1001", "1110", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1101", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1001", "1100", "1000", "1010", "1010", "1001", "1101", "1100", "1011", "1100", "1001", "1110", "1010", "1000", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1011", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1000", "1011", "1100", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1011", "1100", "1010", "1010", "1010", "1010", "1000", "1001", "1100", "1010", "1000", "1010", "1000", "1011", "1100", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1011", "1100", "1010", "1001", "1110", "1000", "1011", "1100", "1001", "1100", "1001", "1100", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1000", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1110", "1001", "1110", "1001", "1100", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1001", "1100", "1010", "1010", "1010", "1010", "1000", "1010", "1010", "1010", "1000", "1001", "1100", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1000", "1010", "1010", "1010", "1010", "1010", "1010", "1010", "1001", "1110", "1001", "1100", "1010", "1001", "1101", "1100", "1001", "1100", "1010", "1001", "1100", "1001", "1110", "1010", "1010", "1001", "1100", "1010", "1010", "1011", "1100", "1010", "1010", "1010", "1001", "1100", "1001", "1110", "1010", "1001", "1100", "1010", "1001", "1100", "1010", "1010", "1010", "1000", "1000", "1001", "1100", "1010", "1010", "1010", "1001", "1100", "1001"},
//..................... * 549

};


vector<string> DrawMaze(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " ";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "| ";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<string> ShowPath(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY)
{
vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 2; j = ++j)
{
string PrintLayers;

for (int k = 0; k < Columns; k = ++k)
{

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + "XXX";
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "XST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "XFN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
PrintLayers = PrintLayers + " XX";
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + " XX";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + " ";
}
}
if ((i + 1 == Rows) && (j == 3) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + " ";
}

}

if (!PrintLayers.empty())
{
//cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return MazePath;
}

vector<vector<int>> FindPaths(vector<string> MazePath)
{
int xPos = 0;
int yPos = 0;

int TrueXPos = (1 + (xPos * 3));
int TrueYPos = (1 + (yPos * 2));

bool N = true;
bool E = true;
bool S = true;
bool W = true;

vector<string> Path;
string Direction = "N";
Path.push_back(Direction);
int i = 0;

vector<string> DirectionOrder = { "N", "E", "S", "W" };
string TempDirection;
string DirectFrom = "N";
vector<vector<int>> RouteCoords = { {0,0} };

while (((N == true) || (E == true) || (S == true) || (W == true)) && (i < 60))
{
vector<string> Possibilities = {};
N = false;
E = false;
S = false;
W = false;

if ((TrueYPos - 1 > 0) && (TrueYPos - 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos - 1][TrueXPos] != ' ')
{
N = true;
Possibilities.push_back("N");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos +2 > 0) && (TrueXPos + 2 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos + 2] != ' ')
{
E = true;
Possibilities.push_back("E");
}
}

if ((TrueYPos + 1 > 0) && (TrueYPos + 1 < MazePath.size()) && (TrueXPos > 0) && (TrueXPos < MazePath[0].size()))
{
if (MazePath[TrueYPos + 1][TrueXPos] != ' ')
{
S = true;
Possibilities.push_back("S");
}
}

if ((TrueYPos > 0) && (TrueYPos < MazePath.size()) && (TrueXPos - 1 > 0) && (TrueXPos - 1 < MazePath[0].size()))
{
if (MazePath[TrueYPos][TrueXPos - 1] != ' ')
{
W = true;
Possibilities.push_back("W");
}
}



if (MazePath[TrueYPos][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos-1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos+2] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos+1][TrueXPos] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}
if (MazePath[TrueYPos][TrueXPos-1] == 'F')
{
cout << "Finished" << endl;
return RouteCoords;
}

for (int z = 0; z < 4; ++z)
{
//cout << "Checking: " << DirectionOrder[z] << " ";
//cout << "N: " << N << " E: " << E << " S: " << S << " W: " << W << endl;

if ((N == true) && (DirectionOrder[z] == "N"))
{
cout << "Move North" << endl;
Direction = "N";
yPos += -1;
DirectFrom = "S";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((S == true) && (DirectionOrder[z] == "S"))
{
cout << "Move South" << endl;
Direction = "S";
yPos += 1;
DirectFrom = "N";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((W == true) && (DirectionOrder[z] == "W"))
{
cout << "Move West" << endl;
Direction = "W";
xPos += -1;
DirectFrom = "E";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
if ((E == true) && (DirectionOrder[z] == "E"))
{
cout << "Move East" << endl;
Direction = "E";
xPos += 1;
DirectFrom = "W";
cout << "X: " << xPos << " Y: " << yPos << endl;
break;
}
}

Path.push_back(Direction);
auto itr = std::find(DirectionOrder.begin(), DirectionOrder.end(), DirectFrom);
if (itr != DirectionOrder.end()) DirectionOrder.erase(itr);
DirectionOrder.push_back(DirectFrom);

RouteCoords.push_back({xPos,yPos});
TrueXPos = (1 + (xPos * 3));
TrueYPos = (1 + (yPos * 2));
i += 1;
}

for (int b = 0; b < RouteCoords.size(); ++b)
{
cout << "{";

for (int c = 0; c < RouteCoords[b].size(); ++c)
{
cout << RouteCoords[b][c] << ",";
}
cout << "},";
}
cout << endl;

return RouteCoords;
}

void MapRoute(vector<vector<string>> Maze, int StartX, int StartY, int FinishX, int FinishY, vector<vector<int>> RouteCoords)
{

vector<string> MazePath;

int Rows = Maze.size();
int Columns = Maze[0].size();
bool AddRoute = false;

for (int i = 0; i < Rows; ++i)
{
for (int j = 0; j < 3; j = ++j)
{
string PrintLayers = "";

for (int k = 0; k < Columns; k = ++k)
{
AddRoute = false;
for (int c = 0; c < RouteCoords.size(); ++c)
{
if ((RouteCoords[c][0] == k) && (RouteCoords[c][1] == i))
{
AddRoute = true;
}
}

bool CheckStartFinish = false;

if (((StartX == k) && (StartY == i)) || ((FinishX == k + 1) && (FinishY == i + 1)))
{
CheckStartFinish = true;
}

if (j == 0)
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
else if (j == 1)
{
if (Maze[i][k][j] == '0')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + " XX";
}
else
{
PrintLayers = PrintLayers + " ";
}
}
else if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + " ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + " FN";
}
}
}
else if (Maze[i][k][j] == '1')
{
if (CheckStartFinish == false)
{
if (AddRoute == true)
{
PrintLayers = PrintLayers + "|XX";
}
else
{
PrintLayers = PrintLayers + "| ";
}
}
if (CheckStartFinish == true)
{
if (StartX == k)
{
PrintLayers = PrintLayers + "|ST";
}
if (FinishX == k + 1)
{
PrintLayers = PrintLayers + "|FN";
}
}
}
}

if ((j == 0) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}
else if ((j == 1) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "|";
}
if ((i + 1 == Rows) && (j == 2))
{
if (Maze[i][k][j] == '0')
{
PrintLayers = PrintLayers + "+ ";
}
else if (Maze[i][k][j] == '1')
{
PrintLayers = PrintLayers + "+--";
}
}
if ((i + 1 == Rows) && (j == 2) && (k + 1 == Maze.size()))
{
PrintLayers = PrintLayers + "+";
}

}

if (!PrintLayers.empty())
{
cout << PrintLayers << endl;
MazePath.push_back(PrintLayers);
}
}
}
return;
}


int main()
{
//cout << ExampleMaze[0][0][0] << endl;
//DrawMaze(ExampleMaze, 0, 0, 20, 20);
cout << endl;
MapRoute(ExampleMaze2,0,0,20,20,FindPaths(ShowPath(ExampleMaze2, 0, 0, 20, 20)));

}






c++






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 27 '18 at 9:18









BadgerHobbsBadgerHobbs

142




142








  • 1





    Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

    – Some programmer dude
    Nov 27 '18 at 9:22






  • 2





    As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

    – Some programmer dude
    Nov 27 '18 at 9:24











  • @Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

    – BadgerHobbs
    Nov 27 '18 at 11:25











  • A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

    – Some programmer dude
    Nov 27 '18 at 12:27











  • Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

    – BadgerHobbs
    Nov 27 '18 at 12:47














  • 1





    Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

    – Some programmer dude
    Nov 27 '18 at 9:22






  • 2





    As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

    – Some programmer dude
    Nov 27 '18 at 9:24











  • @Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

    – BadgerHobbs
    Nov 27 '18 at 11:25











  • A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

    – Some programmer dude
    Nov 27 '18 at 12:27











  • Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

    – BadgerHobbs
    Nov 27 '18 at 12:47








1




1





Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

– Some programmer dude
Nov 27 '18 at 9:22





Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly learn how to create a Minimal, Complete and Verifiable Example.

– Some programmer dude
Nov 27 '18 at 9:22




2




2





As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

– Some programmer dude
Nov 27 '18 at 9:24





As for your problem, why do you hard-code all that? Can't you use a file that you read when (and if) needed?

– Some programmer dude
Nov 27 '18 at 9:24













@Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

– BadgerHobbs
Nov 27 '18 at 11:25





@Someprogrammerdude Currently it uses a hard-coded vector because it gets information from it such as sizes. This is then used to create another vector which shows all the paths that exist within the maze, which is then read and analysed to calculate the final maze solution. The code is a translation from a initial piece of python code i created, which had no issue handling such large arrays. I'm not sure how it would work if using a file, since it needs access to different sizes, positions and lines of the vector and i don't know how line and positional access works with a txt and c++.

– BadgerHobbs
Nov 27 '18 at 11:25













A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

– Some programmer dude
Nov 27 '18 at 12:27





A simple text file containing the strings could easily be read into your vectors. While it would affect the start-up time of the program it won't be by much. It will also be more flexible if you're going to continue to develop the program, especially since you can then load new data on-demand. And most importantly of all, it won't put much strain on the compiler.

– Some programmer dude
Nov 27 '18 at 12:27













Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

– BadgerHobbs
Nov 27 '18 at 12:47





Ok thanks, I'll have to check that out. Is it possible to read a line from a text file in the format of a vector, and then set it as a vector variable? As I know with Python you can just read a txt in the format of an array, and then convert is into a array variable.

– BadgerHobbs
Nov 27 '18 at 12:47












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53496268%2ferror-c1060-compiler-is-out-of-heap-space-when-trying-to-compile-a-550x550-ve%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53496268%2ferror-c1060-compiler-is-out-of-heap-space-when-trying-to-compile-a-550x550-ve%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)