Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,24 @@
define dirs = [[1,0], [0,-1], [-1,0], [0,1]]
define size = 100
enum |White, Black|
var plane = size.of { size.of (White) }
var (x, y) = @|([size/2 -> int]*2)
var dir = dirs.len.irand
var moves = 0
loop {
(x >= 0) && (y >= 0) && (x < size) && (y < size) || break
given(plane[x][y]) {
when (White) { dir--; plane[x][y] = Black }
when (Black) { dir++; plane[x][y] = White }
}
++moves
[\x, \y]:dirs[dir %= dirs.len] -> each {|a,b| *a += b }
}
say "Out of bounds after #{moves} moves at (#{x}, #{y})"
plane.map{.map {|square| square == Black ? '#' : '.' }}.each{.join.say}