Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
NUM_POINTS = 100
|
||||
MIN_R = 10
|
||||
MAX_R = 15
|
||||
|
||||
random_circle_points = ->
|
||||
rand_point = ->
|
||||
Math.floor (Math.random() * (MAX_R * 2 + 1) - MAX_R)
|
||||
|
||||
points = {}
|
||||
cnt = 0
|
||||
while cnt < 100
|
||||
x = rand_point()
|
||||
y = rand_point()
|
||||
continue unless MIN_R * MIN_R <= x*x + y*y <= MAX_R * MAX_R
|
||||
points["#{x},#{y}"] = true
|
||||
cnt += 1
|
||||
points
|
||||
|
||||
plot = (points) ->
|
||||
range = [-1 * MAX_R .. MAX_R]
|
||||
for y in range
|
||||
s = ''
|
||||
for x in range
|
||||
s += if points["#{x},#{y}"] then '*' else ' '
|
||||
console.log s
|
||||
|
||||
plot random_circle_points()
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
> coffee foo.coffee
|
||||
|
||||
** *
|
||||
* ** * *
|
||||
* * * *
|
||||
* ** *
|
||||
* * * *
|
||||
* *
|
||||
*
|
||||
* *
|
||||
***
|
||||
** **** *
|
||||
* *
|
||||
* *
|
||||
**
|
||||
*
|
||||
|
||||
* **
|
||||
* * *
|
||||
**
|
||||
* * **
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
***
|
||||
*** * * * * *
|
||||
*** *
|
||||
* * * * *
|
||||
* * *
|
||||
Loading…
Add table
Add a link
Reference in a new issue