Skip to content

Commit

Permalink
Fix memory leak, and display puzzle pair counts without rotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Jan 29, 2024
1 parent 93e0c18 commit 311da2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions four_letter_blocks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from four_letter_blocks.font_list_item import FontListItem
from four_letter_blocks.line_deduper import LineDeduper
from four_letter_blocks.main_window import Ui_MainWindow
from four_letter_blocks.puzzle import Puzzle
from four_letter_blocks.puzzle import Puzzle, RotationsDisplay
from four_letter_blocks.puzzle_pair import PuzzlePair
from four_letter_blocks.puzzle_set import PuzzleSet

Expand Down Expand Up @@ -401,7 +401,9 @@ def calculate_needed_counts(self) -> typing.Counter[str]:
front_puzzle, back_puzzle = self.pair_puzzles
assert front_puzzle is not None
assert back_puzzle is not None
needed_counts = back_puzzle.flipped_shape_counts
front_puzzle.rotations_display = RotationsDisplay.FRONT
back_puzzle.rotations_display = RotationsDisplay.BACK
needed_counts = back_puzzle.shape_counts
needed_counts.subtract(front_puzzle.shape_counts)
return needed_counts

Expand Down
1 change: 1 addition & 0 deletions four_letter_blocks/evo_packer.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def setup(self,
shape_counts=shape_counts)
if fitness_calculator is None:
fitness_calculator = PackingFitnessCalculator()
fitness_calculator.summaries.clear()

self.evo = Evolution(
pool_size=1000,
Expand Down

0 comments on commit 311da2e

Please sign in to comment.