Uiua
Part 1 was fun, though I had quite some frustration with getting the loop work the way I wanted it to.
For part 2 I didn't actually need to modify that much, just pass another function to deal with the list of tachyons: part 1, remove duplicates, part 2, don't remove and count at the end. Easy. Or so I thought.
I realized something was wrong when it just wouldn't stop running and the fan got louder.
Today I started over from scratch and decided to solve both parts at once since I basically got the counts for each row anyways, so I just had to change the way the splitting was handled.
There was one occasion where I got an error that the resulting array would be too big (~4GB) but at least I got a warning instead of seeing RAM usage spike suddenly :P
Code
$ .......S.......
$ ...............
$ .......^.......
$ ...............
$ ......^.^......
$ ...............
$ .....^.^.^.....
$ ...............
$ ....^.^...^....
$ ...............
$ ...^.^...^.^...
$ ...............
$ ..^...^.....^..
$ ...............
$ .^.^.^.^.^...^.
$ ...............
# &fras "input-7.txt" β
βββΈβ @\n
β(=@Sβ‘β)(ββ>0βΈβ‘/+=@^ββ)
ShootSplit β (
β€(=2+>0)
β§»βΈβ
β(ββ(
βββββ[β§»]
β(ββ-β+β)
/+β‘β(β¬0Λβ―ΓβΒ°β)
)
+ββ(Λβ―0β§»)β
)
)
Solve β (
0
β₯(β(+|ShootSplit|ββ‘βββ))β‘β
β
β§»
βββββ/+
)
Solve
β‘(&p $"Part _: _") 1_2
And for completeness sake:
Previous attempt
Edit: Tried to scrape the old code together but seems like it doesn't actually work like this. Probably just some small thing I missed but I don't have the mental energy to take a look at this mess again :P
Prep β β(β=@S)βββΈβ @\n
Splits! β (
Λβ€>0β‘β
β§»
β€(=β§»β€Λβ¨)
β©ββ½βΈΒ¬
βΈβ§»
β(ββ‘[β-β+β]
^β)
)
Shoot! β (
0
β’(β(+
| β£Splits!^βΈβ
0
| β=@^Β°β
)
| >0β
β
β§»)
)
PartOne β (
&fras "input-7.txt"
Prep
ββ
βShoot!β΄
)
PartTwo β (
&fras "input-7.txt"
Prep
β§»β
ββShoot!β
)