Mercurial > repos > icfp2012
comparison src/sim.tp @ 28:7a274d6026c8
Use built-in true and false.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 14 Jul 2012 19:33:35 -0700 |
parents | a224dc43877f |
children | d9f1a063a466 |
comparison
equal
deleted
inserted
replaced
27:feb38aecb98f | 28:7a274d6026c8 |
---|---|
1 { | 1 { |
2 true <- #{ | |
3 if <- :self trueblock { | |
4 trueblock: | |
5 } | |
6 if:else <- :self trueblock :elseblock { | |
7 trueblock: | |
8 } | |
9 } | |
10 | |
11 false <- #{ | |
12 if <- :self trueblock { | |
13 self | |
14 } | |
15 if:else <- :self trueblock :elseblock { | |
16 elseblock: | |
17 } | |
18 } | |
19 | |
20 eachbyte <- :string action { | 2 eachbyte <- :string action { |
21 strLen <- string byte_length: | 3 strLen <- string byte_length: |
22 index <- 0 | 4 index <- 0 |
23 while: {index < strLen} do: { | 5 while: {index < strLen} do: { |
24 element <- (string byte: index) | 6 element <- (string byte: index) |
89 } | 71 } |
90 } | 72 } |
91 } | 73 } |
92 } | 74 } |
93 } | 75 } |
94 ttrue <- true | |
95 tfalse <- false | |
96 #{ | 76 #{ |
97 | |
98 // utilities | |
99 true <- ttrue | |
100 | |
101 false <- tfalse | |
102 | |
103 // end utilities | |
104 | |
105 | 77 |
106 cellTypes <- makeCellTypes: | 78 cellTypes <- makeCellTypes: |
107 | 79 |
108 state <- #{ | 80 state <- #{ |
109 new <- :in_grid in_width in_height { | 81 new <- :in_grid in_width in_height { |