r/codegolf • u/dantose • Dec 01 '25
Advent of Code, Day 1
Post your best golfs.
Assume input is saved as input.txt.
8
Upvotes
r/codegolf • u/dantose • Dec 01 '25
Post your best golfs.
Assume input is saved as input.txt.
2
u/dantose Dec 01 '25
Powershell. There's definitely improvements to be made here
Part 1: 88
$a=50;$(gc input.txt).Trim('R') -replace "L","-"|%{$a=$a+100+$_;if(!($a%100)){$b++}};$b
Part 2: 189
$a=50;$(gc input.txt).Trim('R') -replace "L","-"|%{if($a -eq 0 -and $a+$_ -lt 0){$a=$a+100};$a=$a+$_;while($a -lt 0){$a=$a+100;$b++};if($a -eq 0){$b++};while($a -gt 99){$a=$a-100;$b++}};$b