473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

simple slot machine

75 64KB
i need some help in my code :) , i don't know how to arange the code properly :) .
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <title>clagmay_shuffle</title>
  3. <body>
  4. <form>
  5. <input type="button" value="" id="btn1"/>
  6.  
  7. <input type="button" value="" id="btn2"/>
  8.  
  9. <input type="button" value="" id="btn3"/>
  10.  
  11. <input type="button" value="shuffle" name="btn" onclick="shuffle()"/>
  12. </form>
  13. <script type="text/javascript">
  14.  
  15.  
  16. function shuffle(){
  17.  
  18.  
  19. var x = document.getElementById('btn1').value=Math.floor(Math.random()*6)+1,
  20. y = document.getElementById('btn2').value=Math.floor(Math.random()*6)+1,
  21. z = document.getElementById('btn3').value=Math.floor(Math.random()*6)+1, i=0;
  22.  
  23.  
  24. for setTimeout(function(x,y,z;i++){
  25. {
  26. if (x=y,z)
  27. {
  28. alert("wow");
  29.  
  30. }
  31. continue;
  32.  
  33. }
  34.  
  35.  
  36. },90);
  37.  
  38.  
  39. }
  40.  
  41. </script>
  42. </body>
  43. </html>
  44.  
this is my first time to study java :) .
Jul 31 '12 #1
3 3977
Dormilich
8,658 Expert Mod 8TB
this is my first time to study java :)
then you’re in the wrong class, this is JavaScript. It has only the first four letters in common with Java.

besides that, from line #24 there is pretty much everything wrong.
Jul 31 '12 #2
lyodmichael
75 64KB
i know but i dont know how to combined the timeout and looping in the same time,
Aug 1 '12 #3
Dormilich
8,658 Expert Mod 8TB
that’s simple. you don’t. recursion (using setTimeout()) doesn’t need a loop.
Aug 1 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Chris Cranford | last post by:
I am in the process of implementing a stack machine virtual environment where each entry on the stack is a 32-bit value which then can reference to any memory pointer, numeric value, or alike. ...
1
by: MingChih Tsai | last post by:
Hi there, Are there any slot machine c# sample codes for reference ? Thanks !! Best regards, Paul
1
by: peterggmss | last post by:
This is a slot machine game, 2 forms. One is the actual game (frmMachine) and the other is in the background and randomizes the images shown on frmMachine. I need to make frmMachine wait for...
6
by: Jacob Rael | last post by:
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to...
1
by: raishi | last post by:
I am trying to figure out how to make a simple slot machine program in VBScript that starts by prompting and collecting the desired number of slot machine spins to simulate simulates the spins:...
2
by: Carnell, James E | last post by:
I am thinking about purchasing a book, but wanted to make sure I could get through the code that implements what the book is about (Artificial Intelligence a Modern Approach). Anyway, I'm not a...
7
by: dirtysouth6975 | last post by:
I need some help. I am getting an error of: local function definitions are illegal. What does this mean? Can anybody help me out a little? Thank you. //Specification: This program simulates a three...
11
by: tuom.larsen | last post by:
Dear list, I'm writing very simple state machine library, like this: _state = None def set_state(state): global _state _state = state
8
by: falconsx23 | last post by:
Hi,I want to create a coke machine that distributes cans with the cost of one token. All the cans in the coke machine coast the same. When a token is inserted, one can drops out. The coke machine...
3
mickey0
by: mickey0 | last post by:
Hello, I just want to try to implement a simple State Machine and I'm reasoning whch class I need function Machine(startState) { this.startState = new State(startState); //states list ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.