-
Notifications
You must be signed in to change notification settings - Fork 0
6th assignment #35
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
base: master
Are you sure you want to change the base?
6th assignment #35
Conversation
| current_empty, start = move_car(start, position, current_empty) | ||
| yield start | ||
|
|
||
| def print_sequence(start, end): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use crossopts function for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is far more reasonable though
| end_positions = inverse_map(end) | ||
|
|
||
| for position in range(len(start)): | ||
| # At first, move car, that should be placed in current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the coherent comments, they really made this function easy to understand:)
| # At first, move car, that should be placed in current | ||
| # empty space and repeat. | ||
| while end_positions[0] != current_empty: | ||
| start_positions = inverse_map(start) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this in a cycle N times is way too slow
| current_empty, start = move_car(start, position, current_empty) | ||
| yield start | ||
|
|
||
| def print_sequence(start, end): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is far more reasonable though
|
|
||
| class TestCarSequences(unittest.TestCase): | ||
| def test(self): | ||
| print_sequence([1, 2, 0, 3], [3, 1, 2, 0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the tests do more than print the output?
That said, it would be awesome if you could add some checks/asserts and merge Laida's test_0 onto them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we'd better use something like "yield_sequence" and then compare it's output with correct sequences somehow
Partial solution (without #3 and #4 optional problems) to assignment 6.