-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathday2-2.prdc
25 lines (24 loc) · 840 Bytes
/
day2-2.prdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
iIg–Ak{•Hr1h‰‡J¨~HudHL,4/εHt(3%"Q+*"=S{)\Ht~}uPdHu};sHq19690720=}= .. 66 bytes
.. takes a few minutes
{
i .. read full input
Ig .. read int groups thereof
– .. pop and store it into the bullet variable
Ak .. 10 thousand
{ .. a predicate, given 100 * noun + verb, to see if it works
•Hr .. put the bullet array, original program, into H, the default hoard
1h‰ .. divmod the index against 100
‡ .. make a length-2 list
J .. zip it with its indices
¨ .. flatten
~ .. expand
Hud .. do two updates
HL,4/ .. get indices and break into chunks of 4 and
ε .. loop for each chunk of indices, same as level 1
Ht(3%"Q+*"=S{)\Ht~}uPdHu
}
;s .. pop everything off the stack
Hq .. get the first element of the hoard
19690720= .. is it equal?
}= .. find the index where this is true
};