View difference between Paste ID: fXw8jFxB and UJvNq5Zq
SHOW: | | - or go back to the newest paste.
1
\ Character race
2
3
variable 1p
4
variable 2p
5
72 constant finish-line
6
7
: 2dice
8
dup random swap random + ;
9
10
: place1
11
12
 1p @ 3 at ." 1>" ;
13
14
: place2
15
16
 2p @ 7 at 50 ." 2>" ;
17
18
: calculate
19
dup @ 3 2dice + swap ! ;
20
21
: .finish-line
22
  12 0 do
23
         finish-line i at 124 femit
24
       loop ;
25
26
: init
27
0 1p ! 0 2p ! place1 place2  .finish-line cursor-off ;
28
29
30
: crace
31
init
32
  begin
33
  cls
34
  .finish-line
35
  place1
36
  place2
37
  1p calculate
38
  2p calculate
39
  1p @ finish-line > 2p @ finish-line > or
40
  until
41
  cls
42
  .finish-line
43
  place1
44
  place2
45
  cr
46
  1p @ 2p @ > if ." One wins!" then
47
  2p @ 1p @ > if ." Two wins!" then
48
  1p @ 2p @ = if ." It's a tie!" then
49
  cr
50
  cursor-on ;
51
52
53
54
55