Create Rock Paper Scissors in Java in 10 Minutes

Поділитися
Вставка
  • Опубліковано 19 січ 2021
  • Complete Java course: codingwithjohn.thinkific.com/...
    Full source code available HERE: codingwithjohn.com/rock-paper...
    We'll create a Rock Paper Scissors game in Java completely from scratch! Learn user input, while loops, if/else conditions, random numbers, and more.
    This is a very beginner friendly beginner's Java coding lesson tutorial, where we'll create a Rock Paper Scissors game completely from scratch, beginning to end.
    Learn or improve your Java by watching it being coded live!
    Hey, I'm John! I'm a Lead Java Software Engineer who has been in the industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java developers.
    Let me know what else you'd like to see!
    Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
    📕 THE best book to learn Java, Effective Java by Joshua Bloch
    amzn.to/36AfdUu
    📕 One of my favorite programming books, Clean Code by Robert Martin
    amzn.to/3GTPVhf
    🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
    www.audibletrial.com/johnclean...
    🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
    bit.ly/3QPNGko
    📹Phone I use for recording:
    amzn.to/3HepYJu
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com
  • Наука та технологія

КОМЕНТАРІ • 116

  • @factoverfiction4699
    @factoverfiction4699 3 роки тому +58

    Thanks a lot! This video helped. I'm trying to switch careers and have been trying to learn Java on my own for a few months now and still have trouble with basic fundamentals (misplacing a bracket, forgetting a semi-colon, etc). Sometimes it's super frustrating and I want to give up. But videos like yours really help push me forward!!!

    • @mamamiyamama6461
      @mamamiyamama6461 2 роки тому +4

      Hows progress

    • @goldenstatew2399
      @goldenstatew2399 2 роки тому

      I have buddy who's 2 years in and he's been a great mentor to me, it really helps alot to have someone you can go over stuff with. That's my tip

    • @lroadzl1288
      @lroadzl1288 2 роки тому

      @@goldenstatew2399 I should try to do that lol but I'm not much of a social person and don't really have friends so it'll be very difficult for me

    • @turuus5215
      @turuus5215 Рік тому +2

      Online courses will help you a lot. Sign up for a good one after you read reviews and stuff. It will cost you a few tens of bucks. Maybe, John's full Java course will help you even more.

  • @Blablabla01ify
    @Blablabla01ify 8 місяців тому +8

    Dude, you are the only one who made a video to build this game without having to use methods or class calls, and that is very helpful to learn. From experience, although class calls or method are used, it is not always good to use them and sometimes it is better to use everything in one class like in your video. Great!!

  • @mastershonobi110
    @mastershonobi110 2 роки тому +8

    Thanks John! Trying to build on my own. This really helps with the application of knowledge and logic…

  • @MortenPeterHaghJensen
    @MortenPeterHaghJensen Рік тому +1

    Amazing tutorial! I have learned more about Java from a few of your videos than from reading multiple articles, other Java videos, and even a 4 days on-site Java course! So thank you!
    An idea for a revisit of the video is to make a sleep (1 second) iteration like "1-2-3 GO!" and a scoring board! :)

  • @chaudharyu.8453
    @chaudharyu.8453 3 роки тому +6

    Please please continue with these kind of Java videos. Best Java related channel 🙏💪

  • @karantodkar8251
    @karantodkar8251 3 роки тому +6

    Today I made this program on my own in morning and UA-cam recommended me this to me in evening. And after watching this video I am glad to notice that I am close to logic but still need to code like this guyyyy

  • @ashishprakash2879
    @ashishprakash2879 2 роки тому +1

    Video was helpful love from INDIA
    I m cs student practicing java..
    Thanks for this video people like you are blessings to us..

  • @jybinu
    @jybinu 3 роки тому +8

    Hi John
    Many thanks for your infotainment videos. It is really fun learning through play.. I wonder whether you could make videos of coding out game that involves concepts of java like interface, enums, inheritance, polymorphism, encapsulation, abstraction etc.

  • @NEO-wl9ox
    @NEO-wl9ox Рік тому +1

    Hello mate , I wholeheartedly come across some of your vids brimming with scrumptious fascinations, sophistication and including making up game like tic tac toe , hangman game , word guessing game , sudoku game as well as scrabble game
    All of them are captivating , I even put them out into my practices and working pretty well and I kind feel like I can see light in tunnel with ur immaculate tutorial videos
    Thank you so much man ❤

  • @georgeandary6064
    @georgeandary6064 Рік тому +5

    You are the man for this one John.
    I literally had a cup of coffee this morning while reviewing this for my test tonight and though "I am having Java, while learning JAVA with John".
    Idk what that means I just want you to know you helped, Thanks.

  • @Cinemachoicefilms
    @Cinemachoicefilms Рік тому

    Thanks a million this will aide me in my Java class im taking this semester.

  • @bhaweshpandey4306
    @bhaweshpandey4306 2 роки тому +1

    Now it's looks easy, thanks man🤘

  • @DeQuilon
    @DeQuilon 2 роки тому

    Thank you, it was really helpful.

  • @RecapBoxing
    @RecapBoxing Рік тому

    Thanks for the help man!

  • @captainsloth5895
    @captainsloth5895 2 роки тому +3

    One does not simply leave a "coding with John" video without liking..!

  • @jasminazahirovic3901
    @jasminazahirovic3901 2 роки тому

    hi, thank u so much for the video! as a part of my programming course i got an assignment to programm a rock paper scissors game, but without Random() objects aka functions. what we need to do is to create a linear congruential generator with a cycle from 0 to 2 with a help of an equation and then restrict the cycle with a while loop. any ideas or tipps on how i can implement this? thank u :)

  • @dadianacanales4394
    @dadianacanales4394 2 роки тому

    Thank you! This video really helps. Can you try Math Functions/Strings/Characters - LottoTexas java? Also a Loops - Math Tutor? I'm really having issues understanding this. Thank you for your videos!

  • @PersonPerson-vh2nc
    @PersonPerson-vh2nc 2 місяці тому

    tysm now i can add this to my portfolio and I'm going to show this off to my friends...
    @Coding With John - ur a great teacher and coder - make more videos pls - I would like to add this for my high school or uni profile

  • @blueflamegaming7591
    @blueflamegaming7591 2 роки тому

    Thank u so much for this tutorial this is so perfect for beginners out there just like me and it only took me like about 15 or something but it is really easy so thank u again

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому

      You're very welcome! If you have another simple beginner Java program I might cover here on the channel let me know! These kinds of programs don't take long to make, but to a beginner they can make you feel very empowered, being able to create something interactive like this.

  • @crowlovercicada
    @crowlovercicada 5 місяців тому

    SUPER GOOD VIDEO!! noise at the end goes bonkers

  • @newvemo
    @newvemo 3 роки тому +2

    Hi John, thanks for your good and straight tutorials in java.
    Please make a series on threads and multithreading in java。please and please do that, I think you are the only person I understand among all youtubers
    Thanks and god bless you

    • @CodingWithJohn
      @CodingWithJohn  3 роки тому

      Multithreading can be real complicated, but that's a nice idea for a video. Maybe I can start with a something simple there. Thanks a ton for watching!

    • @newvemo
      @newvemo 3 роки тому

      @@CodingWithJohn thanks for your reply John,
      I will be very very grateful for that, anyway I will be waiting for it

  • @tosh_media39
    @tosh_media39 Рік тому

    Appreciate it man...Thumps up

  • @ineshverma2666
    @ineshverma2666 2 роки тому

    THanks a lot!!

  • @garethireson9155
    @garethireson9155 Рік тому

    Hi John. I'm finding your videos incredibly easy to understand and follow along to. I have followed this and got a working Rock Paper Scissors game which I'm so super happy about considering i'm only a matter of weeks into my Java journey.
    I have one problem though. The scanner.close(); throws up an error and says cannot resolve symbol 'scanner' and expected. Why is this happening? the game functions fully without an error if scanner.close() is deleted/commented out.

  • @immythic8351
    @immythic8351 2 роки тому

    I love your videos bro!

  • @AirCrinkly
    @AirCrinkly 3 роки тому +1

    This man is so Underrated! Instead of going to coding school It's better to learn from this guy! It's so fun and easy while coding schools take so much money and It's hard.
    (That's my opinion)

    • @AirCrinkly
      @AirCrinkly 3 роки тому

      Eyyy thanks for hearting it!!!

  • @kafychannel
    @kafychannel Рік тому +1

    awesome thank you congrats with 200k subscribers!

  • @materjoby5092
    @materjoby5092 7 місяців тому

    wow, i have a project due for this in my java, it's not the same but it is similar. Overall you teach this so well. I understood each step. Be a professor bro.

  • @lucianocampanelli7325
    @lucianocampanelli7325 2 роки тому +1

    Excelent video for begginers like me 😄

  • @sultanjarvaniv4275
    @sultanjarvaniv4275 Рік тому

    wow that was a really good video!

  • @marcos.a8814
    @marcos.a8814 Рік тому

    Hey there, I know this video a bit old but I'm doing this as a sort of school project, but when you input
    System.out.println(playerMove + " is not a valid move!");
    it actually tells you that what you do input isn't a valid move, so idk if maybe I made a mistake or it was a mistake but just wanted to point that out. thank you for these videos I really appreciate them and you're an excellent guide in helping me get to know java

  • @delpepitozipepit1010
    @delpepitozipepit1010 2 роки тому

    You are the best, but I have a question for the last scanner why u dont use scanner.nextChar if we only write only y or n

  • @shoaibaltaf705
    @shoaibaltaf705 3 роки тому

    You are great my dear

  • @HKEDITZ08
    @HKEDITZ08 Місяць тому

    Thanks ❤

  • @computer_gyata_9984
    @computer_gyata_9984 Рік тому

    This will be my first game in java

  • @javalady
    @javalady 2 місяці тому

    i think you must close the scanner right before breaking the main loop or outside the main loop. but you closed it at the end of the loop and inside of it, so it only works for the first iteration!!

  • @YobeOllipse
    @YobeOllipse 2 роки тому

    How can I make a validation for that yes or no at the end sir? uhmm btw thank you for the tutorials!

  • @evanserickson
    @evanserickson 2 роки тому

    Why are you using curly brackets on line 6. Can you not use brackets for an array like in JS?

  • @pumpk_1712
    @pumpk_1712 2 роки тому +2

    I learn this kind of stuff and just started java this way really helpfull as my first mini project
    By the way im a 9 year old

    • @doggo4
      @doggo4 2 місяці тому

      It is dangerous to reveal your age on the Internet unless you are over 13.

  • @prohiestcontent8907
    @prohiestcontent8907 Рік тому

    It is vey complex but fun

  • @Poker_Dame
    @Poker_Dame 2 роки тому

    This video is a great help but I was wondering how you can implement a 2 out of 3 system with you vs the computer, can anyone help me out?

  • @nuratikahkamaruzzaman5570
    @nuratikahkamaruzzaman5570 Рік тому

    if i want to put the computer and player have 3 health then if one of player finish health game over the health i should store in array or no need?

  • @rexcoyagbo2054
    @rexcoyagbo2054 2 роки тому

    Thanks this video that gived me a knowledge but Sr please explain why we used those code??? Because I dont ko all your explainations,,,,for all codes only please

  • @anubhavtrivedi1283
    @anubhavtrivedi1283 3 роки тому

    Make video on asymptotic notation

    • @CodingWithJohn
      @CodingWithJohn  3 роки тому +1

      Hi YOURTUBE! I do see and appreciate your comments. Right now though I think something as complex as asymptotic notation is just on a bit of a higher level than I'm looking to make on the channel. There are certainly a few more seasoned programmers that watch, but I've found that the majority of viewers to the channel are just starting out with Java or even just starting with programming in general, so the videos for now tend to be for a solid, good understanding of basic concepts or full walkthroughs of small practice coding projects. I'll very likely get to those more complex topics in the future, but I think it will likely be a while before that stage.

  • @vedd2603
    @vedd2603 3 роки тому

    you could also put in the order (else if, if, else) right?

    • @CodingWithJohn
      @CodingWithJohn  3 роки тому +2

      You can check the various conditions in whichever order you like, but your if/else if/else checks always must be in that order. You can have "else if" first, since that doesn't make sense.
      You'll always have exactly one "if" first:
      if ( whatever ) {
      }
      That might be all you need. But if you need any "else"s, you can have
      0 or more else ifs:
      else if ( whateverElse) {
      }
      then exactly 1 else, again, only if needed:
      else {
      }
      These can be nested of course, which complicates things, but each layer of if/else nesting has to have that same kind of structure.

  • @ssamu756
    @ssamu756 8 місяців тому

    you should put the random outside while loop so the computer will not always move rock

  • @anilsevincc
    @anilsevincc 20 днів тому

    BRO MADE IT SO EASY THAT I EMBARRASSED MYSELF

  • @franzsanico8381
    @franzsanico8381 8 місяців тому

    how to find missing bracket? I can't run my code due to this issue

  • @johnnys3501
    @johnnys3501 2 роки тому

    My professor told us to only use "break" in a switch statement. Thoughts?

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому +1

      You do need to use break in most switch statements, but I think it's silly to say it's the only place you should use them. They're incredibly useful in loops and often the best way to do what you want to do in a clean way.

  • @tallswede80
    @tallswede80 11 місяців тому

    what are you using as an ide?

    • @CodingWithJohn
      @CodingWithJohn  11 місяців тому

      Eclipse in this video, intellij for a while now though

  • @xXGlitchBoyXx
    @xXGlitchBoyXx Рік тому

    hi john,
    how can i make a win/lose counter for user and pc?

    • @doggo4
      @doggo4 2 місяці тому

      I know I am not john but here is an example:
      int plyrWin = 0;
      int plyrLoose = 0;
      //when the player has won
      //just adds one to the plyrWin variable
      plyrWin++;
      //when the player has lost
      //just adds one to the plyrLoose variable
      plyrLooser++;

  • @Muslim05879
    @Muslim05879 Місяць тому

    can anyone suggests videos like this to practice OOP in java with projects like this ?

  • @thekoalabear6580
    @thekoalabear6580 5 місяців тому

    would it not be better to throw an IllegalArgumentException instead of system.out.println("playermove + ""its not a valid move ") ?

    • @doggo4
      @doggo4 2 місяці тому

      No because that it's telling you that that is not a valid move and this tutorial is for new people in java and so that will probably not know what a Exception is.

  • @vedd2603
    @vedd2603 3 роки тому

    I didn't understand the 11th line code it's way too fast, could you explain what is rps[ ]

    • @CodingWithJohn
      @CodingWithJohn  3 роки тому +2

      Sure! Here are the relevant lines you're talking about:
      String[] rps = {"r", "p", "s"};
      String computerMove = rps[new Random().nextInt(rps.length)];
      This is all just to get a random move (rock, paper, or scissors) for the computer. To do that, I just created an array of Strings, with 3 values, "r", "p", and "s".
      Then on the next line, I'm getting a random element from that array, to use as the computer's move.
      rps.length returns 3 (the array has 3 items in it).
      new Random(someNumber) returns a random int between 0 and one less than the someNumber you pass in. So in this case, it would give us a random int between 0 and 2, since rps.length is 3. We use that random number as the index of the array to retrieve a random computer move.
      Since the random number could be 0, 1, or 2, the computer move could be:
      rps[0], which is "r" for rock
      rps[1], which is "p" for paper, or
      rps[2], which is "s" for scissors.

  • @roughgrass1212
    @roughgrass1212 3 роки тому

    about at 9:40, why we should closed scanner?
    is it important!*-*

    • @CodingWithJohn
      @CodingWithJohn  3 роки тому +1

      Good question! It's definitely best practice to always close your Scanners. For very small programs like this, it probably won't actually cause problems if you don't so it's easy to overlook. But if it's not explicitly closed, what can happen is that Java will keep that resource open and available when it doesn't have to. That's called a resource leak. It takes up resources that could be available to other parts of the program or the computer. So in a large program with a lot of sources of resource leak, it can start to cause problems with Java not having enough resources to do what it needs to do.
      For that reason, it's best to get in the habit of closing them. Plus, closing it gets rid of the warning in the IDE!

    • @luisriveragonzalez9052
      @luisriveragonzalez9052 2 роки тому

      @@CodingWithJohn Is this because closing it frees up more memory?

  • @caguioaeduardo4457
    @caguioaeduardo4457 Рік тому

    what kind of app are you using?

    • @CodingWithJohn
      @CodingWithJohn  Рік тому

      I'm using Eclipse here to write the program

    • @caguioaeduardo4457
      @caguioaeduardo4457 Рік тому

      @@CodingWithJohn I use it too but there's a red "x" show side at the number even though there's nothing wrong and I can't run the code.

  • @SuperPeteTV
    @SuperPeteTV 2 роки тому

    if people understand this then they don't need this video at all

  • @kajalwankhede5214
    @kajalwankhede5214 2 роки тому

    There is one problem in code. Computers move is same until you did not run the code again. When you again run the program only that time computers move is changed. I tried lots of try but it did not resolve. Can anyone help me out

    • @kajalwankhede5214
      @kajalwankhede5214 2 роки тому

      My code is here:-
      Scanner sc = new Scanner(System.in);
      String var, q, quit = "QUIT", play = "PLAY";
      String[] ah = {"S","P","R"};
      String rs=ah[new Random().nextInt(ah.length)];
      System.out.println("Welcome a game ROCK, PAPER, SCISSORS");
      System.out.println("Enter 'R' for Rock, 'P' for Paper, 'S' for Scissors ");
      while (true) {
      System.out.println("Just Enter QUIT or PLAY");
      q = sc.next();
      if (q.equals(quit)) {
      System.out.println("Thanks for playing Rock, Paper, Scissors!");
      break;
      }
      else
      {
      System.out.print("Your choice:- ");
      var = sc.next();
      System.out.println("System Choose :- " + rs);
      if (var.equals(rs)) {
      System.out.println("DRAW");
      } else if (var.equals("P") && rs.equals("R") || var.equals("R") && rs.equals("S")
      || var.equals("S") && rs.equals("P")) {
      System.out.println("!!!YOU WIN!!!");
      } else {
      System.out.println("!!!System WIN!!!");
      }
      }
      }

  • @theviper5069
    @theviper5069 2 роки тому

    I need help John, I couldn't import java.util.Random package.
    it says I have to create a new class for that Random
    someone help me

    • @doggo4
      @doggo4 2 місяці тому

      Just use:
      import java.util.*;
      to import everything (including java.util.Random) in java.util

  • @just_aguy999
    @just_aguy999 2 роки тому

    How would you implement a way to keep track of the scores?

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому +9

      Good question. What you could do is have a variable for the number of player wins, and number of computer wins, declared just outside of the outer while loop (by the Scanner declaration):
      int playerWinCount = 0;
      int computerWinCount = 0;
      Then, in each "if" where the player wins, increment playerWinCount by 1:
      playerWinCount++;
      And in each "if" where the computer wins, increment computerWinCount by 1:
      computerWinCount++;
      So that will keep track of the scores, but you probably want to actually print out the scores too. A good place is probably right after all the "if/else" checks, and just before the "Play again?" print out. It could be something like:
      System.out.println("Current score");
      System.out.println("Player: " + playerWinCount);
      System.out.println("Computer: " + computerWinCount);

  • @rdxdevil5083
    @rdxdevil5083 Рік тому +1

    java is literally very hard, i don't know why most of the peoples like java even it have most complex syntax you see python how much it's easy to create syntax and other working

    • @doggo4
      @doggo4 2 місяці тому

      For me (A java coder) I find java easy but i get your point in python being easy in syntax.

  • @durgabadarwada9470
    @durgabadarwada9470 Місяць тому

    Can you please send the program in comments so that I can copy and then paste it in the java program, please can anybody do this for me

  • @shekhardhami6831
    @shekhardhami6831 3 роки тому +3

    ❤️🎉

  • @user-jy2ks3eo6r
    @user-jy2ks3eo6r 6 місяців тому

    Can anybody one explain me the random and length plij

    • @doggo4
      @doggo4 2 місяці тому

      The random picks a random value from the rps array, and the length gets the length of the rps array. If you don't know what arrays are, they are variables that contain multiple values, kinda like a string with pieces of paper all along it, in which have different values.

  • @JanetNapiza
    @JanetNapiza 2 роки тому

    How to make this in python?

    • @doggo4
      @doggo4 2 місяці тому

      This is a java channel, not a python channel, so you can research python yourself and try to convert the java code into python code.

  • @poe12
    @poe12 Рік тому

    Should be "Play again? (y/any_other_key)"...

  • @shantiniselvam5879
    @shantiniselvam5879 Рік тому

    is this java code for programming 1

    • @CodingWithJohn
      @CodingWithJohn  Рік тому

      Well it's a good coding exercise for beginners, if that's what you mean

  • @gverweijen
    @gverweijen 2 роки тому

    There is a lot of repetition here. How would you refactor this?

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому

      That's an interesting question - There's a lot of repetition of single lines that just print out who wins. There's probably a clever way to refactor all those "if"s to get fewer lines, but the ways I can think of would make the code more confusing.
      One thing you could do, if you wanted to not repeat the "print" lines, would be to instead have some kind of boolean for whether the player has won and initialize it to false:
      playerWins = false;
      Then you can check for just the situations where the player wins, and set it to true. Then you can print whether the player wins at the very end. Something like this:
      if (playerMove.equals(computerMove)) {
      System.out.println("The game was a tie!");
      }
      else {
      boolean playerWins = false;
      if (playerMove.equals("r")) {
      if (computerMove.equals("s")) {
      playerWins = true;
      }
      }
      else if (playerMove.equals("p")) {
      if (computerMove.equals("r")) {
      playerWins = true;
      }
      }
      else if (playerMove.equals("s")) {
      if (computerMove.equals("p")) {
      playerWins = true;
      }
      }
      if (playerWins) {
      System.out.println("You win!");
      }
      else {
      System.out.println("You lose!");
      }
      }
      I'm not sure this is better since it seems a bit harder to understand what's going on. But it does remove a couple of "if" checks and doesn't repeat the print statements anymore.
      Let me know if you have a better way, I'd be interested to see it!

  • @ildemonedelladiarrea1965
    @ildemonedelladiarrea1965 Рік тому

    Proco Dio mondiali calcio 2022

  • @zxlightning1
    @zxlightning1 4 місяці тому

    dude i didnt even know u can use while that why i keep losing my mind 💀my code used if else with boolean i almost correct but not the if else code

    • @doggo4
      @doggo4 2 місяці тому

      Yes the improved use thing JFrame,

    • @zxlightning1
      @zxlightning1 2 місяці тому

      @@doggo4 i didnt learn JFrame yet

  • @prateekkumar2750
    @prateekkumar2750 6 місяців тому +5

    Bro u look like someone😅😅

  • @jeremyrubio1531
    @jeremyrubio1531 2 роки тому

    What I did with this program is I assign it as (scissors as 1 , rock as 2 , paper as 3)
    then just use if statement that will evaluate the if(playersChoice > computersMind)
    You win!.. if( same) then draw , else you lose..
    if I choose 2 (rock) , and the random value pick 1(scissors) then mine is greater than the computer therefore I win. thats what I did with my program.
    Okay this program is wrong lol. Don't listen to this idea 🙏 it got corrected already.

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому +1

      With your rules, doesn't that mean paper would beat scissors, since 3 > 1?
      It sounds like the logic might look simpler, but not actually work how it should.

    • @jeremyrubio1531
      @jeremyrubio1531 2 роки тому

      @@CodingWithJohn Ow ! I see thanks for that correction, I thought I was doing fine there. Sorry I'll do better next time 🙏

    • @CodingWithJohn
      @CodingWithJohn  2 роки тому

      No worries at all! That section of the code is a bit weird, so I'm very open to ideas about cleaning up that logic. Just remember to test thoroughly!

  • @jual71
    @jual71 2 роки тому +1

    Did you just say this was simple 🤣🤣🤣🤣

  • @dominiksycha7994
    @dominiksycha7994 2 місяці тому

    I failed. kurwa

  • @drazzo777cod7
    @drazzo777cod7 Рік тому

    Like soo many years of experience he has and this guys took 10 minutes to make a stupid game like this 😐nice

  • @teemolol3075
    @teemolol3075 Місяць тому

    if (playerMove.equals(computerMove)) {
    System.out.println("Tie!");
    } else if (playerMove.equals("r") && computerMove.equals("s") ||
    playerMove.equals("p") && computerMove.equals("r") ||
    playerMove.equals("s") && computerMove.equals("p")) {
    System.out.println("You win!");
    } else {
    System.out.println("You lose!");
    }