comparison src/sim.tp @ 24:8435bf0360f8

merge
author William Morgan <bill@mrgn.org>
date Sat, 14 Jul 2012 14:38:50 -0700
parents 75a005b210c5 be6d1cf7b7d7
children a224dc43877f
comparison
equal deleted inserted replaced
23:75a005b210c5 24:8435bf0360f8
194 myStep <- myStep + 1 194 myStep <- myStep + 1
195 if: myStep > 5 {"A"} else: {"W"} 195 if: myStep > 5 {"A"} else: {"W"}
196 } 196 }
197 } 197 }
198 198
199 readFile <- :path { 199 readFd <- :fd {
200 fd <- os open: path (os O_RDONLY)
201 if: fd < 0 { "" } else: { 200 if: fd < 0 { "" } else: {
202 cur <- "" 201 cur <- ""
203 part <- "" 202 part <- ""
204 while: { 203 while: {
205 part <- os read: fd 128 204 part <- os read: fd 128
206 part != "" 205 part != ""
207 } do: { 206 } do: {
208 cur <- cur . part 207 cur <- cur . part
209 } 208 }
210 os close: fd
211 cur 209 cur
212 } 210 }
211 }
212
213 readFile <- :path {
214 fd <- os open: path (os O_RDONLY)
215 out <- readFd: fd
216 os close: fd
217 out
213 } 218 }
214 219
215 getMove <- { 220 getMove <- {
216 os read: 0 1 221 os read: 0 1
217 } 222 }