changeset 12:6ef6dc8ab95e

Get simulator compiling
author William Morgan <bill@mrgn.org>
date Sat, 14 Jul 2012 03:07:02 -0700
parents f28e465e9ee6
children c92633098f1d
files src/sim.tp
diffstat 1 files changed, 18 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/sim.tp	Sat Jul 14 02:21:32 2012 -0700
+++ b/src/sim.tp	Sat Jul 14 03:07:02 2012 -0700
@@ -11,6 +11,16 @@
 	  }
 	}
 
+	eachbyte <- :string action {
+		strLen <- string byte_length:
+		index <- 0
+		while: {index < strLen} do: {
+			element <- (string byte: index)
+			action: index element
+			index <- index + 1
+		}
+	}
+
 	makeCellTypes <- {
 		allstr <- #[]
 		allobj <- #[]
@@ -25,7 +35,7 @@
 		}
 		#{
 			find <- :idstr {
-				if: idstr = "R" { robot } else: {
+				if: idstr = "R" { robot: } else: {
 					index <- 0
 					while: { 
 						if: index < (allstr length) { 
@@ -63,19 +73,10 @@
 #{
 
 	// utilities 
-	true <- {ttrue}
-
-	false <- {tfalse}
+	true <- ttrue
 
-	foreach <- :string action {
-		strLen <- string byte_length:
-		index <- 0
-		while: {index < strLen} do: {
-			element <- (string byte: index)
-			action: index element
-			index <- index + 1
-		}
-	}
+	false <- tfalse
+
 	// end utilities
 
 
@@ -106,18 +107,11 @@
 				collected <- 0
 				moves <- 0
 				ended <- false
-				doMove <- :roboMove {
-					
-					robo <- doMove r
-					nexty <- doMove y
-					ended <- roboMove = "A"
-				}
 				doUpdate <- {
-					updateCell <- :x y {
-						//if
-					}
+					true
 				}
 				advance <- :roboCmd {
+					ended <- roboCmd = "A"
 					robot move: roboCmd
 					moves <- moves + 1
 					doUpdate:
@@ -131,7 +125,7 @@
 			strLen <- str byte_length:
 			maxRow <- 0
 			curRow <- 0
-			foreach: str :index element {
+			eachbyte: str :index element {
 				if: element = ((cellTypes newline) id) {
 					maxRow <- if: curRow > maxRow {curRow} else: {maxRow}					
 					curRow <- 0
@@ -140,7 +134,7 @@
 				}
 			}
 			
-			foreach: str :index element {
+			eachbyte: str :index element {
 				if: element = ((cellTypes newline) id) {
 					// add spaces
 					curRow <- 0