Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Fix the solver; "is not []" compares for identity and is never true…

…, should test for .length instead
  • Loading branch information...
commit 5bf127f72dab5c7f4f9cbcc9ed590babbf79966d 1 parent d6e33c5
@audreyt authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  TowerLogic.js
  2. +1 −1  TowerLogic.ls
View
2  TowerLogic.js
@@ -95,7 +95,7 @@ isDoneOrEmpty = function(towerBricks){
findSolution = function(puzzle, steps){
var possibleNextSteps, i, results$ = [];
window.globalsBad.callCount += 1;
- if (window.globalsBad.solution !== [] && steps.length > window.globalsBad.solution.length) {
+ if (window.globalsBad.solution.length && steps.length > window.globalsBad.solution.length) {
return;
}
if (window.globalsBad.penaltyMax < sum(map(function(it){
View
2  TowerLogic.ls
@@ -50,7 +50,7 @@ isDoneOrEmpty = (towerBricks) ->
findSolution = (puzzle, steps) ->
window.globalsBad.callCount += 1
- return if window.globalsBad.solution is not [] and steps.length > window.globalsBad.solution.length
+ return if window.globalsBad.solution.length and steps.length > window.globalsBad.solution.length
return if window.globalsBad.penaltyMax < sum map (.penalty), steps
if map (.bricks), puzzle |> all isDoneOrEmpty
window.globalsBad.solution = steps
Please sign in to comment.
Something went wrong with that request. Please try again.