[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I attempted to make a Tic Tac Toe in C# using Winforms. Now I
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 19
Thread images: 2
File: images.png (6 KB, 225x225) Image search: [Google]
images.png
6 KB, 225x225
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
see >>55200613
>>
>>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
>>
File: ttt.png (17 KB, 598x386) Image search: [Google]
ttt.png
17 KB, 598x386
>>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
Thread replies: 19
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.