Created
September 5, 2013 21:28
-
-
Save iamvery/6456436 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var GRID_WIDTH = 10 | |
| var GRID_HEIGHT = 8 | |
| function random_between(start, end){ | |
| Math.round(Math.random() * (end - start)) + start | |
| } | |
| function randomly_select_bead() { | |
| random_x = random_between(0, GRID_WIDTH) | |
| random_y = random_between(0, GRID_HEIGHT) | |
| PS.BeadColor(random_x, random_y, PS.COLOR_BLACK) | |
| PS.BeadFunction(random_x, random_y, bead_clicked) | |
| } | |
| function bead_clicked(x,y){ | |
| PS.BeadColor(random_x, random_y, PS.COLOR_WHITE) | |
| PS.BeadFunction(x,y,null) | |
| randomly_select_bead() | |
| } | |
| PS.Init = function(){ | |
| PS.GridSize(GRID_WIDTH, GRID_HEIGHT) | |
| randomly_select_bead() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment