The moment you showed me "Extract Method" as a feature of my IDE I immediately saved your video. That is EXTREMELY useful for most of my troubles coding in java.
@CodingWithJohn3 жыл бұрын
Awesome! I definitely remember all the simple OMG moments of learning all the great things IDEs can do - Extracting methods, auto-creating getters and setters, renaming everything. Might be a great subject for a future video. In the meantime, give it a right click and explore the menu to see what it can do for you!
@m77mo652 жыл бұрын
I'm not a junior developer, but I don't know why I enjoy watching all your videos sir. Keep it up.
@abhishek-gu6qt Жыл бұрын
i learned many thing throughout this like most of is eclipse shortcuts! thanks!
@kxnyshk3 жыл бұрын
Wow this was so awesome! And easy to learn. One don't need much of exposure to Java, to understand this. Also the shortcut for converting code directly into a method was pretty awesome! I wasn't aware of that. 💙
@thiagogaitkoski35623 жыл бұрын
Thanks for helping with my college work. ❤️From Brazil
@aniruddhkhatri98343 жыл бұрын
Thanks a lot for explaining, John. Because of you I am fully able to understand Java.
@CosmonautCoding4 жыл бұрын
Awesome tutorial John! Thank you for sharing
@CodingWithJohn4 жыл бұрын
Thank you sir!
@mrmichalification3 жыл бұрын
I would like to thank You for this tutorial. It is focused to teach and show the idea. It helped me a lot. Thx.
@CodingWithJohn3 жыл бұрын
Thank you for the kind words! Glad it helped you out.
@mouloudguell27632 жыл бұрын
thank you for the tutorial that helps a lot with practicing .hopefully you will put more projects
@CodingWithJohn2 жыл бұрын
Let me know if you have ideas for any!
@mouloudguell27632 жыл бұрын
@@CodingWithJohn would it be possible please to do a tutorial on snake game that uses JFrame and JPanel ? or any more of this type of games as it really helps practicing . few youtubers actually do projects like this .
@SkAbdulSajeed10 ай бұрын
I saw this and it was very helpful to me thank you very much
@ismaelmontenegro9600 Жыл бұрын
You saved my friends life mate. ❤
@Rooswarden3 жыл бұрын
Thank you from the Netherlands ❤️
@MTB_Bay_Area2 жыл бұрын
If that game changes from 3x3 to n x n this program will have to be modified. I suggest for the testing of if user won to take the user selection say "1" and call a method to test after the placement if row 0 and col 0 are a win. You can only win after you place a value, hence, it is unnecessary to validate location where the user did not place a value. Just check the row, column and diagonal after a placement. This will allow you also to make the game for any size of a matrix. The for loop will simply run for zero to length of the matrix.
@pardeepdangi2922 жыл бұрын
helped me a lot , thanx for your effort for making it look simple .
@inrealife912610 ай бұрын
This task came to me as an internship interview question
@prakashpatel1043 жыл бұрын
Thanks for sharing the very nice tutorial for Tic Tac Toe. But, I would appreciate it if you upgrade the same tutorial with more classes and objects to add the Object-Oriented Flavor. Thanks.
@salamistu Жыл бұрын
I just looked at this video and I made a slot game hahaha good stuff Sir! thank you!
@CodingWithJohn Жыл бұрын
Nice!
@girishanker37962 жыл бұрын
Thanks John. Really loved it!
@richardlink72912 жыл бұрын
Learned a lot through this. Thanks!
@veereshchinna99343 жыл бұрын
It's really fun nd cool. ❤️ *From 🇮🇳 india*
@CodingWithJohn3 жыл бұрын
Thanks, glad you enjoyed it!
@piotrfengler76582 жыл бұрын
Thx John!
@ludovicbocquet9783 Жыл бұрын
Thank you !
@rodmenmx Жыл бұрын
Love it, thank you !!
@saran9161 Жыл бұрын
i just thought of a way to check if game ties , declare a global count variable and whenever a valid move is placed the count increments. when it hits 9 game ties. instead of checking using two nested loop i thought this will be efficient. good vid ❤
@CodingWithJohn Жыл бұрын
Interesting! That could possibly work depending on how you implemented it but you'd just have to be careful to not make it more confusing. Sometimes the ninth move doesn't result in a tie, but instead has a winner. Also it requires a global variable, which although it's not a huge deal in a small program like this, we typically try to avoid them.
@ismaelmontenegro9600 Жыл бұрын
You a real one 💯
@youtuberyo73213 жыл бұрын
This guy fucks! High quality code, great coding style.
@JLSXMK83 жыл бұрын
char 'symbol', huh? I agree. You might have also named it a "playerIndicator", hence it indicates whether the current player is the computer ('o') or the user ('x').
@CodingWithJohn3 жыл бұрын
True - there are always tons of ways you could do it, and the way I have it is certainly not the only way.
@GeM_0973 жыл бұрын
Love from India
@TheGuroguro123 жыл бұрын
Thanks
@SoftwareTestSolutions3 жыл бұрын
You are awesome!
@parthgupta97542 жыл бұрын
thanks v sauce👍🏻
@theBATfamiliar Жыл бұрын
Great video, I'm really enjoying it, thanks!
@GeM_0973 жыл бұрын
Thanks sir I'm your subscriber
@rebhuroy37132 жыл бұрын
Hey your video was really helpful.. now I tried to implement a minimax algorithm on this tic tac toe version but unable to do that. Can you please help me work on that
@MariaEduarda-sx3qy3 жыл бұрын
awesome video
@seanchoi46983 жыл бұрын
cheers mate
@Apo4584 ай бұрын
You can extract methods?? :0
@KhaledRazouk2 жыл бұрын
hi John thanks for the video it's really cool, but i have a question why you used the method isGameFinished and why we used a loop insid the other one
@hamsejama3 жыл бұрын
Thank you sooo much. You have a clear way of explaining. There are a lot and a lot of contents of how to something or explaining a principle but when it comes to applying that knowledge to a project, that is where you shine brighter. I am in the middle of the tutorial and i have a smile on my face as i admire your teaching style and that i finally found someone who can teach me the way i would prefer to. so a big tHaNk YoU `(*>﹏
@buckygarner11242 жыл бұрын
Hello John, thank you for this video introduction to JAVA using Tic-Tac-Toe. Do you have a version of the TTT game that using object oriented programming? I would assume you could create a Square class, and create a board as an ArrayList of square objects. Just curious if you have a video or link to code for an OOP version. Thanks.
@van1ty6298 ай бұрын
i am trying to make it on IDE netbeans and it doesnt print the board... i did EXACTLY what u did
@mike85_pl Жыл бұрын
i have problem. when i type 6 nothing happens but when i type 9 it selects both 6 and 9. anyone know why? i have the same code
@jimg19282 жыл бұрын
Nice Video! However, can we assume that rand.nextInt(9) + 1 will produce all values between 1 and 9? In particular, let's say that position 5 is the only position left open on the board and that it is the computers turn. How do we know that rand.nextInt(9) + 1 will "ever" produce the number 5 to finish the game?!!!
@rihasanatrofolo24722 жыл бұрын
Nothing with computers is truly "random". There are certain tricks we use to make things look random. The chance of it never hitting 5 is pretty much zero when the interval is so small. Look into "true random" if you're interested, which is based on real time weather.
@MsLetishia2 жыл бұрын
The while statement filters the computer's play. So the computer only makes valid moves
@dem11522 жыл бұрын
does anyone know how to do this using 1D array?
@sayliya3 жыл бұрын
This really helped me but I do ask that you don't do the shortcut keys for the software you are using because it made it harder to follow along since I use JGrasp for my coding and I am new.
@CodingWithJohn3 жыл бұрын
Thanks for the feedback! There will be some times I use them and some times that I don't. If I don't use them, I always get comments like, "you know, you can just use 'sysout' to get System.out.println()". And I know many beginners like seeing shortcuts since they may never learn they exist if they don't see people using them. But I also understand not everyone uses Eclipse.
@anchs2501 Жыл бұрын
Im just gonna comment for the algorithm.
@CodingWithJohn Жыл бұрын
Replying for the viewer interaction
@richardmeyer4182 жыл бұрын
Thank you for this. I know it's many months later, but those switch statements are really ugly. I, personally would make the input into an integer (if it wasn't already) - check if it's 1
@beyond_akshii2 жыл бұрын
you did a nice try over here but your method wouldnt work to let find out the correct row, for eg the user gave 5 as input, for extracting the row number if i follow your method i would subtract 1 from it resulting in 5-1=4 , and as u wrote int row = input/3; and input is also integer hence integer division would be done here, 4/3 , which would result in 1 which isnt my correct row number
@richardmeyer4182 жыл бұрын
@@beyond_akshii - I'm afraid that it IS the correct row number (and column number for that matter). Remember you start counting from 0 - therefore the first row is row 0 and the second row (where the 5 is), is row 1. Similarly for the columns (4%3) gives a 1 - which is the second column (remember we start at 0).
@beyond_akshii2 жыл бұрын
@@richardmeyer418 oh dang forgot about that....thanks!
@richardmeyer4182 жыл бұрын
@@beyond_akshii It happens. We all have occasional blind spots.
@vpenywise2 жыл бұрын
@21:24 - char... hm... "char xo" :)
@alexandrudescultescu9623 Жыл бұрын
instead of hasContestantWon()... we can rename that method weHaveAWinner()...!
@veniaminarapidis8331 Жыл бұрын
tttMark
@vageshnp67926 ай бұрын
❤
@SeanHP3 жыл бұрын
Fact: The first program Bill Gates made was a tic tac toe game
@CodingWithJohn3 жыл бұрын
Ah, we're so alike, Bill Gates and I.
@usebrain28972 жыл бұрын
Anyone has the same problem as me? The "X" doesnt apper after writing a number 1-9....... Did legit everything the same and checked it 5 times.
@CodingWithJohn2 жыл бұрын
If you're comfortable posting your code, I or someone else on here can check it out!
@usebrain28972 жыл бұрын
@@CodingWithJohn ahhh found the problem :D I wrote: "int input = new scanner.nextInt" and then in the switch I wrote: case '1'... Instead of just case 1 🤦♂️ These simple mistakes are killing me sometimes. Thanks for the reach out though!!!
@duvindudinethmin68202 жыл бұрын
🖤
@tallswede80 Жыл бұрын
using all those logical statements in the if structure is poor style. you are supposed to use boolean variables to make the if statements more readable.
@sanjayraju88283 жыл бұрын
I am really struggling with making one of these with two human players I tried it and i can never get it to work.
@CodingWithJohn3 жыл бұрын
Hmm, as long as you're OK with both players of course using the same computer and keyboard (and not doing some very complicated internet-based 2-player game), you can replace the computerTurn() calls with something like "player2Turn()", which can do pretty much the same thing the playerTurn() method does, just putting in the opposite symbol. Then just change the outputs for who wins ("You Win" might change to "player 1 wins", etc), and it should be a functioning game with two human players. If I have some time I'll try and get some functioning code up for that.
@sanjayraju88283 жыл бұрын
@@CodingWithJohn Thank you very much.
@stevemiller7050 Жыл бұрын
I like the tone and voice. but I don't like all the changes during the tutorial. in the end its a waste of time and seems pretty messed up. would be better to prepare yourself better and then run the tutorial without all the changes in method names etc.
@med_abdelghafour Жыл бұрын
chikor dnya ylfortas
@inchworm93112 жыл бұрын
For the computerPlay could we do: int computerPlay = rand.nextInt(10);
@rihasanatrofolo24722 жыл бұрын
Yes you could definitely do that, but you'd have the issue with it choosing 0 sometimes, just adding unnecessary steps to the program, since 0 isn't a valid answer. The range is from 0 to your selected number. With the + 1, you won't have this problem.