1 divert(-1)dnl -*- m4 -*-
2 # Usage: m4 [-Dfile=day13.input] day13.m4
4 include(`intcode.m4')ifelse(intcode(13), `ok', `',
5 `errprint(`Missing IntCode initialization
10 define(`write', `define(`data', $1)')
11 define(`done', `oneshot(`loop')')
14 oneshot(`io', defn(`pause_after_write'))
15 oneshot(`io', defn(`run_after_write'))
16 oneshot(`io', defn(`run_after_write'))
18 ifelse(data, 2, `define(`part1', incr(part1))')
26 define(`read', `eval((ball > pad) - (ball < pad))')
28 define(`io', `define(`pc', $2)ifelse($1, 0, `run($2)')')
35 ifelse(x.y, -1.0, `define(`part2', data)output(1, `score:'data)',
36 data, 3, `define(`pad', x)', data, 4, `define(`ball', x)')