comparison code/dotScanner.lm @ 29:5d1ac440b9db

Seems to be working in CPU simulator. Need to remove debug crap
author William Morgan <billjunk@mrgn.org>
date Sat, 26 Jul 2014 00:18:58 -0700
parents 75c97fb80602
children 3287eb6c25fe
comparison
equal deleted inserted replaced
28:75c97fb80602 29:5d1ac440b9db
206 notdone <- 1 206 notdone <- 1
207 while: { notdone } do: { 207 while: { notdone } do: {
208 if: (continuations isInteger?) { 208 if: (continuations isInteger?) {
209 notdone <- 0 209 notdone <- 0
210 } else: { 210 } else: {
211 print: 6 211 print: #[6 continuations]
212 continuations <- flatten: (fold: continuations [] with: :acc el{ 212 continuations <- fold: continuations [] with: :acc el{
213 print: 7 213 print: 7
214 ret <- acc 214 ret <- acc
215 if: notdone { 215 if: notdone {
216 print: 25
216 ret <- el: 217 ret <- el:
217 if: (ret isInteger?) { 218 if: (ret isInteger?) {
218 } else: { 219 } else: {
220 print: #[26 ret]
219 if: (ret value) { 221 if: (ret value) {
222 print: 27
220 notdone <- 0 223 notdone <- 0
221 ret <- (ret tail) 224 ret <- (ret tail)
222 } else: { 225 } else: {
226 print: 28
223 ret <- (ret tail) | acc 227 ret <- (ret tail) | acc
224 } 228 }
225 } 229 }
226 } else: {} 230 } else: {}
227 }) 231 ret
232 }
233 if: notdone {
234 continuations <- flatten: continuations
235 } else: {}
228 } 236 }
229 } 237 }
230 continuations 238 continuations
231 } 239 }
232 240
270 if: atpos { 278 if: atpos {
271 print: 14 279 print: 14
272 move <- 0 280 move <- 0
273 while: { move < 4 } do: { 281 while: { move < 4 } do: {
274 ret <- (makeContClos: grid (calcPos: move myLoc) move | path) | ret 282 ret <- (makeContClos: grid (calcPos: move myLoc) move | path) | ret
283 move <- move + 1
275 } 284 }
276 ret <- #[0 ret] 285 ret <- #[0 ret]
286 print: 21
277 } else: {} 287 } else: {}
278 } 288 }
279 } 289 }
280 } else: { 290 } else: {
281 print: 42 291 print: 42
300 path <- advancer: [(makeContClos: grid myLoc [])] 310 path <- advancer: [(makeContClos: grid myLoc [])]
301 print: #[4 path] 311 print: #[4 path]
302 #[0 (path value)] 312 #[0 (path value)]
303 } 313 }
304 314
305 main <- :initWorld mystery { 315 main <- {
316 print: (step: 0 #[
317 [
318 [0 0 0 0]
319 [0 2 2 0]
320 [0 1 0 0]
321 [0 0 0 0]
322 ]
323 #[0 #[1 2] 2 3 0]
324 []
325 0
326 ])
306 #[0 step] 327 #[0 step]
307 } 328 }
308 } 329 }
309 330
310 331