what happens if the random function in computer moves picks a already filled space?
@shinayang-um7mk9 ай бұрын
1:51
@SalKulti5 ай бұрын
Why was !number used instead of just the norma, number 0?
@andarling9742 Жыл бұрын
u could check winner by creating an an array of playermoves and check if there are 3 numbers that when num1 - num2 = num2 - num3 && num1-num2
@narayanswamyghanta315 Жыл бұрын
Looking at this game code, I understood that i lack in algorthimic thinking.
@zeelfarshmek111Ай бұрын
same :/ i read and re reread the code and i understand what does what but ask me to remake the code from scratch and il draw a blank :(
@minkhantsaw04282 күн бұрын
Use 2d array instead.
@siddharthjain6629Ай бұрын
You are amazing Bro !!!! My concepts regarding the programming languages are getting good day by day. Thank you for sharing such amazing content
@DawoodRizwan-k7f4 ай бұрын
so good bro...
@guillermofrancella087 ай бұрын
Bro is back with the Code. Love you man.
@conornorris8014Ай бұрын
And why no for loop for grid creation?
@RaviYadav-wm7tp3 ай бұрын
30 mins in half way there, yet to create the winning criteria this was really helpful
@ra2dsla72 жыл бұрын
could u please explain the condition in details (!number > 0 || !number < 8)?
@shintiao17322 жыл бұрын
@koji is not the same, you try input the same number in player and you will know that.
@ali_gd_0161 Жыл бұрын
Think of it as ( !(number >0) || !(number < 8) The ! Operator changes the boolean value of the condition in front of it. E.g if it's true it becomes false
@nicko4140 Жыл бұрын
@@ali_gd_0161 im confused how it loops after you select a non empty space. is the !number>0 || !number
@hupmitom5509 Жыл бұрын
number = 1 the logic is the same. I think it is easier to understand.
@BroDevsRBLX Жыл бұрын
It just means as long as the number is 8 the loop will execute@@Kak-koi
@FrederikWollert8 ай бұрын
Good Video Bro.
@havocblast6 ай бұрын
I ended up taking this idea an started working on a terminal submarine hunting game where you are trying to sink a submarine that is hiding/moving around under the water. I do need to figure out how to make drawing the board faster since I am using colors to print a grid of blue spaces in the terminal for the water. Board is currently 40 by 80. Thanks for bringing me down that rabbit hole lol
@conornorris8014Ай бұрын
I'm learning Cpp can someone explain why the functions are written inside the main function and not above for modulation? My tutor did the same thing but it doesn't make sense to me.
@firestickman46053 ай бұрын
thank you so much!
@shintiao17322 жыл бұрын
if we never use the "char computer" in cheakWinner function ,why need to import this parameter?
@anvrag Жыл бұрын
for fun..
@kshitijsrivastava8312 Жыл бұрын
For me its showing an exception report after performing the code, telling its a bug.
@ShadowLogic32535 ай бұрын
you said originally you would have used switch statements but I thought they could only be used with ints
@baconheadhair69382 ай бұрын
They can be used with singlr digit things like ints and chars but not for things like strings
@HunaBopa Жыл бұрын
Bro, I have a question for you. Look, we did implement the minimax algorithm in Python and create an AI Tic Tac Toe player that is invincible. However, in C++ it's a daunting task for me. Can you help me implement the minimax algorithm in C++?
@baconheadhair69382 ай бұрын
i am the one who is invincible
@VuQuangVinhA-zr6vv15 күн бұрын
Have you coded it yet?
@novaldwiputra5816Ай бұрын
bro, how to fix this problem? If I fill in X in the same place, but the computer still chooses the place randomly :(
@phamduy6013Ай бұрын
I thought when you pass array to a function you have to include the size, why can you not pass the size in this example and it's still work?
@phamduy6013Ай бұрын
I'm a beginner, just explain to me
@Sam-gv9tvАй бұрын
because you are passing in the pointer in this case
@phamduy6013Ай бұрын
@@Sam-gv9tv thanks, but can you give me a clearer explanation?
@yesyes6288 күн бұрын
i think its because we already know the board will be size 9 so we dont need to calculate it
@Sam-gv9tv8 күн бұрын
@@phamduy6013 when you pass an array inside a function normally, which means pass by value you HAVE TO include the size. When we are talking about pointers, since pointers and arrays are somehow interconnected, when u pass a pointer it always points to the first element of the array. In fact if you derefrence the pointer u will see it points to the first element, try adding +1, +2 to the derefrenced pointer and u will see it will point to the next members. So +1 means it will point to the second member etc. so this is usefull to know how you loop through an array using pointers, u derefrnece it and add “i” which increments so for example: cout
@gamsterilyass29526 ай бұрын
Assembly ?
@zeelfarshmek111Ай бұрын
i had a strange error happen...i tied on the last move with my last move being on the 6th block and it came out with "its a tie" but i double checked the code and its not possible. Tried to replicate it but it did not happen again. Otherwise i understood this code perfectly after checking out what does what ...strangely tho even tho i know all this i doubt i could replicate it from scratch : / so strange that i can understand but doubt i can remake it without help.
@quartzisgames149621 күн бұрын
I'm guessing you mean you won on the last turn. It's because checkTie() doesn't check if there is a winner. Basically, no matter how the grid is filled, if it's filled it considers it's a tie. What you could do if that bothers you is using checkTie() inside of checkWinner(), so you can first determine if there's a winner, and then if there is no winner check for a tie. It should work :)
@jessechen2132 Жыл бұрын
When a user enters a letter rather than a number, the program crashes. Do you know how to solve it?
@anvrag Жыл бұрын
std::cin.clear(); fflush(stdin); use this two lines of powerful code which will help u to prevent crashes (use it below the input)
@FlorrioEggGaming Жыл бұрын
@@anvrag truly powerful code
@Toothless_Rides10 ай бұрын
@@anvrag how? when I coded this in, it became an infinite loop...
@NovaStargazer233 ай бұрын
@@Toothless_Rides Fflush(stdin) not work for linux Use while(cin.get() != ' ') { continue; }
@baconheadhair69382 ай бұрын
@@Toothless_Ridesyou could also make it accept a char value insteas and then just use isdigit() to make sure its a number and stoi() to convert it to an int
@triculex28544 ай бұрын
while(!num>0 || !num
@diosinvicto3 ай бұрын
I hate a double negation😂😂.... But this one's better while(number < 0 || number > 8)
@baconheadhair69382 ай бұрын
@@diosinvictoThat isnt a double negation, its just two negations. A double negation is negating a negation. Your code also isn’t „better“. It quite literally does the exact same thing