Tic Tac Toe winning logic for programmers

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
    All the learning resources such as code files, documentations, articles and community discussions are available on our website:
    chaicode.com/
    You can find our discord link, github link etc on the above website.
    Twitter/X link: x.com/hiteshdotcom
    Discord link: hitesh.ai/discord
    Learn React with 10 projects: • Let's learn react from...
    Learn Docker: • A practical guide on D...
    Learn Kubernetes: • Complete Kubernetes Co...
    How does a browser works: • How does a browser wor...
    How nodejs works: • How node JS works | En...
    Learn Redux-toolkit: • Learn Redux Toolkit in...
    Learn NextJS: • Nextjs Full stack course
    Learn Typescript: • Why to learn Typescript
    Learn Javascript: • Welcome to new JavaScr...
    Learn React Native: • React Native Mastery: ...
    Learn Zustand: • React state management...
    Learn Golang: • How to get started wit...
  • Věda a technologie

Komentáře • 183

  • @sujithsaikalakonda4863
    @sujithsaikalakonda4863 Před 2 lety +7

    I absolutely loved your explanation sir. I thought of making this game from last 5 months, but I couldn't make it. I decided to make a game till the end of 2021. So I sat at 11:30pm on 31st dec 2021, I saw the TITLE of the video is interesting and started watching, It was so impressive and I started making own cases and started writing code. I divided the progress of game into small parts/tasks and Finally at 1:30 I completed. However the code is very big. But the game is just with if else and loops. I was motivated a lot with this video and just wanted to share. Thank you very very very very much sir. And make some more logical videos like this.
    STAY SAFE.

  • @clasherdamn5862
    @clasherdamn5862 Před rokem +2

    I am learning react and yess I am at tic tac toe chapter and I got the logic now heading back
    It's such a great explanation 👍🏻

  • @jayeshfirke1507
    @jayeshfirke1507 Před 5 lety +9

    Its really simple logic to understand pls make more stuff like that

  • @vivekshukla9485
    @vivekshukla9485 Před 3 lety +2

    Came here while learning Angular from LCO. I was concerned how we will do it but the way you explained was really awesome!

  • @TunsalatOgTomat
    @TunsalatOgTomat Před 4 lety +7

    jeez you made that easy, thank you bhaee... greetings from denmark :)

  • @anshpng
    @anshpng Před 5 lety +9

    We can make the code more efficient by creating a 3x3 matrix from a 2D array and then running 2 loops to check conditions for horizontal and vertical boxes.

    • @samantasunanda
      @samantasunanda Před rokem

      Even your comment hold O(n^2) time complexity, writing small code makes it efficient?

  • @mdwaqar4702
    @mdwaqar4702 Před 5 lety

    Just thinking about that and not wanted to take any kind of help from internet but as I don't want to miss any of your video. I watched it and its damn simple logic.

  • @asimtarapathak8648
    @asimtarapathak8648 Před 5 lety +11

    Loved this video ❤️. It's was so easy and simple logic.

  • @supentamu3073
    @supentamu3073 Před rokem +2

    Great job Hitesh Marvellously simple . I loved it .😍

  • @ravigunz
    @ravigunz Před 5 lety +1

    come here from LCO's, complete flutter course, simply amazing explanation. thank you!

  • @venkateshnambi1576
    @venkateshnambi1576 Před 3 lety +8

    came hear to build this game in react .. Basics first! then next!!!

  • @BeyondRecognitionLifestyle

    You made this really easy to understand. Thank you!

  • @nayhamanzoor1848
    @nayhamanzoor1848 Před 3 lety +1

    I'm designing tic tac toe in Oracle development.....love this video ....it clears my logic ... thank you sir

  • @hrithikchavva6127
    @hrithikchavva6127 Před 5 lety +1

    I loved this video !!! Thank u sir for letting me know how to go for standard approach for such problems

  • @AmanKumar-tv1yl
    @AmanKumar-tv1yl Před 4 lety +2

    Hi Hitesh,
    You are simply amazing. You have the skills to make complex things easy to understand.

  • @jayanthm2597
    @jayanthm2597 Před 5 lety +1

    Thank you,my everyday challenges and doubts are always solved by you...

  • @abhinavchauhangujjar6456
    @abhinavchauhangujjar6456 Před 5 lety +29

    And Sir, we don't have to check anything until any of zero or cross move at least 3 times, in other words at least 5 box should be filled or 4 moves should pass before doing any checking, and i observed that first mover can play at most 5 times and second mover can play at most 4 times, can we use that fact for efficiency.

    • @SichuunduW762
      @SichuunduW762 Před 4 lety

      hello! look at this.making use of a two dimensional array,write the code that permits two players to play a game of tic tac toe (also known as noughts and crosses). use 0 to represent an empty square.1 to represent a cross, and 2 to represent a nought.
      this requires implementing several algorithms;
      asking for the user`s input and placing their symbol
      looping between two different players alternating the symbol
      checking for a win.
      must be done in java.
      show the pseudocode and the java code

    • @tejaswipandava
      @tejaswipandava Před 3 lety

      Ya, I was also thinking the same thing. The first thing we need to do is have an if the check for the total no of turns in case they exceed 4. if they exceed we can start our logic. Also, one more idea I was getting is instead of having 8 checks (row, column, and diagonals) why not reduce the check. I mean when ever a user selects a value (say position 8) let's check all possible combinations with that position that would reduce the checks to max 3. (positions [0,4,8],[2,5,8][6,7,8])

  • @darshanthakral5505
    @darshanthakral5505 Před 5 lety +1

    Was actually stuck at that point,
    Thanks for helping us..😊😊

  • @raghuakuthota4900
    @raghuakuthota4900 Před 5 lety

    Loved this video... pretty simple :) - thank you so much

  • @creatorsconnect8807
    @creatorsconnect8807 Před 5 lety

    I love ur logic pls make more such kind of stuff .

  • @bhalsodnirva104
    @bhalsodnirva104 Před 5 lety +1

    OMG...started loving yr channel more...😍😍😍😍That was so easy and interesting..plz plz plz add videos like this to build the logic..humble request

  • @coolpot
    @coolpot Před 2 lety

    this guy is great, his udemy on angular is what everyone else should aspire to, also i often have trouble understanding indian accents on courses, but this guy has amazing english language speaking ability and his courses are to the point - new favourite of mine :)

  • @kunalkathe3198
    @kunalkathe3198 Před 5 lety +13

    That thumbnail is really catchy! 😀
    Video👌👌

  • @visheshgupta4990
    @visheshgupta4990 Před 6 měsíci

    Thank you so much sir the way you explain it looks how simple and I am able to understand this logic and able to think thanks alot , I came up here from your react native series

  • @nagavedareddy5891
    @nagavedareddy5891 Před 3 lety

    You're a True gem sir...!

  • @yashrajanshukla7790
    @yashrajanshukla7790 Před 5 lety

    Absolutely simple ..
    And this video will help beginners to understand it better

  • @abhinavsinha9923
    @abhinavsinha9923 Před 3 lety +1

    Yea it was very interesting and very enjoyable! Cool HC!

  • @priyanshusharma2310
    @priyanshusharma2310 Před 2 lety +1

    I came here from your react course :), your course is really good

  • @vinodagoudapatil1517
    @vinodagoudapatil1517 Před 3 lety +1

    From your Angular course, I am here!

  • @sigmaboom332
    @sigmaboom332 Před 4 lety +2

    The explanation is very easy Thank you

  • @unpluggedaman
    @unpluggedaman Před 5 lety +2

    Great, could you do a similar video for the Simon Game logic as well!

  • @rahulkhatri5158
    @rahulkhatri5158 Před 4 lety

    thanks for simply explaining the logic.

  • @ritiksaxenaofficial
    @ritiksaxenaofficial Před 5 lety

    When I started learning C++... I made it using array and lots of *if* and *else* statements. But this logic is quite simple✌🏻

  • @miw879
    @miw879 Před 3 lety

    This is a great channel!

  • @SunilKumar-ib2bq
    @SunilKumar-ib2bq Před rokem

    Amazing explaination!

  • @code_with_ali
    @code_with_ali Před 4 lety

    Thanks for the video . prefect explanation.

  • @hassaan-dev
    @hassaan-dev Před rokem

    💜You explained easily difficult logic

  • @edtechbymeera
    @edtechbymeera Před 3 lety +1

    Fantastic explanation of the logic..Programming is all about conceptual thinking and analysis rather than coding. You are great

  • @wrednax8594
    @wrednax8594 Před 4 lety +1

    THANK YOU SIR. GOD BLESS YOU

  • @lightyagami3222
    @lightyagami3222 Před 5 lety +3

    Haha i told my each and every friends to subscribe 💗

  • @mariafernandaabreufonseca9640

    Really helpful. Thanks 👍

  • @AkshayMohanty743
    @AkshayMohanty743 Před 2 lety

    Great way of teaching 😊

  • @swarajgadre5630
    @swarajgadre5630 Před 3 lety +1

    Very nicely explained sir!!!!!!!

  • @viral_codes
    @viral_codes Před 5 lety +1

    Thank you very much sir.

  • @azamat0180
    @azamat0180 Před 5 lety +1

    Thank you so much👍

  • @vishwaraval1930
    @vishwaraval1930 Před 3 lety

    Nice you explained it amazingly I made my game like you have explianed

  • @mohdnawazishalam3255
    @mohdnawazishalam3255 Před 5 lety

    Need some more videos like this

  • @_sharmaji.dev_
    @_sharmaji.dev_ Před 5 lety

    Great Video. Waiting for Saturday challenge....

  • @AkshayGupta-dd4ht
    @AkshayGupta-dd4ht Před 4 lety +1

    this logic is tooooooooo simple for noobs .
    thanks you
    and for legends
    minimax algo

  • @abolfazldaneshvar1441

    Thank very Usefull !

  • @shoaibhasan4026
    @shoaibhasan4026 Před rokem

    Thank you so much you're life saver Sir everytime ❤

  • @shantanumishra6488
    @shantanumishra6488 Před 5 lety

    Thankyou sir you are the best ❤️❤️

  • @rajshekharrakshit9058
    @rajshekharrakshit9058 Před 4 lety

    U r awesome sir, thank u

  • @pramaffairs4331
    @pramaffairs4331 Před rokem

    life saver.... Thanks

  • @jaypatel9392
    @jaypatel9392 Před 3 lety

    Yes I have enjoyed.plz make this kind of videos

  • @sujaypagam1149
    @sujaypagam1149 Před rokem +1

    💌🤟 logic 🔥 Learning react js from lco... and just loved it

  • @mdfaiz5539
    @mdfaiz5539 Před 5 lety

    Your thumbnails are improving day by day

  • @SichuunduW762
    @SichuunduW762 Před 4 lety

    nice one.
    here is a question.making use of a two dimensional array,write the code that permits two players to play a game of tic tac toe (also known as noughts and crosses). use 0 to represent an empty square.1 to represent a cross, and 2 to represent a nought.
    this requires implementing several algorithms;
    asking for the user`s input and placing their symbol
    looping between two different players alternating the symbol
    checking for a win.
    must be done in java.
    show the pseudocode and the java code

  • @AbhisekMaitiOfficial
    @AbhisekMaitiOfficial Před 3 lety

    tic tac tae !!!!! tic tac tak :::: hitesh sir some times mashed up in pronunciation and i really enjoyed funny comments in middle of lecture and i never bored when watching his lecture.

  • @mkmalikcom
    @mkmalikcom Před 5 lety

    achha laga
    keep posting like this vodeos.

  • @ranjandass13
    @ranjandass13 Před 5 lety +1

    I thought you're going to explain some logic or algorithm where the computer will win every time or something like that. Some intelligent comp player.

  • @mockingbird3809
    @mockingbird3809 Před 5 lety +21

    Who Came From Flutter Course in Learn Code Online?..😉

  • @ProgrammingWithProject

    Sir I enjoyed this video please make more video to raise the ability of logical thinking. Well I also teach PHP and JavaScript at my CZcams channel with the help of project. Sir you are my inspiration.

  • @shivsingh5117
    @shivsingh5117 Před rokem

    Now, After watching the video "It is very simple"❤❤🙏🙏

  • @AmitSingh-nr8jz
    @AmitSingh-nr8jz Před 4 lety

    no need to scan all rows , cols & diagonals to decide winning state, if u changed any cell and it is not corner cell then just check corresponding row & col, else you will have to consider corresponding diagonal as well . so in after each u have to either check for (row & col) or (row, col & dig) to decide winning state.
    this question is not about how do u decide winning state after each move, it is more how efficiently u decide :)

  • @RobinSingh-gv2if
    @RobinSingh-gv2if Před 3 lety

    Thanks Man.

  • @anuragtawaniya7746
    @anuragtawaniya7746 Před 3 lety

    very helpful sir

  • @abdush5830
    @abdush5830 Před 3 lety

    Very enjoyed Sir❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️

  • @TopAPPSTamil
    @TopAPPSTamil Před 5 lety

    omg more time i did nt realize and still 5.30pm what logic is this ?? but now i got it😍😍😍 plzzz doooooo more more this kind of videoo dude

  • @graphicalguru5597
    @graphicalguru5597 Před 5 lety

    Thanks a lot sir

  • @SatyamSinghDeveloper
    @SatyamSinghDeveloper Před 3 lety

    came here from your angular course.

  • @DiwashHCR2
    @DiwashHCR2 Před 5 lety

    Awesome!

  • @RandomGuy-hi2jm
    @RandomGuy-hi2jm Před 5 lety +9

    *Can we optimize this problem? DS*

    • @tejaswipandava
      @tejaswipandava Před 3 lety +1

      optimization: The first thing we need to do is have an if the check for the total no of turns in case they exceed 4. if they exceed we can start our logic. Also, one more idea I was getting is instead of having 8 checks (row, column, and diagonals) why not reduce the check. I mean whenever a user selects a value (say position 8) let's check all possible combinations with that position that would reduce the checks to max 3. (positions [0,4,8],[2,5,8][6,7,8])

  • @kingshahzad78
    @kingshahzad78 Před 4 lety

    Thanks Sir.

  • @souvikbanerjee1635
    @souvikbanerjee1635 Před 5 lety

    In C pos[i] will be filled up with garbage value if the player have not played any move there so we can simply check (for the horizontal case) if pos[0]==pos[1] and pos[1]==pos[2] so if the player have not filled out any of the places it will not match anyway because of the garbage value concept.
    I tried to code that with this logic and found some strange error which says that the subscripted value is not either array nor pointers nor vectors .
    I just want to know if I am thinking correctly , and this error is occurring because of my logic or not.

  • @zakiulhasan808
    @zakiulhasan808 Před 5 lety

    Sir what kind of glass you are using.Is it any blue light protection glass? Do we have to use that kind of product?

  • @theskysthelimit.
    @theskysthelimit. Před 3 lety

    thank you!

  • @mohammadyaseenshaik4325

    Just awesome explanation, I’m a new subscriber for you now… 😊😊 and I’m also a technical CZcamsr

  • @piano9446
    @piano9446 Před 4 lety

    Thanks so much)))

  • @msdhaliwal
    @msdhaliwal Před 4 lety +1

    creating react app from your latest react course at LCO ( complete reactJs developer bootcamp )

  • @Rishi-xj2iy
    @Rishi-xj2iy Před rokem

    your personality reflects some shade of professor from money heist spain

  • @Dattunaik5522
    @Dattunaik5522 Před 3 lety +1

    Great👏👏

  • @varishali1400
    @varishali1400 Před 5 lety +1

    Sir can you please show me how to implement computer mode in this game?

  • @SoftwareMahima2024
    @SoftwareMahima2024 Před 3 lety

    Super cool video

  • @alexjuniortupapa
    @alexjuniortupapa Před 5 měsíci

    Thanks for sharing

  • @manivelarung
    @manivelarung Před 4 lety

    came from Hitesh's Angular course

  • @statuslounge9407
    @statuslounge9407 Před 3 lety

    here i am trying to build logic for Codechef May Challenge

  • @shantanushende6
    @shantanushende6 Před 3 lety

    Amazing!

  • @ranuranjan7937
    @ranuranjan7937 Před 3 lety

    who came from reactjs course?,
    sir logic too simple and very helpful

  • @MohitK96
    @MohitK96 Před 5 lety +1

    I still remember that because of this fu@#ing problem I left learning java and app development. I was learning on my own, doing Head first java, everything was going smooth and then this problem appeared, wasted almost 4-5 days, was lost in college stuff and ultimately never did again...

  • @farhan787
    @farhan787 Před 5 lety

    8:28 both time wrong sir "Tic toc tae" and "tic-toc-tech", it happens but I really liked that you didn't cut that part.

  • @purnapavanchandra6823
    @purnapavanchandra6823 Před 5 lety

    Sir, what about Saturday coding challenges?

  • @sujaykamatkar788
    @sujaykamatkar788 Před 5 lety

    Hello Sir, I have one problem My program is running but it can't go to second player. Can you help me?

  • @prakharsinha499
    @prakharsinha499 Před 5 lety

    I was able to make it... I used Python and Tkinter (for design)

  • @benelansari7228
    @benelansari7228 Před rokem

    Could you tell me how to improve my problem skills and solve problems like tic-tac-toe in a eaier way? thank you

  • @Vikram_singh_ji
    @Vikram_singh_ji Před 2 lety

    Vikram was here (at the time of learning react)!!!

  • @danishsharma419
    @danishsharma419 Před 5 lety

    Brdr cos of u i started coding thinking ,it is ridiculously simple and i can do it.and i want to kw m learning python so for full stack develpor should i learn js,html,django and wat r the pre requisite for learning django ,oracle and how can we design games using Python..by watching this video i realized that i should try this game development using python,but itz just a motivational thought i dont kw how to start, thanks sir #bhai_G

  • @pranjal6736
    @pranjal6736 Před 5 lety

    Nice explication

  • @sarveshkumardvivedi5395

    Wow that's easy stuff

  • @deepakranjanwaterworm
    @deepakranjanwaterworm Před 5 lety

    Good sir.