commit 40f45b8bf82091f75de368348e10726219431fab
parent 8a176916e4c5dbaf2fef33d96fe841ffaae99bc1
Author: alex wennerberg <alex@alexwennerberg.com>
Date: Fri, 2 Dec 2022 08:37:33 -0800
simplify foil
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/2022/02.fs b/2022/02.fs
@@ -4,8 +4,8 @@ variable score
2 constant scissors
: points-of 1+ ;
-: victim ( u1 -- u2 ) 1- dup 0< if drop 2 exit then ;
: foil ( u1 -- u2 ) 1+ 3 mod ;
+: victim ( u1 -- u2 ) foil foil ;
: game-score ( u1 u2 -- u3 )
2dup swap foil = if 2drop 6 exit then
2dup swap victim = if 2drop 0 exit then