diff --git a/includes/script.js b/includes/script.js index 1ec35fc..ec68535 100644 --- a/includes/script.js +++ b/includes/script.js @@ -286,12 +286,9 @@ $(document).ready(function() { ); }); - var tilesForMatch = bitsyData.tiles; - // if we want to always create new tiles, don't bother trying to check matches if (tileMatchThreshold === 64) { // even if we want to "always create new tiles" we still don't want to create duplicates - // THIS SEEMS TO NOT BE WORKING var bestMatch = _.find(bitsyData.tiles, function(tile) { return _.isEqual(tile.bitmap, pseudoTile); }); @@ -300,7 +297,7 @@ $(document).ready(function() { bestMatch.match = 64; } } else { - _.each(tilesForMatch, function(tile) { + _.each(bitsyData.tiles, function(tile) { tile.match = 0; _.each(tile.bitmap, function(row, y) { @@ -326,8 +323,8 @@ $(document).ready(function() { // what if there are several equally good matches? // find highest match amount and find all of them - var bestMatchAmount = _.last(_.sortBy(tilesForMatch, ['match'])).match; - var bestMatches = _.filter(tilesForMatch, {'match': bestMatchAmount}); + var bestMatchAmount = _.last(_.sortBy(bitsyData.tiles, ['match'])).match; + var bestMatches = _.filter(bitsyData.tiles, {'match': bestMatchAmount}); // sort by name in ascending order // earlier names are preferable