comparison code/dotScanner.lm @ 31:3812bf35168d

Simple AI seems to work now. Lots of debug junk needs to be removed though
author Michael Pavone <pavone@retrodev.com>
date Sat, 26 Jul 2014 00:58:50 -0700
parents 3287eb6c25fe
children 934d03d42a7e
comparison
equal deleted inserted replaced
30:3287eb6c25fe 31:3812bf35168d
205 while: { notdone } do: { 205 while: { notdone } do: {
206 if: (continuations isInteger?) { 206 if: (continuations isInteger?) {
207 notdone <- 0 207 notdone <- 0
208 } else: { 208 } else: {
209 continuations <- fold: continuations [] with: :acc el{ 209 continuations <- fold: continuations [] with: :acc el{
210 print: #[20 acc]
210 ret <- acc 211 ret <- acc
211 if: notdone { 212 if: notdone {
212 ret <- el: 213 ret <- el:
214 print: #[11 ret]
213 if: (ret isInteger?) { 215 if: (ret isInteger?) {
216 ret <- acc
214 } else: { 217 } else: {
215 if: (ret value) { 218 if: (ret value) {
219 print: 12
216 notdone <- 0 220 notdone <- 0
217 ret <- (ret tail) 221 ret <- (ret tail)
218 } else: { 222 } else: {
223 print: 13
219 ret <- (ret tail) | acc 224 ret <- (ret tail) | acc
220 } 225 }
221 } 226 }
222 } else: {} 227 } else: {}
228 print: #[21 ret]
223 ret 229 ret
224 } 230 }
231 print: #[15 continuations]
225 if: notdone { 232 if: notdone {
226 continuations <- flatten: continuations 233 continuations <- flatten: continuations
227 } else: {} 234 } else: {}
235 print: #[16 continuations]
228 } 236 }
229 } 237 }
230 continuations 238 continuations
231 } 239 }
232 240
272 } else: {} 280 } else: {}
273 } 281 }
274 } 282 }
275 } else: { 283 } else: {
276 } 284 }
285 print: #[10 myLoc ret]
277 ret 286 ret
278 } 287 }
279 } 288 }
280 289
281 step <- :myState world { 290 step <- :myState world {
284 myLoc <- (lmState tail) value 293 myLoc <- (lmState tail) value
285 294
286 visited <- treeMap: grid :row { 295 visited <- treeMap: grid :row {
287 treeMap: row :el { 0 } 296 treeMap: row :el { 0 }
288 } 297 }
298 print: #[5 myLoc]
289 path <- advancer: [(makeContClos: grid myLoc [])] 299 path <- advancer: [(makeContClos: grid myLoc [])]
300 print: path
290 #[0 (path value)] 301 #[0 (path value)]
291 } 302 }
292 303
293 main <- :initWorld ghostCode { 304 main <- :initWorld ghostCode {
294 /* 305 /*