changeset 45:9f1ca5ba2684

Discard entries for which we can easily tell that it will be impossible for them to be better than the current best. This allows us to terminate when we cannot solve the map
author Mike Pavone <pavone@retrodev.com>
date Sun, 15 Jul 2012 17:26:25 -0700
parents 0c09730c173e
children 5d2e59cbbc7c
files src/lifter.tp src/sim.tp
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lifter.tp	Sun Jul 15 17:21:27 2012 -0700
+++ b/src/lifter.tp	Sun Jul 15 17:26:25 2012 -0700
@@ -72,7 +72,11 @@
 									curbest <- curfield
 								}
 							} else: {
-								nextstates append: curfield
+								//check theoretical max score for current map state
+								//discard paths that can never be better than our current best
+								if: (curfield maxScore) > (curbest score) {
+									nextstates append: curfield
+								}
 							}
 						}
 					}
--- a/src/sim.tp	Sun Jul 15 17:21:27 2012 -0700
+++ b/src/sim.tp	Sun Jul 15 17:26:25 2012 -0700
@@ -196,6 +196,7 @@
 				waterproof <- 10
 				moves <- #[]
 				score <- 0
+				maxScore <- { score + (lambdaCount - (_robot collected)) * 25 + lambdaCount * 50 }
 				addPoints <- :points { score <- score + points }
 				ended <- {endreached}
 				succeeded <- {_succeeded}