-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
queen-attack test that prevents incorrectly accepted answers due to unsigned type. #1011
Comments
The tests for this exercise come from the language-agnostic problem-specifications. Also, I have to admit I understand neither the problem nor the proposed fix.
And in your new test the queens on squares
|
|
No worries. Sometimes even experienced C programmers trip over the usual arithmetic conversions. Thanks for wanting to help. Happy coding! |
Hello everyone, this is the first time I'm opening an Issue and trying to make a PR, if anything I'm doing is wrong, please let me know.
The issue:
most solutions on the queen-attack exercise uses something like
abs(queen_1.row - queen_2.row) == abs(queen_1.column - queen_2.column);
The problem is when we have a underflow in the first abs() and not on the second one. Leading the students forgetting to check for underflow since row and column are Unsigned Int.There isn't a test to test this position(when both queens are on the opposite side of their initial position, but still on the same diagonal, which is a common chest position and the result should be
CAN_ATTACK
). I've made a simple test that checks this position and ensure the students don't commit this mistakes.The text was updated successfully, but these errors were encountered: