posted 5 years ago
Hello guys,
I tried to write a Tic Tac toe game today and I will hopefully learn to set up a GUI for it soon.
I did it all in one class - assinged numbers from one to nine and im letting the user pass the numbers the players want to occupy into Array Lists.
If one of the ArrayLists assinged to a player (either cross or circle) containts certian numbers (meaning if the player occupies certian squares 3 in a row) one player wins.
I do have a while loop for the progress of the game that does work, but it just doesnt feel practical to jam the definition for my variable "winCheck" 5 times there.
Without those definitions the second part with moveCirclePlayer(*) method is called one time too much.
Depending on how the game plays out, the "winCheck" definitions are required on different places.
Do you have an idea on how I can structure it so that the moveCirclePlayer(*) method doesnt execute again?