I'm really inexperienced with cycles, so I want to make this code shorter. As far as I know, I've made a recursive cycle.
for (Pointers[0] = 0; Pointers[0] < 8; Pointers[0]++)
if (AdjM[Pointers[0], VertStart + 0])
{
for (Pointers[1] = 0; Pointers[1] < 8; Pointers[1]++)
{
if (AdjM[Pointers[1], Pointers[0]])
if (Pointers[1] == VertEnd)
AddPath(2);
for (Pointers[2] = 0; Pointers[2] < 8; Pointers[2]++)
{
if (AdjM[Pointers[2], Pointers[1]])
if (Pointers[2] == VertEnd)
AddPath(3);
for (Pointers[3] = 0; Pointers[3] < 8; Pointers[3]++)
{
if (AdjM[Pointers[3], Pointers[2]])
if (Pointers[3] == VertEnd)
AddPath(4);
for (Pointers[4] = 0; Pointers[4] < 8; Pointers[4]++)
{
if (AdjM[Pointers[4], Pointers[3]])
if (Pointers[4] == VertEnd)
AddPath(5);
for (Pointers[5] = 0; Pointers[5] < 8; Pointers[5]++)
{
if (AdjM[Pointers[5], Pointers[4]])
if (Pointers[5] == VertEnd)
AddPath(6);
for (Pointers[6] = 0; Pointers[6] < 8; Pointers[6]++)
{
if (AdjM[Pointers[6], Pointers[5]])
if (Pointers[6] == VertEnd)
AddPath(7);
for (Pointers[7] = 0; Pointers[7] < 8; Pointers[7]++)
{
if (AdjM[Pointers[7], Pointers[6]])
if (Pointers[7] == VertEnd)
AddPath(8);
}
}
}
}
}
}
}
}
I'm pretty sure it's easy to compress, but I don't see how. Please do not tell me to change the algorithm; it has to be like this.
Pointers[]
represent? What does theAdjM
function do/check? What does theAddPath()
function do? What doVertStart
andVertEnd
represent? What are you trying to accomplish with this code? \$\endgroup\$