This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 1st, 2013  |  syntax: JavaScript  |  size: 0.88 KB  |  views: 259  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var Symbols = []; // list of symbols on the machine
  2. var slots = []; // each slot contains the index of the symbol it contains
  3. var NUMSLOTS = 15;
  4. var NUMSYMBOLS = 5;
  5. var FLICKERDURATION = 3000; //Milliseconds
  6.  
  7. function randomize(){
  8.         var i = 0;
  9.         for(i; i < NUMSLOTS; i++){
  10.                 // picks a random symbol from the symbols list and stores it in the slot
  11.                 slots[i] = Math.floor(Math.random()*NUMSYMBOLS);
  12.         }
  13. }
  14.  
  15. function buttonClick(){
  16.         randomize(); //figure out what all the slots will change into
  17.         setInterval(flickerSlots(), 20); //show symbols flickering before showing the result
  18.         setTimeout(FLICKERDURATION, showResult()); //show the actual resulting symbols
  19. }
  20.  
  21. function flickerSlots(){
  22.        
  23. }
  24.  
  25. function showResult(){
  26.         clearInterval(); //stop the flickering
  27. }
  28.  
  29. window.onload = function(){
  30.         randomize(); // sets all your slots to an initial value before the lever is started
  31. }
clone this paste RAW Paste Data