Day 25 done
This commit is contained in:
parent
c1cba6750f
commit
fa083a7c0a
|
@ -5,16 +5,12 @@ proc p1(input: Lines): uint64 =
|
||||||
var w = input[0].len
|
var w = input[0].len
|
||||||
var cukes = input
|
var cukes = input
|
||||||
while true:
|
while true:
|
||||||
echo result
|
|
||||||
var nextCukes = cukes
|
var nextCukes = cukes
|
||||||
echo nextCukes.join("\n")
|
|
||||||
echo ""
|
|
||||||
let startHash = cukes.hash
|
let startHash = cukes.hash
|
||||||
for y,line in cukes.pairs:
|
for y,line in cukes.pairs:
|
||||||
for x,c in line.pairs:
|
for x,c in line.pairs:
|
||||||
let tx = if x >= w - 1: 0 else: x + 1
|
let tx = if x >= w - 1: 0 else: x + 1
|
||||||
if c == '>' and cukes[y][tx] == '.':
|
if c == '>' and cukes[y][tx] == '.':
|
||||||
echo &"{x}, {y} going right"
|
|
||||||
nextCukes[y][x] = '.'
|
nextCukes[y][x] = '.'
|
||||||
nextCukes[y][tx] = '>'
|
nextCukes[y][tx] = '>'
|
||||||
cukes = nextCukes
|
cukes = nextCukes
|
||||||
|
@ -22,7 +18,6 @@ proc p1(input: Lines): uint64 =
|
||||||
for x,c in line.pairs:
|
for x,c in line.pairs:
|
||||||
let ty = if y >= h - 1: 0 else: y + 1
|
let ty = if y >= h - 1: 0 else: y + 1
|
||||||
if c == 'v' and cukes[ty][x] == '.':
|
if c == 'v' and cukes[ty][x] == '.':
|
||||||
echo &"{x}, {y} going down"
|
|
||||||
nextCukes[y][x] = '.'
|
nextCukes[y][x] = '.'
|
||||||
nextCukes[ty][x] = 'v'
|
nextCukes[ty][x] = 'v'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue