tweaking crossword a bit
This commit is contained in:
@ -225,7 +225,7 @@ class CrosswordGeneratorStep(object):
|
|||||||
grid_width: int | None = None,
|
grid_width: int | None = None,
|
||||||
grid_height: int | None = None,
|
grid_height: int | None = None,
|
||||||
grid_block_ratio: float = 0.25,
|
grid_block_ratio: float = 0.25,
|
||||||
max_slot_length: int = 15,
|
max_slot_length: int = None,
|
||||||
available_words_for_slotindex: Optional[Dict[int, Set[Word]]] = None,
|
available_words_for_slotindex: Optional[Dict[int, Set[Word]]] = None,
|
||||||
unfilled_slots: Optional[Set[int]] = None,
|
unfilled_slots: Optional[Set[int]] = None,
|
||||||
rnd=None,
|
rnd=None,
|
||||||
@ -255,6 +255,8 @@ class CrosswordGeneratorStep(object):
|
|||||||
self._grid_width = grid_width
|
self._grid_width = grid_width
|
||||||
self._grid_height = grid_height
|
self._grid_height = grid_height
|
||||||
self._grid_block_ratio = grid_block_ratio
|
self._grid_block_ratio = grid_block_ratio
|
||||||
|
if max_slot_length is None:
|
||||||
|
max_slot_length = min(max(grid_width, grid_height) // 2 + max(grid_width, grid_height) + 4, 20)
|
||||||
self._max_slot_length = max_slot_length
|
self._max_slot_length = max_slot_length
|
||||||
self._available_words_for_slotindex = available_words_for_slotindex
|
self._available_words_for_slotindex = available_words_for_slotindex
|
||||||
|
|
||||||
@ -466,10 +468,9 @@ if __name__ == "__main__":
|
|||||||
print(f"Testing with seed {seed}")
|
print(f"Testing with seed {seed}")
|
||||||
generator = CrosswordGeneratorStep(dictionary=dict_obj,
|
generator = CrosswordGeneratorStep(dictionary=dict_obj,
|
||||||
seed=seed,
|
seed=seed,
|
||||||
grid_width=30,
|
grid_width=40,
|
||||||
grid_height=30,
|
grid_height=20,
|
||||||
grid_block_ratio=0.4,
|
grid_block_ratio=0.4)
|
||||||
max_slot_length=15)
|
|
||||||
final_step = generator.generate(
|
final_step = generator.generate(
|
||||||
max_tries_per_step=2,
|
max_tries_per_step=2,
|
||||||
show_progress=True,
|
show_progress=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user