Skip to content

Commit c69da71

Browse files
committed
skip to last instance size if max was stepped over
1 parent 719241f commit c69da71

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

algobattle/battle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,10 @@ async def run_battle(self, fight: FightHandler, config: Config, min_size: int, u
429429
def sizes(size: int, max_size: int) -> Iterable[int]:
430430
counter = count(1)
431431
size = max(size, min_size)
432-
while size <= max_size:
432+
while size < max_size:
433433
yield size
434434
size += next(counter) ** config.exponent
435+
yield max_size
435436

436437
note = "Starting battle..."
437438
for _ in range(config.rounds):

tests/test_battles.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ async def test_full_battle(self) -> None:
155155
await self._expect_fights(always(fail), [1])
156156
await self._expect_fights(
157157
always(succ),
158-
[1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820]
159-
+ [821, 822, 826, 835, 851, 876, 912, 961]
160-
+ [962, 963, 967, 976, 992]
161-
+ [993, 994, 998]
162-
+ [999, 1000],
158+
[1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820, 1000],
163159
score=1000,
164160
total=True,
165161
)

0 commit comments

Comments
 (0)