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

I attempted to make a Tic Tac Toe in C# using Winforms. Now I

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 2

File: images.png (6KB, 225x225px) Image search: [Google]
images.png
6KB, 225x225px
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 (17KB, 598x386px) Image search: [Google]
ttt.png
17KB, 598x386px
>>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 posts: 19
Thread images: 2


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.