From 89806e577276de9c544bc423424872b2efc99258 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 11 Dec 2022 11:53:32 -0500 Subject: Solve day 10 part 1 --- 2022/day10.awk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 2022/day10.awk (limited to '2022') diff --git a/2022/day10.awk b/2022/day10.awk new file mode 100644 index 0000000..7788b17 --- /dev/null +++ b/2022/day10.awk @@ -0,0 +1,21 @@ +BEGIN { + cycles = 1; + X = 1; +} +function cycle() { + if (cycles == 20 || (cycles-20) % 40 == 0) { + sum += cycles * X; + } + cycles++; +} +/addx/ { + cycle(); + cycle(); + X += $2; +} +/noop/ { + cycle(); +} +END { + print sum; +} -- cgit 1.4.1 option value='master' selected='selected'>master dontfiles
summary refs log tree commit diff
path: root/etc (unfollow)
Commit message (Expand)Author
2019-12-23Reformat music.txtJune McEnroe
2019-12-23Rename music.md to music.txtJune McEnroe
2019-12-23Add DO YOU DOUBT ME TRAITORJune McEnroe
2019-12-22Add license header to cgit CSSJune McEnroe
2019-12-22Add The Book of EttaJune McEnroe
2019-12-21Revert "Add first working version of imbox"June McEnroe
2019-12-21Add first working version of imboxJune McEnroe
2019-12-20Respect mailmap in gl pretty formatJune McEnroe
2019-12-20Set LANG in cgit filtersJune McEnroe
2019-12-20Source .editrc before applying -v or -eJune McEnroe
2019-12-20Disable signing commitsJune McEnroe
2019-12-19Ignore about-filterJune McEnroe
2019-12-19Fix matching make tags with no sourcesJune McEnroe
2019-12-19Avoid matching := assignments as tagsJune McEnroe
2019-12-18Hide line numbers when rendering mdocJune McEnroe
2019-12-18Customize cgit CSSJune McEnroe
2019-12-18Use :target rather than :focus pseudo-classJune McEnroe
2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe
2019-12-18Add git.causal.agency cgit configJune McEnroe
2019-12-18Bail from hi if input is binaryJune McEnroe
2019-12-16Post "cgit setup"June McEnroe