Challenge

I have completed the Rock Paper Scissors game in the codecademy lesson. I wan to try to make another basic game using JS. Ideas?

I will also accept any other basic JS challenges.

This may be kinda out of your reach but what about a Tic-Tac-Toe Game…

That is a great idea but how would I go about doing it?

See… the fun things about challenges is figuring it out on your own… When you become a programmer when you grow up, no-one is going to assist you… So you should try to do it then ask. Hope this is usefull…

1 Like

what about a guessing game?
the user has to guess the number between a defined range

http://www.8bitrocket.com/2014/03/23/applesoft-basic-javascript-emulator-my-first-game-from-1979/

1 Like

I’ll give the guessing game a shot. Its a good idea.

2 Likes

super, I think it is similar to the rock paper scissors game and you are also going to learn something new.

let us know if you need help :slight_smile:

1 Like

Already working on it. Thanks!

2 Likes

The guessing game is a good idea. Make it give the user 3 tries, and tell them whether it’s lower, higher, or correct. If they don’t guess it after 3 times they fail.

1 Like

just 3 times … I think that would be hard to guess :grin:

1 Like

Im only doing 1-10 now, if i get it I will try up to 100

1 Like

This is how I will assign the number to guess. Thoughts?

var CN = Math.random();
  if (CN <= 0.10) {
    CN = 1;
  }
  else if (CN <= 0.20) {
    CN = 2;
  }
  else if (CN <= 0.30) {
    CN = 3;
  }
  else if (CN <= 0.40) {
    CN = 4;
  }
  else if (CN <= 0.50) {
    CN = 5;
  }
  else if (CN <= 0.60) {
    CN = 6;
  }
  else if (CN <= 0.70) {
    CN = 7;
  }
  else if (CN <= 0.80) {
    CN = 8;
  }
  else if (CN <= 0.90) {
    CN = 9;
  }
  else  {
    CN = 10;
  }
  

You can save yourself some work there. Think about this: what exactly are you doing to each initial CN to get the final number?

2 Likes

Do you mean like multiplying by 10 and rounding?

1 Like

Yes, like that. Do you feel that you need to check the value each time? Could you use math to just do what needs to be done to your initial CN = Math.random(); and not worry about all those different values?

1 Like

This might be a bad question, but what does math random do again?

1 Like

That is the sort of thing you ask Google. :slight_smile: and you test – try asking for and printing values using Math.random()

If you want the specs, the first paragraph gives you that.

1 Like

would it be something like
var CN = Math.random();
CN = Math.round(CN * 10);

1 Like

I’m not trying to avoid directly answering your questions, I’m trying to give you the tools to hunt down these sorts of answers yourself.

If I were working on something and I didn’t know if it was doing what I wanted it to, I would test it by getting it to print out CN after you first assign it a random number and then again after you do the next step to it. Test it a whole bunch of times.

1 Like