Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting an empty iterable throws an error #124

Open
cooljoseph1 opened this issue Apr 21, 2020 · 0 comments
Open

Sorting an empty iterable throws an error #124

cooljoseph1 opened this issue Apr 21, 2020 · 0 comments
Labels

Comments

@cooljoseph1
Copy link

Minimal reproducible code:

# bot.py
def turn():
    x = sorted([])

When trying to sort an empty iterable, the engine throws a ValueError:

File "C:\Users\camac\AppData\Local\Programs\Python\Python36\lib\site-packages\battlehack20\engine\container\runner.py", line 218, in do_turn
    exec(self.locals['turn'].__code__, self.globals, self.locals)
File "bot.py", line 2, in turn
File "C:\Users\camac\AppData\Local\Programs\Python\Python36\lib\site-packages\battlehack20\engine\container\instrument.py", line 14, in instrumented_sorted
    cost = len(iterable) * int(math.log(len(iterable)))
ValueError: math domain error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants