yaaaay
This commit is contained in:
parent
0cfef1f5fc
commit
68052f4636
|
@ -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 we want to always create new tiles, don't bother trying to check matches
|
||||||
if (tileMatchThreshold === 64) {
|
if (tileMatchThreshold === 64) {
|
||||||
// even if we want to "always create new tiles" we still don't want to create duplicates
|
// 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) {
|
var bestMatch = _.find(bitsyData.tiles, function(tile) {
|
||||||
return _.isEqual(tile.bitmap, pseudoTile);
|
return _.isEqual(tile.bitmap, pseudoTile);
|
||||||
});
|
});
|
||||||
|
@ -300,7 +297,7 @@ $(document).ready(function() {
|
||||||
bestMatch.match = 64;
|
bestMatch.match = 64;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_.each(tilesForMatch, function(tile) {
|
_.each(bitsyData.tiles, function(tile) {
|
||||||
tile.match = 0;
|
tile.match = 0;
|
||||||
|
|
||||||
_.each(tile.bitmap, function(row, y) {
|
_.each(tile.bitmap, function(row, y) {
|
||||||
|
@ -326,8 +323,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// what if there are several equally good matches?
|
// what if there are several equally good matches?
|
||||||
// find highest match amount and find all of them
|
// find highest match amount and find all of them
|
||||||
var bestMatchAmount = _.last(_.sortBy(tilesForMatch, ['match'])).match;
|
var bestMatchAmount = _.last(_.sortBy(bitsyData.tiles, ['match'])).match;
|
||||||
var bestMatches = _.filter(tilesForMatch, {'match': bestMatchAmount});
|
var bestMatches = _.filter(bitsyData.tiles, {'match': bestMatchAmount});
|
||||||
|
|
||||||
// sort by name in ascending order
|
// sort by name in ascending order
|
||||||
// earlier names are preferable
|
// earlier names are preferable
|
||||||
|
|
Loading…
Reference in New Issue