C Tic Tac Toe game ⭕

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.พ. 2025

ความคิดเห็น • 164

  • @BroCodez
    @BroCodez  3 ปีที่แล้ว +193

    //This is a tic tac toe game written in C designed for beginners
    //(This doesn't contain the use of pointers or other more advanced C topics)
    #include
    #include
    #include
    #include
    char board[3][3];
    const char PLAYER = 'X';
    const char COMPUTER = 'O';
    void resetBoard();
    void printBoard();
    int checkFreeSpaces();
    void playerMove();
    void computerMove();
    char checkWinner();
    void printWinner(char);
    int main()
    {
    char winner = ' ';
    char response = ' ';
    do
    {
    winner = ' ';
    response = ' ';
    resetBoard();
    while(winner == ' ' && checkFreeSpaces() != 0)
    {
    printBoard();
    playerMove();
    winner = checkWinner();
    if(winner != ' ' || checkFreeSpaces() == 0)
    {
    break;
    }
    computerMove();
    winner = checkWinner();
    if(winner != ' ' || checkFreeSpaces() == 0)
    {
    break;
    }
    }
    printBoard();
    printWinner(winner);
    printf("
    Would you like to play again? (Y/N): ");
    scanf("%c");
    scanf("%c", &response);
    response = toupper(response);
    } while (response == 'Y');
    printf("Thanks for playing!");
    return 0;
    }
    void resetBoard()
    {
    for(int i = 0; i < 3; i++)
    {
    for(int j = 0; j < 3; j++)
    {
    board[i][j] = ' ';
    }
    }
    }
    void printBoard()
    {
    printf(" %c | %c | %c ", board[0][0], board[0][1], board[0][2]);
    printf("
    ---|---|---
    ");
    printf(" %c | %c | %c ", board[1][0], board[1][1], board[1][2]);
    printf("
    ---|---|---
    ");
    printf(" %c | %c | %c ", board[2][0], board[2][1], board[2][2]);
    printf("
    ");
    }
    int checkFreeSpaces()
    {
    int freeSpaces = 9;
    for(int i = 0; i < 3; i++)
    {
    for(int j = 0; j < 3; j++)
    {
    if(board[i][j] != ' ')
    {
    freeSpaces--;
    }
    }
    }
    return freeSpaces;
    }
    void playerMove()
    {
    int x;
    int y;
    do
    {
    printf("Enter row #(1-3): ");
    scanf("%d", &x);
    x--;
    printf("Enter column #(1-3): ");
    scanf("%d", &y);
    y--;
    if(board[x][y] != ' ')
    {
    printf("Invalid move!
    ");
    }
    else
    {
    board[x][y] = PLAYER;
    break;
    }
    } while (board[x][y] != ' ');

    }
    void computerMove()
    {
    //creates a seed based on current time
    srand(time(0));
    int x;
    int y;
    if(checkFreeSpaces() > 0)
    {
    do
    {
    x = rand() % 3;
    y = rand() % 3;
    } while (board[x][y] != ' ');

    board[x][y] = COMPUTER;
    }
    else
    {
    printWinner(' ');
    }
    }
    char checkWinner()
    {
    //check rows
    for(int i = 0; i < 3; i++)
    {
    if(board[i][0] == board[i][1] && board[i][0] == board[i][2])
    {
    return board[i][0];
    }
    }
    //check columns
    for(int i = 0; i < 3; i++)
    {
    if(board[0][i] == board[1][i] && board[0][i] == board[2][i])
    {
    return board[0][i];
    }
    }
    //check diagonals
    if(board[0][0] == board[1][1] && board[0][0] == board[2][2])
    {
    return board[0][0];
    }
    if(board[0][2] == board[1][1] && board[0][2] == board[2][0])
    {
    return board[0][2];
    }
    return ' ';
    }
    void printWinner(char winner)
    {
    if(winner == PLAYER)
    {
    printf("YOU WIN!");
    }
    else if(winner == COMPUTER)
    {
    printf("YOU LOSE!");
    }
    else{
    printf("IT'S A TIE!");
    }
    }

    • @felman7
      @felman7 3 ปีที่แล้ว +5

      damn.. this much code just for a simple game....

    • @BrainPermaDeD
      @BrainPermaDeD 3 ปีที่แล้ว +8

      A lot happens inside the game while you enjoy the scene of the game.

    • @truyensieuhay1886
      @truyensieuhay1886 3 ปีที่แล้ว

      thank you

    • @ganpatinatrajan5890
      @ganpatinatrajan5890 3 ปีที่แล้ว

      Great work

    • @andrelebalai8240
      @andrelebalai8240 3 ปีที่แล้ว

      @@chriijack101 same problem I can't replay

  • @naboulsikhalid7763
    @naboulsikhalid7763 ปีที่แล้ว +29

    this is the most elaborating way of programming that invokes all the materials that you study in c programming. Thank you

  • @muhammadshahzaib6564
    @muhammadshahzaib6564 11 หลายเดือนก่อน +16

    Watching this tutorial in 2024 and absolutely enjoying learning C from you. Followed your course from the first video till the last and now i feel very confident in C language.
    This guy never disappoints🙌.
    Respect man❤❤
    Keep making such insightful and useful videos

    • @Ava-x9z3n
      @Ava-x9z3n 6 หลายเดือนก่อน

      same same

  • @beckbrook605
    @beckbrook605 3 ปีที่แล้ว +43

    From a student who's learning programming and runs out of time, thank you a lot Bro Code

  • @cybrd230
    @cybrd230 3 ปีที่แล้ว +24

    Sit back relax and enjoy the show

  • @party4keeps28
    @party4keeps28 2 ปีที่แล้ว +40

    I'm just beginning to learn and followed this example. It's great, thank you. So far I've added the ability to choose whether to be X or O, who goes first, and made it alternate who goes first after each game. I'm going to work on the AI now.

    • @yughin
      @yughin ปีที่แล้ว +3

      how are you doing?

  • @AZureSC
    @AZureSC ปีที่แล้ว +9

    Thank you for providing this information for free man, appreciate it! I am about to go into my second year as a CS major and did not know where to go after learning Java so these tutorials have been great for learning the basic syntax of another language

  • @A.C.Productions
    @A.C.Productions 2 ปีที่แล้ว +2

    Евала братле. С туй си взех курсовата работа. Продължавай така, че още 7 семестъра ще трябва!

  • @OfficialSumanMahato
    @OfficialSumanMahato ปีที่แล้ว

    Thanks bro, nice approach for this problem
    This video definitely deserves more views

  • @solozlegend2416
    @solozlegend2416 3 ปีที่แล้ว +2

    Yo! Very good informative video . Btw advance congrats for 200k . U deserve more

  • @smartxavier8906
    @smartxavier8906 3 ปีที่แล้ว +80

    I watched the full as so that you can earn gud money 😂😀

    • @hritiktheopgamer4122
      @hritiktheopgamer4122 ปีที่แล้ว +5

      Same here 😅

    • @smartxavier8906
      @smartxavier8906 ปีที่แล้ว +7

      @@hritiktheopgamer4122 wow 1 year old comment

    • @nenjidesu
      @nenjidesu ปีที่แล้ว

      ​@@smartxavier89067 muffs

    • @nOne4three
      @nOne4three ปีที่แล้ว

      @@smartxavier8906so how much r u earning now

    • @Arador1112
      @Arador1112 7 หลายเดือนก่อน

      ​@@smartxavier8906 same

  • @takashikumi1523
    @takashikumi1523 3 ปีที่แล้ว +6

    I love you bro keep it up I am learning a lot thanks to you!!

  • @nightcrawler2561
    @nightcrawler2561 ปีที่แล้ว

    I finished the course ❤ thanks bro

  • @susruthikanaparthi9502
    @susruthikanaparthi9502 5 หลายเดือนก่อน

    thank you! it's really helpfu to me, do more such type of mini projects🤩

  • @sabaabiri5221
    @sabaabiri5221 2 ปีที่แล้ว +1

    hi bro I have ended this tutorial right now , and I want to start c++ tutorial . I want to say thank u for teaching fast and very good . best regards

  • @toxxart6267
    @toxxart6267 ปีที่แล้ว +1

    there's no error in my code but still when i enter where i want to place my x it doesn't show me where i have placed it, the board stays empty.

  • @bsykesbeats
    @bsykesbeats 2 ปีที่แล้ว +15

    Thank you, awesome breakdown....One small improvement: if you add && board[i][0] != ' ' to the check rows if statement in the checkeWinner() function (and of course && board[0][j] != ' ' for columns etc) it will ensure that it doesn't prematurely return from that function if it sees that for instance the top row is still all ' ' even if you win in the bottom row. It doesn't come up that often, but it's irritating when it does, I made a 2 player version of this so I was able to force this corner case and it drove me crazy until I finally figured out how to solve it with he simple fix above.

    • @anandabiswas8876
      @anandabiswas8876 2 ปีที่แล้ว +2

      exactly !!

    • @LAAL0_O
      @LAAL0_O 9 หลายเดือนก่อน

      can you explain a bit more my stupid brain can't comprehend this.😅

  • @abolfazljahangir1651
    @abolfazljahangir1651 ปีที่แล้ว

    Nice bro❤

  • @vale_san-2
    @vale_san-2 หลายเดือนก่อน

    is there any site showing all variables and operators in c, example of their usage?

  • @ganpatinatrajan5890
    @ganpatinatrajan5890 3 ปีที่แล้ว +1

    Great work ...!!!!

  • @Palmieres
    @Palmieres 2 ปีที่แล้ว +6

    Thank you for this. I easily altered it to make it a two player game, add an option for player names and a nice little menu. In the words of Homer SImpson "GAAHHHHGGHHH! More, please!"

  • @sujake9587
    @sujake9587 7 หลายเดือนก่อน

    hi ,a quick question: can we use else if statement when making checkwinner() condition for diagonal elements

  • @PrinceVegeta2710
    @PrinceVegeta2710 10 วันที่ผ่านมา

    Will add this, Flappy Brid and Snake Game in my CV after 3 years 😂.

  • @MehediHasan4u
    @MehediHasan4u 2 ปีที่แล้ว +3

    Hey bro..first of all thanks a lot for all the free courses... I would like to know something, How can i prevent the player from winning? And How the computer can block the player winning move?
    like, if player move 2 X horizontally or vertically, how the computer can prevent player from winning? you response would be very helpful... I'm eagerly waiting for your response.

  • @official-k.i.d.u-k5750
    @official-k.i.d.u-k5750 2 ปีที่แล้ว +1

    "Sit back relax and enjoy the show" :) and i also finished the course, Thanks bruh

  • @dmf4824
    @dmf4824 3 ปีที่แล้ว +1

    Thx bro, i’ve learn so much from you

  • @novavanguard1313
    @novavanguard1313 3 ปีที่แล้ว +3

    its taking input even when we give column no as 4, which should give invalid? why is that?

  • @PiyushKumar-h3q
    @PiyushKumar-h3q 2 หลายเดือนก่อน +1

    Thx a lot mate

  • @bhargavram4027
    @bhargavram4027 8 หลายเดือนก่อน

    Completed Bro! Thanks for this video.

  • @AbhitejBokka
    @AbhitejBokka 3 ปีที่แล้ว +6

    Yo Bro Code, u gotta hit us up with some videos on pointers. I appreciate all the hard work u put in here cuz it really translates to a learning experience for me and many others here.

  • @Adam-TheLiftedKing
    @Adam-TheLiftedKing หลายเดือนก่อน

    Cant seem to get that Y /N part to work my lines are the same but it will just go straight from "Wanna play again? (Y/n): " to "Thank you for playing!!'

  • @Rid-E
    @Rid-E 2 ปีที่แล้ว +4

    Correct me if I'm wrong. The checkFreespaces() function within the computerMove() function is unnecessary since the main function already contains a while loop checking for that. The printWinner(' '); statement in the computerMove() function is also pointless since the winner=checkWinner() is already doing the job in main function.

  • @g1itch589
    @g1itch589 ปีที่แล้ว

    now we just need a video on this but with the language C# :)

  • @MandipChhetri
    @MandipChhetri ปีที่แล้ว

    My first game reloaded thank you❣️ love from 🇳🇵

  • @AngelicaHitijahubessy
    @AngelicaHitijahubessy 2 หลายเดือนก่อน +1

    in line 52, why dis you is scanf("%c"), but without &response ??

    • @User67470
      @User67470 2 หลายเดือนก่อน

      To clear buffer /new line character

  • @astudent4005
    @astudent4005 10 หลายเดือนก่อน

    Completed the whole series and now I'm ready to ace my midterms

  • @iasmin-i
    @iasmin-i 6 หลายเดือนก่อน

    Ended the full course here 😁✊ lets gaaa

  • @minecraftcookie2929
    @minecraftcookie2929 ปีที่แล้ว

    Thanks ! I modified the code to set pawn and a toss will be performed to decide who will go first

  • @anshumansharma6650
    @anshumansharma6650 3 ปีที่แล้ว +1

    Thank You So Much Brother ❤️❤️❤️❤️❤️🔥🔥🔥🔥😍😍😍😶😘😘😘😘😘.

  • @achuthakumar456
    @achuthakumar456 3 ปีที่แล้ว +1

    So great bro !

  • @flurry301
    @flurry301 2 หลายเดือนก่อน

    wrote my own rn it’s at nearly 400 lines imma do some optimisation and cleaning and it’s gonna drop to 350 easily

  • @Ava-x9z3n
    @Ava-x9z3n 6 หลายเดือนก่อน +1

    im sad to be a the end of this course :(

  • @shavilagt1072
    @shavilagt1072 ปีที่แล้ว

    THANK YOU SO MUCH!

  • @ahmetyusufata
    @ahmetyusufata 16 วันที่ผ่านมา

    is this playlist include all of c?

  • @ВладиславСубботин-з1э
    @ВладиславСубботин-з1э 10 หลายเดือนก่อน

    thank you so much!!

  • @qaw392
    @qaw392 2 ปีที่แล้ว +1

    can you create board with nested loops instead of copy paste 3 times? appreciate the video!

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว

      I think u can only loop first two rows, the last one is different

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว +1

      for(int i = 0; i < 3; i++ )
      {

      printf(" %c | %c | %c
      ", board[i][0], board[i][1], board[i][2]);
      printf("---|---|---
      ");
      }
      I tried like this, but it creates 1 additional horizontal line
      X | X | O
      ---|---|---
      O | X | O
      ---|---|---
      O | X | X
      ---|---|---

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว +1

      IT's working right with additional if(i

  • @РусланЗаурбеков-з6е
    @РусланЗаурбеков-з6е 7 หลายเดือนก่อน

    Why no "for" loop in printBoard???

  • @pooyaanony3617
    @pooyaanony3617 9 หลายเดือนก่อน

    Thanks man, awesome

  • @omarehab431
    @omarehab431 2 ปีที่แล้ว +1

    How would you check for winner if it was a 5x5 or 6x6 instead of 3x3 grid?

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว +1

      I think with same way, U just need to add more rows and columns

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว +4

      this is for 5x5
      The answer of ur question is in point 6).
      1).so first of all we need to change char board and make it 5 to 5 2d matrix.(board[5][5]).
      2).Change the resetBorad function. The condition will be for(int i = 0;i < 5; i++)
      {
      for(int j = 0; j < 5; j++)
      {
      board[i][j] = ' ';
      }
      }
      3). Now it's time for printing our board, instead of writing the same thing 5 time, we can use nested loop like this.
      for(int i = 0; i < 5; i++ )
      {

      printf(" %c | %c | %c | %c | %c
      ", board[i][0], board[i][1], board[i][2], board[i][3], board[i][4]);
      if(i < 4)
      printf("---|---|---|---|---
      ");
      }
      The output will be .\
      | | | | ---------- first row
      ---|---|---|---|---
      | | | | ---------- second row
      ---|---|---|---|---
      | | | | ---------- third row
      ---|---|---|---|---
      | | | | ---------- fourth row
      ---|---|---|---|---
      | | | | ---------- fifth row
      4). Now we need to change checkFreeSpaces() function. In the 3x3 we wrote 9 coz we have 9 free spaces, now we have 25 free spaces.
      int checkFreeSpaces()
      {
      int freeSpaces = 25;
      for(int i = 0;i < 5; i++)
      {
      for(int j = 0; j < 5; j++)
      {
      if(board[i][j] != ' ')
      {
      freeSpaces--;
      }
      }
      }
      return freeSpaces;
      }
      5).In playerMove function we can just change printf function to printf("Enter row #(1-5): ");
      printf("Enter colum #(1-5): ");
      6). Now let's change the checkWinner() function.
      In 5x5 matrix we have this struction. That is why when we r giving for example 5 rows and 5 columns with scanf function, it is decrementing with -1 wich is giving us [4][4].
      [ 0][ 0 ] , [ 0 ][ 1 ], [ 0 ][ 2 ], [ 0 ][ 3 ] , [ 0 ][ 4 ]
      [ 1][ 0 ] , [ 1 ][ 1 ], [ 1 ][ 2 ], [ 1 ][ 3 ] , [ 1 ][ 4 ]
      [ 2][ 0 ] , [ 2 ][ 1 ], [ 2 ][ 2 ], [ 2 ][ 3 ] , [ 2 ][ 4 ]
      [ 3][ 0 ] , [ 3 ][ 1 ], [ 3 ][ 2 ], [ 3 ][ 3 ] , [ 3 ][ 4 ]
      [ 4][ 0 ] , [ 4 ][ 1 ], [ 4 ][ 2 ], [ 4 ][ 3 ] , [ 4 ][ 4 ]
      char checkWinner()
      {
      //check rows
      for(int i = 0 ; i < 5; i++)
      {
      if(board[i][0]== board[i][1] && board[i][0] == board[i][2] && board[i][0] == board[i][3] && board[i][0] == board[i][4])
      {
      return board[i][0];
      }
      }
      //check columns
      for(int i = 0 ; i < 5; i++)
      {
      if(board[0][i] == board[1][i] && board[0][i] == board[2][i] && board[0][i] == board[3][i] && board[0][i] == board[4][i])
      {
      return board[0][i];
      }
      }
      //check diagonals


      if(board[0][0]== board[1][1] && board[0][0] == board[2][2] && board[0][0] == board[3][3] && board[0][0] == board[4][4])
      {
      return board[0][0];
      }
      if(board[0][4]== board[1][3] && board[0][4] == board[2][2] && board[0][4] == board[3][1] && board[0][4] == board[4][0])
      {
      return board[0][4];
      }
      return ' ';
      }
      7).Change computerMove() function
      We r leaving seed the same(with time) , so that every time we will have different random numbers.
      Then we r generating random number with rand() function. We wrote
      x = rand() % 3 ; because we wanted to generate from 0 to 2.
      But now we need to generate from 0 to 4.
      So we write x = rand() % 5 ;
      It will now generate 0-4.
      if we want to increase the range we can add (+number), for example
      x = (rand() % 5) + 2;
      Now it will generate from 2 to 6.
      void computerMove()
      {
      srand(time(0));
      int x;
      int y;
      if(checkFreeSpaces() > 0)
      {
      do
      {
      x = rand() % 5;
      y = rand() % 5;
      }while(board[x][y] != ' ');
      board[x][y] = COMPUTER;
      }
      else
      {
      printWinner(' ');
      }
      8) and the final one... Enjoy and have fun with codes :)))))

  • @multicitygirl5527
    @multicitygirl5527 3 ปีที่แล้ว +1

    thank u so much!!!!!!

  • @jtjc7705
    @jtjc7705 2 ปีที่แล้ว

    I have reached the end. Thank you for the time you've given some random fellow human beings. It's more important than you know and made a big difference for this random human being. If I survive through my next few months fast track I will not forget to let you know.

    • @riverstenors
      @riverstenors 2 หลายเดือนก่อน

      did you survive bro?

  • @101thetruthguy
    @101thetruthguy 2 ปีที่แล้ว +3

    Hello guys, when I type Y or N, I get an error saying:
    The term 'n' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.
    At line:1 char:1
    + n
    + ~
    + CategoryInfo : ObjectNotFound: (n:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    Can someone help?

    • @davidaj4840
      @davidaj4840 19 วันที่ผ่านมา

      Me too

  • @floresss4178
    @floresss4178 ปีที่แล้ว

    I don't understand how I managed to follow one for one with the video, understand it, and yet the program fails to run lmao

  • @emelieobumse4345
    @emelieobumse4345 2 ปีที่แล้ว +1

    would it be a problem if after watching this, i cant do it on my own without watching the video? :(

    • @unrealgalaxy9669
      @unrealgalaxy9669 2 ปีที่แล้ว

      thats like asking if you cant take the term exam after attending a single lecture

    • @emelieobumse4345
      @emelieobumse4345 2 ปีที่แล้ว

      @@unrealgalaxy9669 there are so many processes lol that’s why

    • @unrealgalaxy9669
      @unrealgalaxy9669 2 ปีที่แล้ว

      @@emelieobumse4345 this video aint one of those videos where you understand everything in one sitting, its one of those videos where you follow along as a tutorial and figure things out on ur own

  • @omarehab431
    @omarehab431 2 ปีที่แล้ว

    How can I make user input the number for the grid(nxn), e.g: 5x5 or 6x6

  • @lilgoldenboi7303
    @lilgoldenboi7303 ปีที่แล้ว

    best guy on the internet

  • @ako4435
    @ako4435 2 ปีที่แล้ว

    TY very helpful

  • @protomous
    @protomous ปีที่แล้ว

    For determining the win condition, how would you go about doing it through a Switch statement?

  • @crspytofu
    @crspytofu 2 ปีที่แล้ว +1

    could you do this for c# program?

    • @Gupatik
      @Gupatik 2 ปีที่แล้ว

      use the same approch, yu have now the logic and you only need the syntax. go for it and try it yourself

  • @26.RatneshSingh.621
    @26.RatneshSingh.621 7 หลายเดือนก่อน

    Thank you

  • @improve_everyday001
    @improve_everyday001 2 ปีที่แล้ว

    I have a question. Can you use while-loop instead d0-while-loop in function playerMove?

    • @Notthetylor
      @Notthetylor 2 ปีที่แล้ว

      Of course U can. U just need to write any condition inside while loop like while(1>0) , so that it will loop infinite times.
      This if condition here means that it
      will break the loop only if board[x][y] == ' ';
      Otherwise it will loop because 1 is always more that 0.
      else
      {
      board[x][y] = PLAYER;
      break;
      }
      while(1>0)
      {
      printf("Enter row #(1-5): ");
      scanf("%d",&x);
      x--;
      printf("Enter colum #(1-5): ");
      scanf("%d",&y);
      y--;
      if(board[x][y] != ' ')
      {
      printf("Invalid move!
      ");
      }
      else
      {
      board[x][y] = PLAYER;
      break;
      }
      }

  • @Boisterous_Gaming
    @Boisterous_Gaming 3 ปีที่แล้ว +1

    This Code is so Useful

  • @liamfaris7323
    @liamfaris7323 ปีที่แล้ว

    Hey there, I'm getting the 'It's a tie" message at the start of running the code. Does anyone know why that may be?

    • @ooooooooooo6955
      @ooooooooooo6955 ปีที่แล้ว

      did u copy the code that he commented? or use chatgpt

  • @badgalirri
    @badgalirri 2 ปีที่แล้ว +1

    you are a beautiful human

  • @shivanshuhere
    @shivanshuhere ปีที่แล้ว

    That's some heavy stuff for beginner

  • @hussaynkun
    @hussaynkun 5 หลายเดือนก่อน

    i finished the course lesgggoooooooo

  • @AIFACTOPIA-69
    @AIFACTOPIA-69 5 หลายเดือนก่อน

    thanks

  • @sandersnolan6895
    @sandersnolan6895 3 ปีที่แล้ว +1

    I guess you are preparing a c full tutorial

  • @alissiacarriere
    @alissiacarriere ปีที่แล้ว

    cool

  • @D.lostinanime
    @D.lostinanime 9 หลายเดือนก่อน

    I will came back again, its kinda to hard for me 😢😂

  • @Thwq11
    @Thwq11 5 วันที่ผ่านมา

    13:51

  • @MrPillowStudios
    @MrPillowStudios 2 ปีที่แล้ว

    Cool.

  • @truyensieuhay1886
    @truyensieuhay1886 3 ปีที่แล้ว +1

    in c++ how would it be : printf("
    Would you like to play again? (Y/N): ");
    scanf("%c");
    scanf("%c", &response);

    • @priyanshumaurya007
      @priyanshumaurya007 3 ปีที่แล้ว +1

      U can use standard method Cout & Cin. I think there wouldn't be any problem.

    • @skygazer2678
      @skygazer2678 2 ปีที่แล้ว +1

      coutresponse;

  • @11_fathinisnandarulabibi17
    @11_fathinisnandarulabibi17 2 ปีที่แล้ว

    how to make bot for level expert?

  • @saiful0038
    @saiful0038 2 ปีที่แล้ว

    Can anyone make a algorithm flowchart for this code??

  • @SuperSamsosa
    @SuperSamsosa 2 ปีที่แล้ว +1

    Im halfway through. Very nice tutorial that is helping me with my project.
    I had one thought though, since we (humans) are accoustumed to x moving in a in horizontal line and y moving in a vertical line, the createBoard function would should better be thus in my opinion:
    void printBoard(){
    printf("c% | c% | c% |",board[0][0],board[1][0],board[2][0]);
    printf("
    ...|...|...
    ");
    printf("c% | c% | c% |",board[0][1],board[1][1],board[2][1]);
    printf("
    ...|...|...
    ");
    printf("c% | c% | c% |",board[0][2],board[1][2],board[2][2]);
    printf("
    ...|...|...
    ");
    printf("
    ");
    };
    What do you think ? All argumentators welcome ;)

    • @nayaa_xx1119
      @nayaa_xx1119 ปีที่แล้ว

      This is so confusing… I don’t think that’s how matrices work

    • @siddhantamallick6837
      @siddhantamallick6837 ปีที่แล้ว +1

      i would like to argue that we humans are more accustomed to matrices and the createBoard function in the video is more easy to understand and visualize than your version
      Moreover your version would print the transpose of the matrix rather than the original matrix .

    • @jard
      @jard 4 หลายเดือนก่อน

      @@siddhantamallick6837 the difference is irrelevant. @SuperSamsosa's code assumes column major order for the matrix (each column is stored contiguously in memory), the code in the video assumes row major order (each row is stored contiguously in memory). both of them are functionally equivalent with each other (though column major matrices are more cache-friendly when performing matrix multiplications of row vectors, and they better describe mathematical principles like basis matrices) as long as the remaining code is consistent with the ordering: most importantly, the code that assigns the player's moves to the board shouldn't be accessing the column major matrix with row major ordering.

  • @Almocar
    @Almocar 2 ปีที่แล้ว +1

    is it possible to make a 9x9 grid , meaning, making a ultimate tic tac toe until this sunday and give the code? I need it fast

    • @banglawarlock3947
      @banglawarlock3947 2 ปีที่แล้ว

      just expand the grid from this tutorial maybe? and do minor adjustments yourself

    • @Almocar
      @Almocar 2 ปีที่แล้ว

      @@banglawarlock3947 ok shut up

  • @prathameshbansode8065
    @prathameshbansode8065 2 ปีที่แล้ว

    Which engine u used?

    • @Jay-og4yb
      @Jay-og4yb 2 หลายเดือนก่อน

      Unreal Engine 5

  • @upper_moon1727
    @upper_moon1727 ปีที่แล้ว

    Made mine somehow it was 356 lines 🤣☠️, I did make mine a class and my computer knows when you are about to win and stops you so it always ends in a draw or you make a mistake and the computer wins

  • @arkodeepchatterjee
    @arkodeepchatterjee ปีที่แล้ว

    i finished the course

  • @patrickfeeney4180
    @patrickfeeney4180 2 ปีที่แล้ว

    class

  • @flowauth
    @flowauth 3 ปีที่แล้ว +1

    we love you

  • @Geezweez788
    @Geezweez788 ปีที่แล้ว

    How do people know such things, good Lord.

  • @kashis3357
    @kashis3357 ปีที่แล้ว

    The code justs get stuck at running for me, Can anyone help?

    • @dark_red_blood
      @dark_red_blood ปีที่แล้ว +1

      Whats the error?
      I need to add return but i see he didn't so idk

  • @yungfilip4143
    @yungfilip4143 2 ปีที่แล้ว

    Dzieki za pomoc

  • @EditsByInduru
    @EditsByInduru ปีที่แล้ว

    printf("Thanks a lot buddy");

  • @mudesh2
    @mudesh2 ปีที่แล้ว

    Finally done :D

  • @rolandARG
    @rolandARG 5 วันที่ผ่านมา

  • @zari_723
    @zari_723 2 ปีที่แล้ว

    uuu this is the last episode

  • @Schwartz866
    @Schwartz866 ปีที่แล้ว

    And then, what next...?

  • @drmetibemulectures
    @drmetibemulectures ปีที่แล้ว

    okay

  • @m7md_xb
    @m7md_xb ปีที่แล้ว

    Comments 😅

  • @mdnan
    @mdnan 7 หลายเดือนก่อน

    comment.

  • @BlueBirdgg
    @BlueBirdgg 9 หลายเดือนก่อน

    "comment"

  • @zuraiakobishvili1757
    @zuraiakobishvili1757 ปีที่แล้ว

    Like();

  • @chjejwjs
    @chjejwjs 2 ปีที่แล้ว

    Comment

  • @MAXED_STUDIOS
    @MAXED_STUDIOS 2 ปีที่แล้ว

    So about the #include for stdio.h stdlib.h ctype.h andtime.h, i keep getting the red squiggly lines on the bottom saying they cant open source file, do you know how to fix that?

    • @vatanak8146
      @vatanak8146 ปีที่แล้ว

      same, i cant use any library in VS code

  • @poshangaming3530
    @poshangaming3530 3 ปีที่แล้ว +1

    How contact you

  • @nenjidesu
    @nenjidesu 11 หลายเดือนก่อน +1

    I want to add difficulties. I don’t know how to do that. 🥲
    good tuto though!