YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -1,25 +1,26 @@
|
|||
import tables, math, strutils, complex
|
||||
randomize()
|
||||
import tables, math, strutils, complex, random
|
||||
|
||||
proc random[T](a: openarray[T]): T =
|
||||
result = a[random(low(a)..len(a))]
|
||||
result = a[rand(low(a)..len(a))]
|
||||
|
||||
type Point = tuple[x, y: int]
|
||||
|
||||
var world = initCountTable[Point]()
|
||||
|
||||
var possiblePoints = newSeq[Point]()
|
||||
|
||||
for x in -15..15:
|
||||
for y in -15..15:
|
||||
if abs((x.float, y.float)) in 10.0..15.0:
|
||||
possiblePoints.add((x,y))
|
||||
|
||||
randomize()
|
||||
for i in 0..100: world.inc possiblePoints.random
|
||||
|
||||
for x in -15..15:
|
||||
for y in -15..15:
|
||||
if world[(x,y)] > 0:
|
||||
stdout.write min(9, world[(x,y)])
|
||||
let key = (x, y)
|
||||
if key in world and world[key] > 0:
|
||||
stdout.write min(9, world[key])
|
||||
else:
|
||||
stdout.write ' '
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue