✅ how do i create a constant process to check for the win condition in tictactoe?
i have created a visual tictactoe game and am struggling on triggering the win condtion, it seems to ignore my if statement looking for win conditions
9 Replies
these are the 2 win condtions (one for the player where 1 = a cross)
and one for the cpu where 2 = a nought
(0 being blank)
when a cross or nought is placed on the grid
Well, you run this code in the constructor, so it will always execute exactly once: when the form is created
the 2d array board value is changed to fit the value
how can i make it run indefinitely in the background?
Don't
You want to run the check whenever the player or the CPU makes a move
if i make it check each time something is placed
it seems to mess something up and only do 2 full turns
Well, try to fix that, then
whereas right now it does a full game
well i did and it doesnt seem to work
Running the check in the constructor is not the way to go
Running the check constantly, on repeat, is not the way to go either
Your first idea was the best
So now we just need to fix whatever was wrong with it's implementation
ive set bool variables for each button was clicked