aboutsummaryrefslogtreecommitdiff
path: root/2019/eight.nim
diff options
context:
space:
mode:
authorj-james2022-12-12 02:15:44 +0000
committerj-james2022-12-12 02:18:55 +0000
commita7ba598a54a8883c83cb9ef2b04d653eecd92e28 (patch)
tree06d362d3a88c615d8747ddf9a961bf491a8575a5 /2019/eight.nim
parent13007178188cd89b31e3e41090e8a8ed64867c13 (diff)
Reorganize 2019 solutions
Diffstat (limited to '2019/eight.nim')
-rw-r--r--2019/eight.nim30
1 files changed, 0 insertions, 30 deletions
diff --git a/2019/eight.nim b/2019/eight.nim
deleted file mode 100644
index ecf291e..0000000
--- a/2019/eight.nim
+++ /dev/null
@@ -1,30 +0,0 @@
-# Day Eight: Space Image Format
-import os, strutils, sequtils
-
-let
- input: string = paramStr(1)
- digits: string = strip(readFile(input))
- width: int = 25
- height: int = 6
- depth: int = len(digits) div (width * height)
-
-var min, product: int = width * height
-for layer in distribute(@digits, depth):
- if count(layer, '0') < min:
- min = count(layer, '0')
- product = count(layer, '1') * count(layer, '2')
-echo product
-
-for column in 0 ..< height:
- for row in 0 ..< width:
- for layer in 0 ..< depth:
- case digits[(layer * height * width) + (column * width) + row]
- of '0':
- write(stdout, ' ')
- break
- of '1':
- write(stdout, 'X')
- break
- else:
- discard
- write(stdout, '\n')