Javascript betting game programming troubles

Soldato
Joined
7 Aug 2004
Posts
11,258
Hey all, iv got to create a javagame with the following rules:

1. The player starts with 300 pounds.

2. The player enters a number between 1-9 in the 'From' box and a number between 1-9 in the 'To' box. To play the game with these numbers, the user clicks on the Play button

3. the computer generates a random number between 0-9. If the computer’s number is within the range of the 'From-To' number the player wins some money, otherwise they
lose the money of the bet.

4. The game now returns to step 2

Sounds simple enough but im a java noob, and the jump from 'hello world' and 'make a simple adding thing' we have done so far, is abit much and im somewhat lost to be honest.

Iv been looking around the net for something similar, so i can study how that works and see how the codes written, but I cant find anything so far thats remotely like the game.

Iv tried to break it down but the only code iv found so far is:

var randomnumber=Math.floor(Math.random()*10)

Which will hopefully give me a random number between 0-9

Does anyone know of any very similar games on the net ? any code links ? iv mined most of the popular javascript tutorial sites so far to little avail :(
 
Back
Top Bottom