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

Make next (obj) to remove code duplication #2

Closed
Innoviox opened this issue Jan 31, 2018 · 1 comment
Closed

Make next (obj) to remove code duplication #2

Innoviox opened this issue Jan 31, 2018 · 1 comment
Assignees

Comments

@Innoviox
Copy link
Owner

Currently Square.next and Tile.next are implemented the same. I propose a global next method, like so:

def next(obj):
if obj is a square or tile:
{default next implementation}
raise type error

Alternatively, a class "positionable" with a next method that both square and tile inherit from, but this seems a little weird.

@Innoviox Innoviox self-assigned this Jan 31, 2018
@Innoviox
Copy link
Owner Author

Was fixed using the above implementation, but hasattr instead of isinstance. Also makes it easier to implement board attr checking later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant