-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add typecheck (int, float, str) to aocd.models.puzzle.answer_a/b? #97
Comments
Yes, sounds good! Its not a complaint, as indeed its good that your lib transparently transmits types, in case a float is needed as answer in the future. ^ |
I think this is a reasonable compromise- the warning should indicate to a user that they probably want to be careful with their answer type, without the possibility of them getting the dreaded "That's not the right answer" response on a technicality. I will add it when I find the time - or if you would like to prepare a PR to get it in right away, be my guest. |
I could give it a try, but it will need to be thoroughly checked by you, as i'm not as fluent in git-PR'ing. So yes, challenge accepted! :-) |
TIL how to use the PR cycle ;-) |
If you write "closes #97" somewhere in your PR description (you can edit it in), then this issue will be closed automatically by github when the PR is merged. |
oki. just checked it, Seems to work at my end: |
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
Similar to wimglenn#97, this change adds support for coercing numpy scalar types to integers where appropriate. Specifically, we coerce the following types: - numpy.complex instances with no imaginary part -> numpy.float64 - numpy.float/numpy.timedelta64 instances with no float part -> int This change also adds test_submit_numpy_types_coercion to tests/test_submit.py. Additional information on numpy scalar types can be found at https://numpy.org/doc/stable/reference/arrays.scalars.html .
An answer was rejected when send through aocd, when using a float (w/o siginificant digits behind comma) as an input, while it was accepted afterwards from the website, with an int as an input, with the same value. AFAIK, AoC never had any non-whole numbers as the answer in the past?
Expected behaviour:
An int is sent to the website, rather than the float
Potential solution:
Idk how to best catch this unexpected behaviour.
Should the library always send an int? Or do input typecheck on top of valuecheck and give a warning?Maybe change a float answer with mod(X,1)==0 (no significant digits behind comma) to INT?
Example for 6/'22, part A:


Same behaviour for other days 15/'21, for example part B:

was accepted

if you need more info, let me know.
(& kudos for the amazing library!)
The text was updated successfully, but these errors were encountered: