First of all I have to admit that this tutorial is really good, but there is one problem. If you win with the last turn, it just says „Thats a draw“ .I guess you have to add an else{CheckDraw()}
@ShaunHalverson2 жыл бұрын
Thank you and thank you for the tip as well, it’s hard to handle all cases but I will pin a comment for future viewers!
@cljalamana11904 жыл бұрын
This channel is by far the best way to learn
@cljalamana11904 жыл бұрын
But i do recommend when you write code you say the code and zoom in so that we dont need to set quality to 720p and load longer and put our eyes on the screen to see the code
@ShaunHalverson4 жыл бұрын
I'm glad you think so! This comment means alot, thank you very much :)
@ShaunHalverson4 жыл бұрын
@@cljalamana1190 I will keep that in mind! Was the level of Zoom that i had on this video okay ? Or should I zoom in even more than i already did ?
@cljalamana11904 жыл бұрын
@@ShaunHalverson i reccomend zooming in much more
@Havii4 жыл бұрын
@@ShaunHalverson For VStudio this is actually pretty okay. For web videos, zoom in would be very useful since it's pretty small and it hurts my eyes if I have to focus hard 😅 But like he said, definitely the best channel to learn. I love your videos a lot.
@thomasprinsen12473 жыл бұрын
Thank you for these awesome videos!
@ShaunHalverson2 жыл бұрын
Glad you like them!
@balkanxd59003 жыл бұрын
You are the best chanell for learn.
@ShaunHalverson3 жыл бұрын
Thank you :)
@Awesomebaws333 жыл бұрын
Your case 6 and 7 on CheckForWinner function are a bit wrong. For example the index for case 6 should be" combination = gameboard[1], [4] and [7]" for the vertical winning line. The first index gameBoard[2] is the only incorrect number in your combination code for case 6 :). Error came from writing 1,2,3 at the top line boxes instead of 0,1,2 @16:00. Other than that an excellent tutorial video!
@ShaunHalverson3 жыл бұрын
Thank you for the feedback!
@itz_jiryn81623 жыл бұрын
Wery helpful, thack you!
@ShaunHalverson3 жыл бұрын
Glad to hear it!
@sam_the_yardman2 жыл бұрын
this video is good, no cap
@mstrnabeel26053 жыл бұрын
Nice dude, very helpfull. But i have a query. If we double click on a button that button will change from X to O or O to X.. that needs to be validate. How will we do that.
@mstrnabeel26053 жыл бұрын
Also if we have more than one combinations to win then it also shows us game is drawn.
@ShaunHalverson3 жыл бұрын
Hmmm. Thank you for reporting these bugs! I will need to glance at the code and get back to you with how to fix it.
@mstrnabeel26053 жыл бұрын
Thanks dude ! 👏
@ShaunHalverson2 жыл бұрын
So I just took a look, maybe try moving checkdraw() after the winning if/else statements? That way the winner will be checked first and if there isn't one, it will then check for a draw. Let me know how that works.
@mstrnabeel26052 жыл бұрын
Ok I'll check..
@zero-94352 жыл бұрын
Hi there is the problem that if you win with the last turn, it just keeps saying „Thats a draw“ and it doesnt work with else checkfordraw. Do you maybe know how to fix this issue?Thy
@purd6913 жыл бұрын
When I write “button1.Text = gameBoard[0]; it says “CS0103 The name ‘button1’ dose not exist in the current context” may you please help
@ShaunHalverson3 жыл бұрын
That kind of looks like your button1 might be in a spot that isn’t accessible to everything. Can I see your code somehow?
@agentbomz12223 жыл бұрын
Can you pls make a vid so u can play with an ai? I have mid term on this and I have no idea how to do it
@ShaunHalverson3 жыл бұрын
I would love to, but I unfortunately don't have any experience with AI yet. I would like to get into that for future videos tho. Just super complicated stuff!
@agentbomz12223 жыл бұрын
It's ok :)
@EeveeShadowBacon2 жыл бұрын
My i's for the (i=0,i
@ShaunHalverson2 жыл бұрын
You need to say int i=0 in the first part
@ShaunHalverson2 жыл бұрын
Also make sure you have semicolons in between each one for(int i=0; i < 8; i++)
@EeveeShadowBacon2 жыл бұрын
@@ShaunHalverson got it, thanks
@mackl05333 жыл бұрын
For my if(combination.Equals(“000”)) it keeps saying system.NullreferenceException : object reference not set to an instance of an object Pls help
@ShaunHalverson3 жыл бұрын
I think it’s complaining that your combination variable is not being set somewhere and by the time the if fires, there’s no .equals property to access because the object is null
@mackl05333 жыл бұрын
@@ShaunHalverson so how would I go about fixing it
@ShaunHalverson3 жыл бұрын
@@mackl0533 check your combination variable and compare it with the video to see if you missed anything. If you can't find anything, you can add me on discord @ Shaun#5626 or paste your code here and I can take a look
@fizamubeen77012 жыл бұрын
Hey sir can you please give this game source code because I have some error
@ShaunHalverson2 жыл бұрын
I actually got a new computer and don’t have the source code anymore lol, but what is your error? I can try to help
@FunTimesWithGray3 жыл бұрын
Hello i have a problem which is only the button 1 shows the letter X and O and everytime I click it shows that there is a winner even tho i only click once Here is my code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace TicTacToe { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string[] gameboard = new string[9]; int currentturn = 0; public string returnSymbol(int turn) { if (turn % 2 == 0) { return "0"; } else { return "X"; } } public void checkForWinner() { for (int i = 0; i < 8; i++) { string combination = ""; switch (i) { case 0: combination = gameboard[0] + gameboard[4] + gameboard[8]; break; case 1: combination = gameboard[2] + gameboard[4] + gameboard[6]; break; case 2: combination = gameboard[0] + gameboard[1] + gameboard[2]; break; case 3: combination = gameboard[3] + gameboard[4] + gameboard[5]; break; case 4: combination = gameboard[6] + gameboard[7] + gameboard[8]; break; case 5: combination = gameboard[0] + gameboard[3] + gameboard[6]; break; case 6: combination = gameboard[1] + gameboard[4] + gameboard[7]; break; case 7: combination = gameboard[2] + gameboard[5] + gameboard[8]; break; } if (combination.Equals("")) { MessageBox.Show("O has won the game", "we have a winner!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("X has won the game", "we have a winner!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } private void button1_Click(object sender, EventArgs e) { currentturn++; gameboard[0] = returnSymbol(currentturn); button1.Text = gameboard[0]; checkForWinner(); } private void button2_Click(object sender, EventArgs e) { currentturn++; gameboard[1] = returnSymbol(currentturn); button1.Text = gameboard[1]; checkForWinner(); } private void button3_Click(object sender, EventArgs e) { currentturn++; gameboard[2] = returnSymbol(currentturn); button1.Text = gameboard[2]; checkForWinner(); } private void button4_Click(object sender, EventArgs e) { currentturn++; gameboard[3] = returnSymbol(currentturn); button1.Text = gameboard[3]; checkForWinner(); } private void button5_Click(object sender, EventArgs e) { currentturn++; gameboard[4] = returnSymbol(currentturn); button1.Text = gameboard[4]; checkForWinner(); } private void button6_Click(object sender, EventArgs e) { currentturn++; gameboard[5] = returnSymbol(currentturn); button1.Text = gameboard[5]; checkForWinner(); } private void button7_Click(object sender, EventArgs e) { currentturn++; gameboard[6] = returnSymbol(currentturn); button1.Text = gameboard[6]; checkForWinner(); } private void button8_Click(object sender, EventArgs e) { currentturn++; gameboard[7] = returnSymbol(currentturn); button1.Text = gameboard[7]; checkForWinner(); } private void button9_Click(object sender, EventArgs e) { currentturn++; gameboard[8] = returnSymbol(currentturn); button1.Text = gameboard[8]; checkForWinner(); } } }
@balkanxd59003 жыл бұрын
When I type combination = gameBoard[0] + gameBoard[4] = gameBoard[8]; and then say is error
@ShaunHalverson3 жыл бұрын
Hi! So the issue with that example is that you can’t have 2 equal signs in one statement. Did you mean to type that?
@JusteYoki3 жыл бұрын
gg
@AMOiLLi Жыл бұрын
Hi there is the problem that if you win with the last turn, it just keeps saying „Thats a draw“ and it doesnt work with else checkfordraw. Do you maybe know how to fix this issue?