Skip to content

Commit

Permalink
When guessing a palette, sort the palette to make it more predictable.
Browse files Browse the repository at this point in the history
Guessed palettes sort each option. Update unit test files that are affected. Modify the performance test data, which would otherwise overflow.

----------------
real    0m0.343s
user    0m0.276s
sys     0m0.037s
  • Loading branch information
dustmop committed Oct 11, 2016
1 parent 40c51eb commit f526732
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion makechr/guess_best_palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def get_palette(self, possibilities):
pal = palette.Palette()
pal.set_bg_color(bg_color)
for color_set in color_set_collection:
pal.add([bg_color] + [c for c in color_set if c != bg_color])
pal.add([bg_color] + sorted([c for c in color_set if c != bg_color],
reverse=True))
return pal

def guess_palette(self, color_needs_list):
Expand Down
Binary file modified makechr/res/perf_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testdata/combine-colors-palette.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
080 
0(0 
Binary file modified tests/testdata/combine-colors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testdata/full-image-chr-8x16.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testdata/full-image-palette-sprite.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
00000000000000000800000000000
00000000000000000800000000000

0 comments on commit f526732

Please sign in to comment.