Shoutbox

Web Geek Contest - W/ Prize - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: General (/forumdisplay.php?fid=11)
+---- Forum: General Chit Chat (/forumdisplay.php?fid=14)
+----- Thread: Web Geek Contest - W/ Prize (/showthread.php?tid=53508)

Web Geek Contest - W/ Prize by thc2010 on 12-01-2005 at 10:42 PM

Create a Secret Number Guessing Game Program


1.  Write Pseudocode for a JavaScript program that does the followin

•    Declares a random secret number between 1 and 10.
•    Allows the user to try and guess the secret number.  They are allowed as many guesses as they need to get it right.
•    Help them along by outputting information after each guess.
o    If their guess is too low, out put that “ (number they guessed) is too low.  Please try again.”
o    If their guess is too high, output that “(number they quessed is too high.  Please try again.”
o    If their guess is correct, output “You guessed it!”


2.  Now write the JavaScript Program using your pseudocode as a guide.

You have not yet learned how to generate random numbers so here is the code to declare a variable and then to generate a random number between 1 and 10 and assign it to the variable.

var randomValue;

randomValue = Math.floor (1 + Math.random () * 10);

note: 
•    you must use the proper lettercase -  M must be a capital letter or you will get logic errors

•    you will need to use the if / else selection structure and you will also need to use the while repetition structure in this program. 



------------

Prize:
All of the below
craftytv.com invite
30mb.com invite
gmail invite
web2messenger invite
webdp invite

How to win
Be the first to answer the correct code


RE: Web Geek Contest - W/ Prize by Stigmata on 12-01-2005 at 10:47 PM

haha is this your homework or something?


RE: Web Geek Contest - W/ Prize by ShawnZ on 12-01-2005 at 10:53 PM

function guessinggame() {
  var seed = Math.random() * 9
  var rand = Math.floor(1 + seed);
  var gues
  while (gues != rand) {
    gues = prompt("Guess the number and you'll get a cookie!!")
    if (gues < rand) { alert(gues+" is too low.") }
    else if (gues > rand) { alert(gues+" is too high.") }
  }
  alert("Amazing, you got it right.")
}

guessinggame()


RE: Web Geek Contest - W/ Prize by DJeX on 12-01-2005 at 11:06 PM

quote:
Originally posted by Stigmata
haha is this your homework or something?

I thought the exact same thing and the prizes suck.
RE: Web Geek Contest - W/ Prize by thc2010 on 12-02-2005 at 12:17 AM

yeah, my homework lmfao! just too lazy todo it :S prize sucks.. i admit it does, but its all i can offer for someone to do my homework for me LOL!

Shawz, PM me your email or where even you want those invitations sent to


RE: Web Geek Contest - W/ Prize by wj on 12-02-2005 at 12:32 AM

You still have to write your psudeocode.


RE: Web Geek Contest - W/ Prize by ShawnZ on 12-02-2005 at 02:18 AM

quote:
Originally posted by thc2010
Shawz, PM me your email or where even you want those invitations sent to

forget the prizes, they stink 8-)
RE: Web Geek Contest - W/ Prize by ShawnZ on 12-02-2005 at 02:21 AM

quote:
Originally posted by wj
You still have to write your psudeocode.

In function guessinggame:

     generate a random number and save it to X
     create an empty var named Y to store the guess

     While X doesn't equal Y:

          Open a popup asking for the new value of Y
          Check if it is less than X, and alert the user
          Check if it is more than X, and alert the user

     Alert the user that they won when the loop breaks

Start function guessinggame
RE: RE: Web Geek Contest - W/ Prize by thc2010 on 12-02-2005 at 02:35 AM

quote:
Originally posted by ShawnZ
quote:
Originally posted by thc2010
Shawz, PM me your email or where even you want those invitations sent to

forget the prizes, they stink 8-)


xD ok less work for me lol
Wanna do my chapter defenitions for me too? lol JK!
RE: Web Geek Contest - W/ Prize by surfichris on 12-02-2005 at 02:40 AM

Next time, don't bother posting asking for answers for your homework or offering rewards.

Do some work yourself.