Тёмный

THE ODIN PROJECT: FOUNDATIONS - ROCK PAPER SCISSORS | PROJECT SOLUTION 

Dors Coding School
Подписаться 20 тыс.
Просмотров 12 тыс.
50% 1

📚 Join the Waitlist for Our Next AI Bootcamp - codingdors.com...
🌐 Join the Waitlist for Our Web Development Bootcamp - codingdors.com...
👨‍💻 Learn How to Code with 1-on-1 Private Classes - www.codingdors...
💡 Get Our Solutions and eBook on "The Top Mistakes People Make When Learning How to Code" - www.codingdors...

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 69   
@DorsCodingSchool
@DorsCodingSchool Год назад
👨‍💻 Learn How to Code with Private Classes - www.dorscodingschool.com/coachingplans ❓Having a hard time with CS50, FreeCodeCamp or Odin Project? Practice with our exclusive free coding platform: www.codingdors.com/ 🎯 Are You A Coding Expert? Take Our Free Quiz and Find Out - www.dorscodingschool.com/quiz
@guchierrez
@guchierrez Год назад
thanks for this guide. TOPs javascript introduction was $hit, literally impossible to solve this without external help. there was literally almost no coding practice before this, only a bunch of useless text walls
@DorsCodingSchool
@DorsCodingSchool Год назад
Glad it helped!
@Spiriitu
@Spiriitu Год назад
im glad im not the only one that thought this
@BarcaFan12
@BarcaFan12 Год назад
@@DorsCodingSchool please have you done a video on "Revisiting Rock, Paper and Scissors"?
@Electric-Do-Stuff
@Electric-Do-Stuff Год назад
I know rIght! Luckily I had some JS knowledge going in, but for someone completely new to JS it's a ridiculous task. You're being asked to create arrays and use loops before they have even taught anything about arrays or loops. Not to mention asking you to create a case-insensitive input when they haven't covered string methods in any shape or form. Seems very backward to me.
@Jaimelapoesie
@Jaimelapoesie Год назад
I thought I was just shit as coding until I read this comment... what a crazy first task. I'm probably going back to FreeCodeCamp or CodeAcademy at this point.
@Bandile_sihle_Hlambisa
@Bandile_sihle_Hlambisa 7 месяцев назад
Thank you so Much Giovanna, this is the most simplest breakdown I've seen from all the other solutions I was working with before
@traezeeofor
@traezeeofor 2 года назад
Thanks for this. Great guide to complete my 1st The Odin "Project".
@DorsCodingSchool
@DorsCodingSchool 2 года назад
Glad to hear that! We will be posting more videos about The Odin Project :) By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
@girlintheworld8433
@girlintheworld8433 3 месяца назад
@@DorsCodingSchool oh wow! What a great resource!
@girlintheworld8433
@girlintheworld8433 3 месяца назад
Absolutely brilliant walkthrough
@BarcaFan12
@BarcaFan12 Год назад
@6:50, my console keeps saying "Maths Not defined" And My code is exactly like yours; Function getComputerChoice() { Const choice = options [math.floor(math.random() * options.length)]; Console.log(choice); } getcomputerchoice () ; But my console keeps saying "Uncaught ReferenceError: math is not defined".
@DorsCodingSchool
@DorsCodingSchool Год назад
You probably should use Math with capital M. If you want, you can join our Free Discord Community: www.dorscodingschool.com/discord
@BarcaFan12
@BarcaFan12 Год назад
@@DorsCodingSchool Thanks!
@anitahemmings8785
@anitahemmings8785 Год назад
after trying to put prompt and doing rpm install prompt-sync I get the error : prompt is not defined what do I do?
@doctorsocolinsky3116
@doctorsocolinsky3116 6 месяцев назад
I have the same issue, I know your comment is from long ago but did you find any solution?
@oisterzenitzer9748
@oisterzenitzer9748 Год назад
Hi. When i play the game, it's throwing a logic error. If i chose rock and computer chose paper, it should console log that you lose! paper beats rock! But it is doing the opposite of that. why is that? My code is almost the same as yours. Here is it: const options = ["rock", "paper", "scissor"]; function getComputerChoice() { const choice = options[Math.floor(Math.random() * options.length)]; return choice; } function checkWinner(playerSelection, computerSelection) { if (playerSelection == computerSelection) { return "It's a tie"; } else if ( (playerSelection == "rock" && computerSelection == "scissor") || (playerSelection == "scissor" && computerSelection == "paper") || (playerSelection == "paper" && computerSelection == "rock") ) { return "Player"; } else { return "Computer"; } } function playRound(playerSelection, computerSelection) { const result = checkWinner(playerSelection, computerSelection); if (result == "It's a tie") { return "It's a tie!"; } else if (result == "Player") { return `You win! ${playerSelection} beats ${computerSelection}` } else { return `You lose! ${computerSelection} beats ${playerSelection}` } } function getPlayerChoice() { let validInput = false; while(validInput == false) { const choice = prompt("Rock Paper Scissor"); if (choice == null) { continue; } const choiceInLower = choice.toLowerCase(); if(choice.includes(choiceInLower)) { validInput = true; return choiceInLower; } } } function game() { let playerScore = 0; let computerScore = 0; for( let i = 0; i < 5; i++) { const playerSelection = getPlayerChoice(); const computerSelection = getComputerChoice(); console.log(playRound(computerSelection, playerSelection)); if (checkWinner(playerSelection, computerSelection) == "Player") { playerScore++; } else if (checkWinner(playerSelection, computerSelection) == "Computer") { computerScore++; } } console.log("Game over!") if (playerScore > computerScore) { console.log("Player was the winner!"); } else if (playerScore < computerScore) { console.log("Computer was the winner!"); } else { console.log("We have a tie!"); } } game() Thanks in advance to anyone who is willing to help 😁
@DorsCodingSchool
@DorsCodingSchool Год назад
You should check all the cases when you win or when the computer wins ;)
@oisterzenitzer9748
@oisterzenitzer9748 Год назад
@@DorsCodingSchool Haven't thought of that. Thanks.
@jenniferguneratne2210
@jenniferguneratne2210 2 года назад
Thank you!! I was struggling with announcing the score at the end and this helped me clean up my code to make it work. One thing I noticed: the score had a tendency to increment one point for the player on a tied round, resulting in an inaccurate end result. I added a line to prevent the code from incrementing for either player if the round was drawn. I really appreciate the time you took to make this video!
@DorsCodingSchool
@DorsCodingSchool 2 года назад
We are glad to hear that! Thank you for your feedback, we will fix it :)
@gavincain9837
@gavincain9837 Год назад
I have that same problem, how did you do that? The new line I mean
@Bandile_sihle_Hlambisa
@Bandile_sihle_Hlambisa 7 месяцев назад
​​@@gavincain9837this is how I did it: else if(checkWinner(playerSelection, computerSelection) == "Tie") { scorePlayer++;scoreComputer++; }
@Bandile_sihle_Hlambisa
@Bandile_sihle_Hlambisa 7 месяцев назад
And then I added a line of code console logging the scorePlayer and the scoreComputer to double check if it was working properly
@kauaiguy
@kauaiguy Год назад
Thank you so much for this easy to follow along video! I was stuck on this assignment on TOP and I was easily able to follow and understand what you were doing. Thank you!
@doctorsocolinsky3116
@doctorsocolinsky3116 6 месяцев назад
Hello, thanks for the video, but in the function getPlayerChoice, I do exactly the same as you did there, but the promp never shows, instead the game is played automatically 5 times, with all loses, any help with that?
@unitedvoice1073
@unitedvoice1073 3 месяца назад
Amazing and so simplified, thank you!!
@MacacoVictor
@MacacoVictor Год назад
Giovanna, eu estava com dúvida nesse código e após assistir o seu vídeo eu consegui finalizar o meu. Porém, ao inserir a função game e o loop, meu console mostra que o playerSelection não foi definido, mas se eu tiro a função, o jogo funciona, você poderia me ajudar?? const pick = ["rock", "paper", "scissors"] function getComputerChoice(){ const choice = pick[Math.floor(Math.random() * pick.length)]; return choice; } function checkWinner(){ if(playerSelection == computerSelection){ return "Tie"; }else if (playerSelection == "rock" && computerSelection == "scissors" || playerSelection == "paper" && computerSelection == "rock" || playerSelection == "scissors" && computerSelection == "paper"){ return "Player"; } else{ return "Computer"; } } function playRound(playerSelection, computerSelection){ const result = checkWinner(playerSelection, computerSelection); if (result == "Tie"){ return "It's a Tie!" } else if(result == "Player"){ return `You Win! ${playerSelection} beats ${computerSelection}` } else if (result == "Computer"){ return `You Lose! ${computerSelection} beats ${playerSelection}` } } function getPlayerChoice(){ let validatedInput = false; while(validatedInput == false){ const choice = prompt ("Rock Paper Scissors"); if(choice == null){ continue; } const choiceInLower = choice.toLowerCase(); if(pick.includes(choiceInLower)){ validatedInput = true; return choiceInLower; } } } function game(){ let scorePlayer = 0 let scoreComputer = 0 for(let i = 0; i < 5; i++){ const playerSelection = getPlayerChoice(); const computerSelection = getComputerChoice(); console.log(playRound(playerSelection, computerSelection)) console.log("-----") if (checkWinner(playerSelection, computerSelection) == "Player"){ scorePlayer++; } else if (checkWinner(playerSelection, computerSelection) == "Computer"){ scoreComputer++; } if(scorePlayer>scoreComputer){ console.log("Player wins!") } else if(scoreComputer>scorePlayer){ console.log("PC wins") } else { console.log("Tie again") } } } game()
@beingold
@beingold 4 месяца назад
she is the legend
@mattweatherbean4prez
@mattweatherbean4prez Месяц назад
This is an excellent walkthrough, thank you very much
@patitatitatitatitona
@patitatitatitatitona Год назад
OBRIGADA! i've been doing pretty well on the odin project but i would've never been able to do this by myself lol
@Deatomized
@Deatomized Год назад
Hi! I have to thank you for this guide. As somebody said here before me, as total beginner it was really frustrating to get this thing going from scratch without ever trying to write code in JS. html and css at the beginning was quite fast to learn, only flex box took me couple of days to get a grasp on. (gamify helped a lot - flexfrog! :) ) but I'd like to ask about one thing. PlayRound function is called how, in the for loop? by the console? It's the only thing that's bugging my head. I thought, that I have to call the function inside the for loop to make it run. Can you, or somebody please explain? thanks a lot!
@DorsCodingSchool
@DorsCodingSchool Год назад
We call playRound function inside the game function. If you see we are calling this function to display in the console.log :)
@Deatomized
@Deatomized Год назад
@@DorsCodingSchool thanks for reply. I didnt know, thats enough. :)
@whiskers08spot09
@whiskers08spot09 Год назад
Is there a part 2 for the revisiting rock paper scissors?
@sallycar3114
@sallycar3114 11 месяцев назад
did you get the revisiting video?? did you do it pls??
@whiskers08spot09
@whiskers08spot09 11 месяцев назад
@@sallycar3114 i did not, I ended up switching to doing the Codecademy front end course, way better. Had to pay $150 tho
@whiskers08spot09
@whiskers08spot09 Год назад
18:09 I'm a little confused here. Aren't you supposed to first put 'else'? or is that optional?
@DorsCodingSchool
@DorsCodingSchool Год назад
You can write else or not. It’s optional in this case ;)
@sallycar3114
@sallycar3114 11 месяцев назад
Anyone has the same video but the revisiting one, please?
@asiamahkorehglobal7782
@asiamahkorehglobal7782 2 года назад
Thank you very much
@user-bm8uu5eg5y
@user-bm8uu5eg5y Год назад
thank you for video.I've got question can you sing?
@DorsCodingSchool
@DorsCodingSchool Год назад
You're welcome!
@gavincain9837
@gavincain9837 Год назад
It all works fine except that the prompt doesn't allow anything to show in the console. I have to comment out the function then open the page with live server , then go Back and uncomment the function. Is there a way around this? I tried settimeout but it didn't work either
@Stephen_Muiru26
@Stephen_Muiru26 10 месяцев назад
hello! awesome video. But how do i push to my github. Im having a difficult time doing so. Thank you
@ashalouis8667
@ashalouis8667 Год назад
Thanks. God bless!!!
@DorsCodingSchool
@DorsCodingSchool Год назад
You're welcome!
@stefaniagrigore8162
@stefaniagrigore8162 Год назад
what is the app she uses at the end to push all her work?
@DorsCodingSchool
@DorsCodingSchool Год назад
Sublime merge
@stefaniagrigore8162
@stefaniagrigore8162 Год назад
@@DorsCodingSchool thank you
@Thestorbob
@Thestorbob Год назад
Perfect, thank you! exactly what I needed
@nickrowe9431
@nickrowe9431 Год назад
The way she says winner tho 😂
@kecac4408
@kecac4408 Год назад
I have a problem where the game function is asking for twice as much input and only the second input is taken in as input. function game() { for ( let i = 0; i < 5; i++) { const playerSelection = getPlayerChoice(); const computerSelection = getComputerChoice(); console.log(playRound(playerSelection, computerSelection)); } } Same as yours. I tried commenting out the const`s and resulted in error, once i commented out the console.log it just asked 5 times for input. The problem is visible but why is the code running like this?
@DorsCodingSchool
@DorsCodingSchool Год назад
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@Ohall558
@Ohall558 Год назад
I wrote the code exactly as you did in the video for getPlayerChoice function, but when the page loads the prompt and you enter a choice, the console doesn't log anything and it just restarts the loop? Am I writing something wrong here? function getPlayerChoice(){ let validatedInput = false; while(validatedInput == false){ const choice = prompt("Rock Paper Scissors"); if (choice == null){ continue; } const choiceLowerCase = choice.toLowerCase(); if (options.includes(choiceLowerCase)){ validatedInput = true; return choiceLowerCase; } } }
@DorsCodingSchool
@DorsCodingSchool Год назад
Did you hard reload your page? You should do ctrl + shift + r. This part should be working, you can check our solution on www.dorscodingschool.com/ebook
@Ohall558
@Ohall558 Год назад
@@DorsCodingSchool I just figured out the issue this morning. I had capitalized the array items so the options.included was never going to work. But thank you, this video saved me a ton of frustration!
Далее
Меня Забанили в Steam CS2 / PUBG
19:19
Просмотров 257 тыс.
FATAL CHASE 😳 😳
00:19
Просмотров 1,1 млн
Learn Javascript  Rock, Paper, Scissors
26:28
Просмотров 9 тыс.
THE ODIN PROJECT: TIC TAC TOE | PROJECT SOLUTION
44:51
Being Competent With Coding Is More Fun
11:13
Просмотров 81 тыс.
The Odin Project Review 2024 - Honest Feedback
5:29
Просмотров 39 тыс.
The Most Legendary Programmers Of All Time
11:49
Просмотров 566 тыс.
Меня Забанили в Steam CS2 / PUBG
19:19
Просмотров 257 тыс.