changeset 67:ff8d7b4499f5 default tip

Submission prep
author Mike Pavone <pavone@retrodev.com>
date Mon, 16 Jul 2012 04:48:50 -0700
parents cffcf36f1610
children
files simulate src/lifter.tp src/sim.tp
diffstat 3 files changed, 11 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/simulate	Mon Jul 16 04:37:00 2012 -0700
+++ b/simulate	Mon Jul 16 04:48:50 2012 -0700
@@ -7,9 +7,9 @@
 
 mkfifo .simpipe
 if [ $# -gt 1 ]; then 
-	bin/sim $1 < .simpipe | bin/lifter > .simpipe & killafter $2
+	bin/sim $1 < .simpipe | ./lifter > .simpipe & killafter $2
 else
-	bin/sim $1 < .simpipe | bin/lifter > .simpipe
+	bin/sim $1 < .simpipe | ./lifter > .simpipe
 fi
 rm .simpipe
 
--- a/src/lifter.tp	Mon Jul 16 04:37:00 2012 -0700
+++ b/src/lifter.tp	Mon Jul 16 04:48:50 2012 -0700
@@ -138,11 +138,9 @@
 				}
 			}
 			cullStatesTo <- :n {
-				os write: 2 "culling " . (states length) . " to " . n . "\n"
 				if: n < (states length) {
 					states <- topN: states n
 				}
-				os write: 2 "states length is now " . (states length) . "\n"
 			}
 		}
 	}
@@ -186,48 +184,17 @@
 		
 		text <- sim readFd: 0
 		initial <- (sim state) fromStr: text
-		os write: 2 text
-		os write: 2 "width: " . (string: (initial width)) . "\n"
-		os write: 2 "height: " . (string: (initial height)) . "\n"
 		
 		finder <- moveFinder: initial
 		
 		maxsteps <- initmaxsteps
 		while: { bestMove: finder withMaxSteps: maxsteps } do: {
-			//best <- -1000000
-			//bestscore <- -1000000
-			//foreach: (finder states) :idx el {
-			//	h <- (el heuristic)
-			//	s <- (el score)
-			//	if: (h > best) {
-			//		best <- h
-			//	}
-			//	if: (s > bestscore) {
-			//		bestscore <- s
-			//	}
-			//}
 			if: ((finder states) length) > cullwhenover {
 				finder cullStatesTo: cullstates
 			}
 			maxsteps <- aftermaxsteps
-			os write: 2 "--------iteration results-------\n"
-			os write: 2 "Best:\n"
-			(finder curbest) printGrid
-			//os write: 2 "Hash: " . ((finder curbest) hash)
-			//os write: 2 "Current before cull\n"
-			//os write: 2 " Best Heuristic: " . best . "\n"
-			//os write: 2 " Best Score: " . bestscore . "\n"
-			//os write: 2 "After cull:\n"
-			//foreach: (finder states) :idx el{
-			//	os write: 2 " " . idx . " Heuristic: " . (el heuristic) . "\n"
-			//	os write: 2 " " . idx . " Score: " . (el score) . "\n"
-			//}
-			//os write: 2 "Current:\n"
-			//(finder playfield) printGrid
 		}
-		os write: 2 "---------------\n"
-		os write: 2 "End Best:\n"
-		(finder curbest) printGrid
+		(finder curbest) printMoves
 		0
 	}
 }
--- a/src/sim.tp	Mon Jul 16 04:37:00 2012 -0700
+++ b/src/sim.tp	Mon Jul 16 04:48:50 2012 -0700
@@ -401,6 +401,12 @@
 					}
 					os write: 2 "\n"
 				}
+				printMoves <- {
+					foreach: moves :idx m {
+						os write: 1 m
+					}
+					os write: 1 "\n"
+				}
 				clone <- {
 					cgrid <- #[]
 					foreach: grid :idx el {
@@ -517,8 +523,8 @@
 		} else: {
 			verbose <- true
 			text <- readFile: (args get: 1)
-			print: text
-			//os close: 1
+			os write: 1 text
+			os close: 1
 			simState <- state fromStr: text
 			while: { not: (simState ended: ) } do: {
 				simState advance: (getMove: )