ـّّّ Jordan't ـّّّ
ـّّّ Jordan't ـّّّ
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
i think this works. still got a few bugs leftover from the old version but i think i know the fix to those
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
im not sure how to recursively do this check as N increases
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
i do. the main problem is this line here
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))
)
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))
)
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
Many times. Only even found the 4D algorithm after about a year of searching lol
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
nope, chatGPT didn't work
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
nvm. i think chatGPT got the answer (still gotta test it)
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
full script
19 replies
CC#
Created by ـّّّ Jordan't ـّّّ on 1/30/2025 in #help
extending noughts and crosses into N dimensions
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);
}
}
}
}
}
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);
}
}
}
}
}
19 replies