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

minesweeper: add to track #174

Merged
merged 1 commit into from
Nov 21, 2016
Merged

minesweeper: add to track #174

merged 1 commit into from
Nov 21, 2016

Conversation

stkent
Copy link
Contributor

@stkent stkent commented Nov 12, 2016

Data from https://github.com/exercism/x-common/blob/master/exercises/minesweeper/canonical-data.json, plus some extra tests to validate input.

The long annotate method is kind of ugly, so I'm happy to refactor to non-static methods to make it easier to break apart. Input welcome :)

@stkent stkent changed the title dibs: I will implement exercise minesweeper minesweeper: add to track Nov 15, 2016
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stkent this is really the only part of this method that makes me wish for refactoring. I find myself wondering if there's not some way to grab the entire subset of characters concerned and reduce them to a number without nested for loops and ifs.

Otherwise this PR is generally very nice work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @matthewmorgan! I'll think about a neater implementation for that heavily-nested portion of the code, and probably switch to an object-based implementation per discussion in #177.

@stkent
Copy link
Contributor Author

stkent commented Nov 21, 2016

@matthewmorgan updated this implementation; I don't see a neat way around manually looping to check the cells surrounding a target, but I've at least broken the calculation of the annotated board down into smaller chunks now.

@matthewmorgan matthewmorgan merged commit afc3bd2 into exercism:master Nov 21, 2016
@matthewmorgan
Copy link
Contributor

@stkent, fair enough. I asked because we did this exercise over a code kata lunch at work a few weeks back, and the nested loops always provoke discussion!

If I think of anything myself I'll be sure to share it with you.

@stkent stkent deleted the minesweeper branch November 26, 2016 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants