# HG changeset patch # User William Morgan # Date 1342257692 25200 # Node ID f28e465e9ee6f588d72bc44f2c711f4e05727054 # Parent 370a1eeb881268fa58e88f30652927cdf40d25a1 tried to unf*ck, ashamed rebarfing diff -r 370a1eeb8812 -r f28e465e9ee6 src/sim.tp --- a/src/sim.tp Sat Jul 14 01:58:43 2012 -0700 +++ b/src/sim.tp Sat Jul 14 02:21:32 2012 -0700 @@ -1,6 +1,4 @@ -#{ - - // utilities +{ true <- #{ if:else <- :self trueblock :elseblock { trueblock: @@ -13,19 +11,7 @@ } } - foreach <- :string action { - strLen <- string byte_length: - index <- 0 - while: {index < strLen} do { - element <- (string byte: index) - action: index element - index <- index + 1 - } - } - // end utilities - - - cellTypes <- #{ + makeCellTypes <- { allstr <- #[] allobj <- #[] new <- :idstr { @@ -37,38 +23,63 @@ allstr append: idstr ret } - find <- :idstr { - if: idstr = "R" { robot } else: { - index <- 0 - while: { - if: index < (allstr length) { - (allstr get: index) != idstr - } else: {false} - } do: { - index <- index + 1 + #{ + find <- :idstr { + if: idstr = "R" { robot } else: { + index <- 0 + while: { + if: index < (allstr length) { + (allstr get: index) != idstr + } else: {false} + } do: { + index <- index + 1 + } + if: index < (allstr length) { + allobj get: index + } else: { + empty + } } - if: index <- (allstr length) { - allobj get: index - } else: { - empty + } + wall <- new: "#" + empty <- new: " " + earth <- new: "." + rock <- new: "*" + lambda <- new: "\\" + closedlift <- new: "L" + openlift <- new: "O" + newline <- new: "\n" + robot <- { + #{ + id <- ("R" byte: 0) + isrobot <- { true } + heldBreath <- 0 } } } - wall <- new: "#" - empty <- new: " " - earth <- new: "." - rock <- new: "*" - lambda <- new: "\\" - closedlift <- new: "L" - openlift <- new: "O" - newline <- new: "\n" - robot <- { - #{ - id <- ("R" byte: 0) - isrobot <- { true } - heldBreath <- 0 + } + ttrue <- true + tfalse <- false +#{ + + // utilities + true <- {ttrue} + + false <- {tfalse} + + foreach <- :string action { + strLen <- string byte_length: + index <- 0 + while: {index < strLen} do: { + element <- (string byte: index) + action: index element + index <- index + 1 } - } + } + // end utilities + + + cellTypes <- makeCellTypes: state <- #{ new <- :in_grid in_width in_height { @@ -102,8 +113,8 @@ ended <- roboMove = "A" } doUpdate <- { - updateCell <- :x, y { - if + updateCell <- :x y { + //if } } advance <- :roboCmd { @@ -189,3 +200,4 @@ } } +}