From dcebd44260fa67b04d217e778265982393ccc032 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Wed, 17 Dec 2025 07:30:19 +0100 Subject: Day4: Comment programs and export text version. --- day4/part1.TXT | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 day4/part1.TXT (limited to 'day4/part1.TXT') diff --git a/day4/part1.TXT b/day4/part1.TXT new file mode 100644 index 0000000..31cdfdf --- /dev/null +++ b/day4/part1.TXT @@ -0,0 +1,44 @@ +\START92\ +\COMMENT=Part1 Day4 s: parsed input, w: input width +\NAME=part1 +\FILE=day4.part1.92f +(s,w) +Func +Local h,i,j,curr,prevs,pc,result + +dim(s)\->\h +If h<1 Then + Return 0 +ElseIf h=1 Then + Return cntbits(s[1]) +EndIf + +0\->\result +For i,1,w + newList(3)\->\prevs + false\->\pc + For j,1,h + getbits(s[j],i-1,3)\->\curr + cnt3bits(curr)\->\prevs[mod(j,3)+1] + \(C)\'and' is not short circuiting + If pc Then + If sum(prevs)<5 Then + result+1\->\result + EndIf + EndIf + curr=2 or curr=3 or curr=6 or curr=7\->\pc + EndFor + \(C)\ last line + If pc Then + 0\->\prevs[mod(h+1,3)+1] + If sum(prevs)<5 Then + result+1\->\result + EndIf + EndIf +EndFor + +result + +EndFunc + +\STOP92\ -- cgit v1.2.3