Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
daniel zaragoza
1,843 PointsHelp! I am trying to create the bootleg edition of the Price Is Right.
I'm still in the beginning stages of JavaScript where I'm just starting to learn about functions and how they work. Since, I'm the type who learns more by doing then watching. I decided to try re-create price is right game but i have feeling that I need to use code that i still haven't learn yet but i still gave it shot. Here is what i have;
function letsPlay(user1,user2,user3){
var answer = 250;
alert(" Welecome to the price is right bootleg edition. ");
var player1 = prompt(" what is the price of the couch? ");
if(parseInt(player1) === answer) {
alert( user1 + "Let's play. ");
} else if(parseInt(player1) > 250){
var player2 = prompt(" What is the price of the couch.");
} if( parseInt(player2) === answer){
alert( user2 + " let's play");
}else if( parseInt(player2) > answer){
var player3 =prompt(" What is the price of the couch? ");
}
if(parseInt(player3) === answer){
alert(user3 + 'lets play!');
}else{
alert(" Better luck next time " + user1 + " " + " " + user2 + " " + user3 + " but thank you for participating. ");
}
}
letsPlay('Kathy','Joe','Susie');
3 Answers
Steven Parker
243,228 PointsFrom what you have so far, it looks like you already know the programming elements you would need to make this work. You just have a bit of work yet to do before you are finished, including things like:
- allowing someone to play if the previous player did not go over
- allowing someone who bid under but not exactly right to win
- identifying which player is being asked to bid
Did you just want hints like that, or did you have a specific question about it at this point of the development?
P.S. I applaud your "jump in and just do it" style! You get a for that.
daniel zaragoza
1,843 PointsSteven, I guess my question is do I have enough knowledge to realistically finish this little project of mine. Also. few hint's on how to complete this wouldn't hurt either. =)
daniel zaragoza
1,843 PointsThis is what I've come up with please critique my code for my Price is right bootleg edition.
function gameShow(user1,user2,user3){
alert(" Welcome to the Price is Right bootleg editon! ")
var couch = 200;
var player1 = prompt( user1 + " Please enter the amount you think this couch is worth ");
var player2 = prompt( user2 + " Please enter the amount you think this couch is worth ");
var player3 = prompt( user3 + " Please enter the amount you think this couch is worth ");
if(parseInt(player1) === couch || parseInt( player1) > parseInt(player2) && parseInt(player1) > parseInt(player3)){
player1 = true;
//alert( user1 + " Let's Play! ");
}else if(parseInt(player2) === couch || parseInt(player1) < parseInt(player2) && parseInt(player2) > parseInt(player3) ){
player2 = true;
//alert(user2 + " Let's Play! ");
}else if(parseInt(player3) === couch || parseInt(player1) < parseInt(player3) && parseInt(player2) < parseInt(player3) ){
player3 = true;
//alert(user3 + " Let's Play! ");
}
if(player1 ===true){
alert( user1 + " Let's play ");
}else if( player2 === true){
alert( user2 + " Let's play ");
}else if(player3 === true ){
alert(user3 + " Let's play ");
} }
gameShow('Kat', 'John', 'Betty');