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 :(
 
Combat, no disrespect mate but that's pretty close to a "please do my coursework for me or provide me a link that will" thread.

Your task is fairly simple even for someone with basic JS knowledge - just break down what you have to do into chunks:

1. You need to limit the input in the text fields to single digits.
2. You need to capture the input from both form fields.
3. You need to generate a random number.
4. You need to check if that random number falls between two boundaries.

All this is straightforward stuff, you just need to search for examples individually and then spend some time cobbling them together rather than trying to find a completed script.
 
No point doing a masters my good friend, if you ain't going to do the research yourself ;). It's all to easy to ask someone else how to do it. Maybe you should speak to your lecturer?
 
Back
Top Bottom