I attempted to make a Tic Tac Toe in C# using Winforms. Now I want to check if either the play or the computer has one. But I don't know where to put my while(true) block. help.
>>55200408
Jesus Christ what the fuck is wrong with me.
I meant, I'm trying to make a Tic Tac Toe using C# in WPF. Now, I have made 9 buttons and an enum that incorporates idle, player-set and computer-set. Now I don't know where to put my while(true) block that checks whether the player or the computer has *won.
> not writing seq diagrams before programming
Think this one through OP.
When do you check to see if you have lost the game?
>>55200510
All the time.
>>55200527
For a turn-based game?
>>55200527
Wrong. You only need to look at the board once to see if you lost. Looking at it again is unnecessarily redundant, for the most part.
>>55200551
>>55200546
But what if I lost since the last time I looked? One time I played minesweeper for 6 hours but it turned out I had lost on the 5th turn.
Check after you place a piece on the board. If the game isn't over, switch sides and continue the game.
>>55200610
Exactly, once you looked at the board after some arbitrary *turn*, Minesweeper knew if you had lost the game. It only needed to look at the board once to figure this out.
>>55200778
But what if I lose after it looks?
>>55200791
When can you lose?
>>55200804
Yeah but what if I lose AFTER that?
>>55200831
Not possible. Check every time you place a piece.
>>55200826
After it looks.
>>55200840
Yeah okay but what if I lose between placing pieces? Like I put one down then my enemy does and THEN I lose
>>55200845
>It's your turn anon
>Hold on, let me see if I lost
>...
>Anon, are you okay?
>Shut up! I can still lose here, even if I don't make a move!
>...
> We can't be friends anymore anon. Goodbye
>Bye
>>55200857
Check after the computer places a piece too. Ideally using the same method. This is what I did when I had to make a ttt game for class