commit 8a176916e4c5dbaf2fef33d96fe841ffaae99bc1
parent f234fbc91972acc73391470620c60bcb77939bbc
Author: alex wennerberg <alex@alexwennerberg.com>
Date: Fri, 2 Dec 2022 00:01:08 -0800
cleanup comments and newlines
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/2022/02.fs b/2022/02.fs
@@ -1,20 +1,16 @@
variable score
-
0 constant rock
1 constant paper
2 constant scissors
: points-of 1+ ;
-
: victim ( u1 -- u2 ) 1- dup 0< if drop 2 exit then ;
: foil ( u1 -- u2 ) 1+ 3 mod ;
-
-: game-score ( u1 u2 -- u )
+: game-score ( u1 u2 -- u3 )
2dup swap foil = if 2drop 6 exit then
2dup swap victim = if 2drop 0 exit then
2drop 3 ;
-
-: add-score dup>r game-score r> points-of + score +! ;
+: add-score ( u1 u2 -- ) dup>r game-score r> points-of + score +! ;
\ data is code
: A rock ;