From fd5a331808b6bec13ca4a7cdeee192da6c456184 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Tue, 2 Dec 2025 23:25:07 +0100 Subject: Day 1 --- day1/day1.part1.92f | Bin 0 -> 612 bytes day1/day1.part2.92f | Bin 0 -> 719 bytes day1/part1.TXT | 38 ++++++++++++++++++++++++++++++++++++++ day1/part2.TXT | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 day1/day1.part1.92f create mode 100644 day1/day1.part2.92f create mode 100644 day1/part1.TXT create mode 100644 day1/part2.TXT (limited to 'day1') diff --git a/day1/day1.part1.92f b/day1/day1.part1.92f new file mode 100644 index 0000000..378c560 Binary files /dev/null and b/day1/day1.part1.92f differ diff --git a/day1/day1.part2.92f b/day1/day1.part2.92f new file mode 100644 index 0000000..10e4975 Binary files /dev/null and b/day1/day1.part2.92f differ diff --git a/day1/part1.TXT b/day1/part1.TXT new file mode 100644 index 0000000..d4d93e3 --- /dev/null +++ b/day1/part1.TXT @@ -0,0 +1,38 @@ +\START92\ +\COMMENT=Single file dated Tue Dec 2 23:20:40 20 +\NAME=part1 +\FILE=day1.part1.92f +(inp,position) +Func +Local pos1,pos2,curr,sig,direct,step,result +0\->\result +1\->\pos1 +While pos1\pos2 + If pos2<1 Then + dim(inp)+1\->\pos2 + EndIf + mid(inp,pos1,pos2-pos1)\->\curr + pos2+1\->\pos1 + If dim(curr)=0 Then + continue + EndIf + left(curr,1)\->\direct + If direct="L" Then + \(-)\1\->\sig + ElseIf direct="R" Then + 1\->\sig + Else + Return {\(-)\1,position} + EndIf + expr(right(curr,dim(curr)-1))\->\step + mod(position+sig*step,100)\->\position + If position=0 Then + result+1\->\result + EndIf +EndWhile + +Return {result,position} +EndFunc + +\STOP92\ diff --git a/day1/part2.TXT b/day1/part2.TXT new file mode 100644 index 0000000..59e033f --- /dev/null +++ b/day1/part2.TXT @@ -0,0 +1,39 @@ +\START92\ +\COMMENT=Single file dated Tue Dec 2 23:21:07 20 +\NAME=part2 +\FILE=day1.part2.92f +(inp,position) +Func +Local pos1,pos2,curr,direct,step,result +0\->\result +1\->\pos1 +While pos1\pos2 + If pos2<1 Then + dim(inp)+1\->\pos2 + EndIf + mid(inp,pos1,pos2-pos1)\->\curr + pos2+1\->\pos1 + If dim(curr)=0 Then + continue + EndIf + expr(right(curr,dim(curr)-1))\->\step + left(curr,1)\->\direct + If direct="L" Then + mod(100-position,100)\->\position + position+step\->\position + result+floor(position/100)\->\result + mod(100-position,100)\->\position + ElseIf direct="R" Then + position+step\->\position + result+floor(position/100)\->\result + mod(position,100)\->\position + Else + Return {\(-)\1,position} + EndIf +EndWhile + +Return {result,position} +EndFunc + +\STOP92\ -- cgit v1.2.3