Andres John wrote:i already did that which is this
...
using For Loop
which isn't creating
methods.
i just need to find all the possible diagonal. I think i'm missing few of them.
Which is probably because you haven't broken the problem down enough. Monolithic code like that, especially when it involves multi-layered loops, can become incrediby difficult to follow, so my suggestion would be something like this:
1. You know how to find a winning line on a 2D board. Well, in an NxNxN cube there are 3N "planes" or "sections" - N for each of the x, y and z dimensions - each of which is the equivalent of a 2D TTT board. Write a method that returns you a single plane of NxN squares (the x dimension planes are dirt simple; the y and z ones only marginally more difficult).
2. Run the method for each plane in your cube, and check what it returns just like you would an ordinary TTT board.
3. The only "lines" left to process after that are your 4 "apex-to-apex" diagonals.
HIH
Winston