Mercurial > repos > icfp2012
diff src/lifter.tp @ 62:ff2b38518a58
Updated heuristic
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 16 Jul 2012 04:03:03 -0700 |
parents | f851895ea67a |
children | ff8d7b4499f5 |
line wrap: on
line diff
--- a/src/lifter.tp Mon Jul 16 02:20:38 2012 -0700 +++ b/src/lifter.tp Mon Jul 16 04:03:03 2012 -0700 @@ -112,16 +112,16 @@ foreach: candidates :idx move { curfield <- curstate clone curfield advance: (move cmd) - if: (not: (visitedStates contains?: curfield)) { - visitedStates add: curfield - if: (curfield ended) { - if: (curfield score) > (curbest score) { - curbest <- curfield - } - } else: { - //check theoretical max score for current map state - //discard paths that can never be better than our current best - if: (curfield maxScore) > (curbest score) { + if: (curfield ended) { + if: (curfield score) > (curbest score) { + curbest <- curfield + } + } else: { + //check theoretical max score for current map state + //discard paths that can never be better than our current best + if: (curfield maxScore) > (curbest score) { + if: (not: (visitedStates contains?: curfield)) { + visitedStates add: curfield nextstates append: curfield } }