-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor exercise word-search #420
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
Conversation
pheanex
commented
Mar 1, 2017
- rewrite tests so that users have more freedom of implementation
- update example-implementation to fit test-interface
- reduce skeleton to minimal as discussed in Skeleton files should be included in all problems to make it easier #272
e66b447
to
e6010e9
Compare
exercises/word-search/example.py
Outdated
def find_stop(row, column, word, puzzle): | ||
directions = [(0, 1), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 0), (-1, 1), (-1, -1)] | ||
for d in directions: | ||
row_nr, column_nr = row, column |
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.
Does nr
refer to number? If so, why not make this explicit with row_number
and column_number
?
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.
yes it refers to number, i always try to find the sweet spot between overview/compactness and expressiveness ;-). I'll just update it if you think the gain in expressiveness is worth the loss in compactness and brevity. I'll also then change "char" into "character"
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.
It's a small nitpick and it's entirely up to you. I was confused by the _nr
and I'm only pointing it out in the hope that others can avoid similar confusion.
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.
okay then it absolutely makes sense to change it, thank you for the feedback/review.
* rewrite tests so that users have more freedom of implementation * update example-implementation to fit test-interface * reduce skeleton to minimal as discussed in exercism#272
e6010e9
to
b001abc
Compare
'jalaycalmp\n' | ||
'clojurermt') | ||
self.example = WordSearch(puzzle) | ||
puzzle = ['jefblpepre', |
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.
self.example.search('clojure'), | ||
(Point(0, 9), Point(6, 9)) | ||
) | ||
self.assertEqual(search(WordSearchTests.puzzle, 'clojure'), ((9, 0), (9, 6))) |
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.
Why did you reverse the x, y
order? Normally coordinate systems (wiki) use (X, Y)
notation if I'm not mistaken.
Is there any way we can get a third reviewer? @behrtam any suggestions? |
Maybe @rootulp has some time to look at it again. (Or do you want a fourth?) |
I thought i did explain my motivation (see above). If there is still something that you think i should motivate further, please specify. |
I appreciate the effort you have put into improving this exercise from a heavy class based exercise into a lighter flexible function based exercise and hope my maybe annoying questions about some details have not discouraged you. You switched |
No problem. |
So, the canonical test data is on it's way: exercism/problem-specifications#755 |
Maybe we could show off >>> from collections import namedtuple
>>> Cell = namedtuple('Cell', ['row', 'column'])
>>> start = Cell(2, 2)
>>> end = Cell(row=2, column=12) |
I guess with canonical test data we can close this |
* Create common working area * Extract Concepts from v2 exercise: reverse-string (exercism#657) * Create reverse-string.md * Update reverse-string.md * Add Concepts from v2 exercise: variable-length-quantity (exercism#503) * Add first concepts group * Improved concepts as per PR review * Adds concept from binary-search-tree (exercism#501) * Add initial list (exercism#463) First pass concepts for `allergies` to address exercism#460 * Initial list of concepts (exercism#462) First pass list of concepts to address exercism#459 * Add Concepts for v2 exercise: phone-number (exercism#420) * Add phone-number Python concepts * Small update to index access and slice topics. * Add notes from review. - more information about classes, inheritance - flesh out privacy, public and non-public - clarify wording around iterables and index/slice access * One more note about brackets and strings. * Add Concepts for v2 exercise: hamming (exercism#418) * Add concepts for hamming * Add note about tuple unpacking. * Add notes about polymorphism, builtins, and dunder methods. * Some whitespace fixes. * [WIP] `clock` exercise concepts. (exercism#395) * Extract Concepts from v2 exercise: markdown (exercism#540) * Initial commit for markdown exercise concepts. * Concept starter for markdown * Added detail to Markdown concepts * Final edits before harmonization Final Markdown edits before we merge and harmonize. * Add Concepts for v2 exercise: matrix (exercism#416) * `matrix` exercise concepts (issue exercism#386) First pass of concepts for `matrix ` exercise in python. Pretty sure this is too detailed, but wanted to get something for review before proceeding with additional exercises. * Edits to better match exercism#290 Formatting Edited concepts to better match the formatting of issue exercism#290 * Typo correction * added title * Extract Concepts from v2 exercise: rna-transcription (exercism#520) * Beginning of Concepts for rna-transcription * More detailed concepts for rna-trranscription More detailed concepts for rna-transcription exrcise. * Added title * Extract Concepts from v2 exercise: robot-simulator (exercism#538) * Beginning of concepts for robot-simulator. * WIP Concepts * Additional detail for concepts * Detail third pass Third pass on adding concept detail. * Additional detail for concepts. * Edits per PR Feedback Numerous spelling corrections. Additional edits to address comments from last review. * [WIP] Concept implementation instructions (exercism#665) * Adds instructions for exercise implementation * Adds correction as per PR reviews * Harmonize, part 1 (exercism#705) * fix relative links in references/README.md * First pass at harmonization Shifts all documents to a common format, adds minimal link tagging to the "concept" currently listed in each file. These will really need multiple more passes, as they diverge from each other even when describing the same topic. Many extraneous topics have crept in, added in an "aspirational" fashion to the exercises; we may need to trim some of that. * Pulling in examples from BethanyG * [WIP] Extracted concept unification (exercism#793) * Unification of extracted concepts * Typos and duplicates remove * Duplicates concept unification * Concepts have now links to original file * Update languages/reference/README.md Co-Authored-By: Erik Schierboom <erik_schierboom@hotmail.com> Co-authored-by: khoivan88 <33493502+khoivan88@users.noreply.github.com> Co-authored-by: David G <davidgerva@gmail.com> Co-authored-by: Ashley Drake <a.l.drake713@gmail.com> Co-authored-by: Pedro Romano <pedro@paparomeo.net> Co-authored-by: BethanyG <BethanyG@users.noreply.github.com> Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
* Create common working area * Extract Concepts from v2 exercise: reverse-string (exercism#657) * Create reverse-string.md * Update reverse-string.md * Add Concepts from v2 exercise: variable-length-quantity (exercism#503) * Add first concepts group * Improved concepts as per PR review * Adds concept from binary-search-tree (exercism#501) * Add initial list (exercism#463) First pass concepts for `allergies` to address exercism#460 * Initial list of concepts (exercism#462) First pass list of concepts to address exercism#459 * Add Concepts for v2 exercise: phone-number (exercism#420) * Add phone-number Python concepts * Small update to index access and slice topics. * Add notes from review. - more information about classes, inheritance - flesh out privacy, public and non-public - clarify wording around iterables and index/slice access * One more note about brackets and strings. * Add Concepts for v2 exercise: hamming (exercism#418) * Add concepts for hamming * Add note about tuple unpacking. * Add notes about polymorphism, builtins, and dunder methods. * Some whitespace fixes. * [WIP] `clock` exercise concepts. (exercism#395) * Extract Concepts from v2 exercise: markdown (exercism#540) * Initial commit for markdown exercise concepts. * Concept starter for markdown * Added detail to Markdown concepts * Final edits before harmonization Final Markdown edits before we merge and harmonize. * Add Concepts for v2 exercise: matrix (exercism#416) * `matrix` exercise concepts (issue exercism#386) First pass of concepts for `matrix ` exercise in python. Pretty sure this is too detailed, but wanted to get something for review before proceeding with additional exercises. * Edits to better match exercism#290 Formatting Edited concepts to better match the formatting of issue exercism#290 * Typo correction * added title * Extract Concepts from v2 exercise: rna-transcription (exercism#520) * Beginning of Concepts for rna-transcription * More detailed concepts for rna-trranscription More detailed concepts for rna-transcription exrcise. * Added title * Extract Concepts from v2 exercise: robot-simulator (exercism#538) * Beginning of concepts for robot-simulator. * WIP Concepts * Additional detail for concepts * Detail third pass Third pass on adding concept detail. * Additional detail for concepts. * Edits per PR Feedback Numerous spelling corrections. Additional edits to address comments from last review. * [WIP] Concept implementation instructions (exercism#665) * Adds instructions for exercise implementation * Adds correction as per PR reviews * Harmonize, part 1 (exercism#705) * fix relative links in references/README.md * First pass at harmonization Shifts all documents to a common format, adds minimal link tagging to the "concept" currently listed in each file. These will really need multiple more passes, as they diverge from each other even when describing the same topic. Many extraneous topics have crept in, added in an "aspirational" fashion to the exercises; we may need to trim some of that. * Pulling in examples from BethanyG * [WIP] Extracted concept unification (exercism#793) * Unification of extracted concepts * Typos and duplicates remove * Duplicates concept unification * Concepts have now links to original file * Update languages/reference/README.md Co-Authored-By: Erik Schierboom <erik_schierboom@hotmail.com> Co-authored-by: khoivan88 <33493502+khoivan88@users.noreply.github.com> Co-authored-by: David G <davidgerva@gmail.com> Co-authored-by: Ashley Drake <a.l.drake713@gmail.com> Co-authored-by: Pedro Romano <pedro@paparomeo.net> Co-authored-by: BethanyG <BethanyG@users.noreply.github.com> Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
* Create common working area * Extract Concepts from v2 exercise: reverse-string (exercism#657) * Create reverse-string.md * Update reverse-string.md * Add Concepts from v2 exercise: variable-length-quantity (exercism#503) * Add first concepts group * Improved concepts as per PR review * Adds concept from binary-search-tree (exercism#501) * Add initial list (exercism#463) First pass concepts for `allergies` to address exercism#460 * Initial list of concepts (exercism#462) First pass list of concepts to address exercism#459 * Add Concepts for v2 exercise: phone-number (exercism#420) * Add phone-number Python concepts * Small update to index access and slice topics. * Add notes from review. - more information about classes, inheritance - flesh out privacy, public and non-public - clarify wording around iterables and index/slice access * One more note about brackets and strings. * Add Concepts for v2 exercise: hamming (exercism#418) * Add concepts for hamming * Add note about tuple unpacking. * Add notes about polymorphism, builtins, and dunder methods. * Some whitespace fixes. * [WIP] `clock` exercise concepts. (exercism#395) * Extract Concepts from v2 exercise: markdown (exercism#540) * Initial commit for markdown exercise concepts. * Concept starter for markdown * Added detail to Markdown concepts * Final edits before harmonization Final Markdown edits before we merge and harmonize. * Add Concepts for v2 exercise: matrix (exercism#416) * `matrix` exercise concepts (issue exercism#386) First pass of concepts for `matrix ` exercise in python. Pretty sure this is too detailed, but wanted to get something for review before proceeding with additional exercises. * Edits to better match exercism#290 Formatting Edited concepts to better match the formatting of issue exercism#290 * Typo correction * added title * Extract Concepts from v2 exercise: rna-transcription (exercism#520) * Beginning of Concepts for rna-transcription * More detailed concepts for rna-trranscription More detailed concepts for rna-transcription exrcise. * Added title * Extract Concepts from v2 exercise: robot-simulator (exercism#538) * Beginning of concepts for robot-simulator. * WIP Concepts * Additional detail for concepts * Detail third pass Third pass on adding concept detail. * Additional detail for concepts. * Edits per PR Feedback Numerous spelling corrections. Additional edits to address comments from last review. * [WIP] Concept implementation instructions (exercism#665) * Adds instructions for exercise implementation * Adds correction as per PR reviews * Harmonize, part 1 (exercism#705) * fix relative links in references/README.md * First pass at harmonization Shifts all documents to a common format, adds minimal link tagging to the "concept" currently listed in each file. These will really need multiple more passes, as they diverge from each other even when describing the same topic. Many extraneous topics have crept in, added in an "aspirational" fashion to the exercises; we may need to trim some of that. * Pulling in examples from BethanyG * [WIP] Extracted concept unification (exercism#793) * Unification of extracted concepts * Typos and duplicates remove * Duplicates concept unification * Concepts have now links to original file * Update languages/reference/README.md Co-Authored-By: Erik Schierboom <erik_schierboom@hotmail.com> Co-authored-by: khoivan88 <33493502+khoivan88@users.noreply.github.com> Co-authored-by: David G <davidgerva@gmail.com> Co-authored-by: Ashley Drake <a.l.drake713@gmail.com> Co-authored-by: Pedro Romano <pedro@paparomeo.net> Co-authored-by: BethanyG <BethanyG@users.noreply.github.com> Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
* Create common working area * Extract Concepts from v2 exercise: reverse-string (exercism#657) * Create reverse-string.md * Update reverse-string.md * Add Concepts from v2 exercise: variable-length-quantity (exercism#503) * Add first concepts group * Improved concepts as per PR review * Adds concept from binary-search-tree (exercism#501) * Add initial list (exercism#463) First pass concepts for `allergies` to address exercism#460 * Initial list of concepts (exercism#462) First pass list of concepts to address exercism#459 * Add Concepts for v2 exercise: phone-number (exercism#420) * Add phone-number Python concepts * Small update to index access and slice topics. * Add notes from review. - more information about classes, inheritance - flesh out privacy, public and non-public - clarify wording around iterables and index/slice access * One more note about brackets and strings. * Add Concepts for v2 exercise: hamming (exercism#418) * Add concepts for hamming * Add note about tuple unpacking. * Add notes about polymorphism, builtins, and dunder methods. * Some whitespace fixes. * [WIP] `clock` exercise concepts. (exercism#395) * Extract Concepts from v2 exercise: markdown (exercism#540) * Initial commit for markdown exercise concepts. * Concept starter for markdown * Added detail to Markdown concepts * Final edits before harmonization Final Markdown edits before we merge and harmonize. * Add Concepts for v2 exercise: matrix (exercism#416) * `matrix` exercise concepts (issue exercism#386) First pass of concepts for `matrix ` exercise in python. Pretty sure this is too detailed, but wanted to get something for review before proceeding with additional exercises. * Edits to better match exercism#290 Formatting Edited concepts to better match the formatting of issue exercism#290 * Typo correction * added title * Extract Concepts from v2 exercise: rna-transcription (exercism#520) * Beginning of Concepts for rna-transcription * More detailed concepts for rna-trranscription More detailed concepts for rna-transcription exrcise. * Added title * Extract Concepts from v2 exercise: robot-simulator (exercism#538) * Beginning of concepts for robot-simulator. * WIP Concepts * Additional detail for concepts * Detail third pass Third pass on adding concept detail. * Additional detail for concepts. * Edits per PR Feedback Numerous spelling corrections. Additional edits to address comments from last review. * [WIP] Concept implementation instructions (exercism#665) * Adds instructions for exercise implementation * Adds correction as per PR reviews * Harmonize, part 1 (exercism#705) * fix relative links in references/README.md * First pass at harmonization Shifts all documents to a common format, adds minimal link tagging to the "concept" currently listed in each file. These will really need multiple more passes, as they diverge from each other even when describing the same topic. Many extraneous topics have crept in, added in an "aspirational" fashion to the exercises; we may need to trim some of that. * Pulling in examples from BethanyG * [WIP] Extracted concept unification (exercism#793) * Unification of extracted concepts * Typos and duplicates remove * Duplicates concept unification * Concepts have now links to original file * Update languages/reference/README.md Co-Authored-By: Erik Schierboom <erik_schierboom@hotmail.com> Co-authored-by: khoivan88 <33493502+khoivan88@users.noreply.github.com> Co-authored-by: David G <davidgerva@gmail.com> Co-authored-by: Ashley Drake <a.l.drake713@gmail.com> Co-authored-by: Pedro Romano <pedro@paparomeo.net> Co-authored-by: BethanyG <BethanyG@users.noreply.github.com> Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>