for (int x = 0; x <= GameArea.x + 1; x++)
{
for (int y = 0; y <= GameArea.y + 1; y++)
{
for (int z = 0; z <= GameArea.z + 1; z++)
{
//i dont know much about who wrote this. but praise be to you, sean bridges. genuinely saved me over 2000 lines of code with this one small snippet
for (int w = 0; w <= GameArea.w + 1; w++)
{
//if we have at least 1 x
if ((w == GameArea.w) | (z == GameArea.z) | (y == GameArea.y) | (x == GameArea.x))
{
//if all -x's occur after at least 1 x
if (
(x == GameArea.x) ||
((y == GameArea.y) & (x != GameArea.x + 1)) ||
((z == GameArea.z) & (x != GameArea.x + 1) & (y != GameArea.y + 1)) ||
((w == GameArea.w) & (x != GameArea.x + 1) & (y != GameArea.y + 1) & (z != GameArea.z + 1))
)
{ //we have a valid line.
PossibleWins.Add(TranslateWin(new Vector4Int(x, y, z, w)));
Debug.Log(x + " " + y + " " + z + " " + w);
}
}
}
}
}