advent-of-code-2022-uiua/day2-1.uiua

10 lines
392 B
Plaintext
Raw Normal View History

2023-11-10 21:45:35 +00:00
# %s/\(.\) \(.\)/"\1\2"_/
# %s/_$//
DecodeChar ← ((@S|@P)↥=@B=@Y.|⋅∘∶@R)↥=@A=@X..
CharValue ← |1 ⋅∘∶/(((3|2)=@P|⋅∘1)=@R.DecodeChar)
Battle ← ×3+1↥¯1↧1(∘|¯∘)×=0◿2,≠0.¯/-∵(⋅∘∶(=@P.|2)=@S.)
BattleChar ← |1 +CharValueBattle⊂/DecodeChar.
# @A_@X Rock -- @R
# @B_@Y Paper -- @P
# @C_@Z Scissors -- @S
/+≡BattleChar <input>