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,34 @@
import strutils, sequtils
type
Direction = enum up, right, down, left
Color = enum white, black
const
width = 75
height = 52
maxSteps = 12_000
var
m: array[height, array[width, Color]]
dir = up
x = width div 2
y = height div 2
var i = 0
while i < maxSteps and x in 0 .. < width and y in 0 .. < height:
let turn = m[y][x] == black
m[y][x] = if m[y][x] == black: white else: black
dir = Direction((4 + int(dir) + (if turn: 1 else: -1)) mod 4)
case dir
of up: dec y
of right: dec x
of down: inc y
of left: inc x
inc i
for row in m:
echo map(row, proc(x: Color): string =
if x == white: "." else: "#").join("")