Been on and off coding for years. You've literally made me understand everything i couldn't pick up as well so easily :)
@geenade52945 жыл бұрын
BROOOOO thank you ! saved me a boat load of time on my homework assignment! Keep it up!
@user-wf4zd3yp6k3 жыл бұрын
How r u now?
@angieg72573 жыл бұрын
Good example of a beginner game to program.
@Kickflips224 жыл бұрын
I paused the video before you set up the "lose" condition to see if I could figure it out, it works but I came up with something different and I'd like to know if there is any practical difference. While it functions the same, is the way I have it less efficient or does it matter? Here's where it differs: while(!guess.equals(secretWord)) { if(guessCount < guessLimit) { System.out.print("Enter a Guess: "); guess = keyboardInput.nextLine(); guessCount++; }else { outOfGuesses = true; System.out.println("You lose :P"); break; } } if(guess.equals(secretWord)) { System.out.println("You Win!"); } P.S. This is my first time coding and your teaching style has made it so easy to grasp thank you!!
@milandave97356 жыл бұрын
oh man!!! you are genius........ so easy to understand.... thanks for explanation
@thelawgameplaywithcommenta26543 жыл бұрын
I did it slightly differently. I put the if statement outside and after the loop, It's looking for if the guessCount
@hakirawr9644 жыл бұрын
THANK YOU VERY MUCH!!! my grades have hope now, because of you!
@tonydalov6 жыл бұрын
Awesome explanation! Thanks
@yohohoyo56396 жыл бұрын
Really great content, THANK YOU!
@norbertkulacin2726 жыл бұрын
wow amazing example, thanks so much!!!!
@zoilavaca70156 жыл бұрын
How can I add a list of words so that the "secret word"grabs a word from that list , and how can I validate that the user only uses strings when they are guessing ? Thanks from a noob 8)
@zoilavaca70156 жыл бұрын
The list I want to add is in a .txt file - my guess is to import it? because there are too many words to make an array... Hope to hear from you soon! :)
@pritamdavis4 жыл бұрын
@@zoilavaca7015 The game here is a very simple game... And that's the point of this tutorial. It's for explaining the concept of loop using a simple game. But if you still want to do it anyway, what you should do is: 1. Read a .TXT file and convert it into an ArrayList of words 2. Set the secretWord to a random word from the ArrayList
@Future122945 жыл бұрын
I made some minor changes to the code so that the user guesses are not cap-sensitive and I decided to not used booleans as it confused me but the user still gets 3 guesses public static void main(String[] args) { Scanner input = new Scanner(System.in); String secretWord = "cowboys"; String guess = ""; int guessCount = 0; int guessLimit = 3; while (!guess.equals(secretWord)) { if (guessCount < guessLimit) { System.out.print("Enter a guess: "); guess = input.nextLine(); guess = guess.toLowerCase(); guessCount++; if (guessCount == guessLimit) { System.out.println("Out of guesses, You lose!"); } } } System.out.println("You Win!"); } }
@halaramimido Жыл бұрын
for the guess limit, could you also put the while loop inside a for loop that is = to the guess limit?
@itspossible59204 жыл бұрын
Simple and easy to understand. Thanks
@dishabanerjee_chair65834 жыл бұрын
The only place I look for Computer Project solutions😁😁😁😁
@joshuatruelen39084 жыл бұрын
How could you add total score? For example you make 5 questions and it takes correct answer and it print (you got 3 out of 5) etc....
@pritamdavis4 жыл бұрын
Make a int variable score, and each time the user gets a correct answer increase it by one... Then at last print the score
@immer24704 жыл бұрын
What if i want to create 2 options: 1.with no limited attempts 2.with limited attempts ????
@PeiqiLi-RealLove4 жыл бұрын
I just heard a dog barking Lol 7:48
@varshahanji4584 жыл бұрын
urs ears are really so sharp!!
@kishorkumar-ue9lj3 жыл бұрын
Thank you so much for these exercises 💪
@SaiKrishna-qp9jn7 жыл бұрын
You are a genius
@chifuyu79023 жыл бұрын
I made a different code but with same basics and here it is: import java.util.Scanner; public class game{ public static void main (String[]args){ Scanner sc = new Scanner (System.in); String SecretWord ="giraffe"; String guess=""; int count=0; while(!guess.equals(SecretWord)) { System.out.println("Enter a guess"); guess= sc.nextLine(); count++; if(guess.equals(SecretWord)){ System.out.println("You Win!!"); }else if(count==3){ System.out.println("It is an animal"); }else if(count==6) { System.out.println("This animal lives in forest"); }else if(count==8){ System.out.println("Hey loser!"); break; } } } }
@Wolflover_264 жыл бұрын
Thanks a lot!!! It was so useful
@salonipatel78344 жыл бұрын
how to add point for giving right answer and deduct point for wrong guess
@rusty64603 жыл бұрын
coming from c++ basics, this is hell
@khfir62094 жыл бұрын
Why didn’t you import random ?
@shahrzadalbertsson97795 жыл бұрын
Oh Thanks! :)
@mooncakeplaylist4 жыл бұрын
why won't it work for me?
@Yukino9654 жыл бұрын
Thank you so much
@jedcatapang49173 жыл бұрын
what application is this?
@NoNo-ud8zw4 жыл бұрын
Thanks IDOL
@iftakerahmed42635 жыл бұрын
How can i add hints?
@CoderLoAnt2 жыл бұрын
Another guessing game here: kzbin.info/www/bejne/qZa8d6h8pNhqgLc
@freesauce78424 жыл бұрын
it says some are error
@flashmash70514 жыл бұрын
You just did my homework for me 🤧🤧❤️❤️❤️❤️thank you
@LT5Production4 жыл бұрын
great - this is my code :) import java.util.*; public class Guessing_Game { public static Scanner input=new Scanner(System.in); public static void main(String[] args) { String question="SHE HAS BROWN HAIR & CURLLY HAIR, BROWN EYES,WHO IS SHE ? "; System.out.println(question); String guess="carmit"; String SecretWord=input.nextLine(); int i=3; while(!guess.equals(SecretWord) && i>=0) { System.out.println("You have another "+i+" guesses to guess"); System.out.println("try again"); SecretWord=input.next(); i--; } if(i>=0) { System.out.println("you are right");} else System.out.println("you lose"); } }
@tanasisyanev37606 жыл бұрын
he wrote 30line code and he said this was a lot of code in the program ? lol
@Future122945 жыл бұрын
Well this is for beginners and this vid has the most code written in it so far of all the tutorials so yeah