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

[WIP] Implement hangaman excercise #905

Closed

Conversation

vaibhavsingh97
Copy link

Fixes: #745

@vaibhavsingh97
Copy link
Author

@m-a-ge I don't know much about writing test. Can you please guide me 😅

Copy link
Contributor

@ilya-khadykin ilya-khadykin left a comment

Choose a reason for hiding this comment

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

I've left some comments for you to consider

class HangmanTest(unittest.TestCase):
def test(self):
self.assertEqual("hangman", "hangman")

Copy link
Contributor

Choose a reason for hiding this comment

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

More tests should be added

Copy link
Contributor

Choose a reason for hiding this comment

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

@vaibhavsingh97, I would suggest basing the tests on the ones from the C# track since they have fairly good test coverage.



def main():
while True:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this infinite loop

Copy link
Author

Choose a reason for hiding this comment

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

@m-a-ge This loop is only if player wan't to play again

@@ -0,0 +1 @@
# Hangman
Copy link
Contributor

Choose a reason for hiding this comment

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

@ilya-khadykin
Copy link
Contributor

ilya-khadykin commented Oct 15, 2017

@vaibhavsingh97, it's a best practice to write tests before working on an actual implementation. It gives an opportunity to analyze the problem better, find edge cases etc.
We use unittest for writing tests, docs can be found here - https://docs.python.org/3/library/unittest.html
You can also take a look at tests from different exercises as examples.

You can also adopt tests from other tracks

@N-Parsons
Copy link
Contributor

@vaibhavsingh97

The problem-specifications//description.md suggests that this should be a functional reactive programming (FRP) exercise using an external library. Such libraries seem to exist for Python, but I know nothing about them and I don't really understand what FRP really is. Unless you know what this is and can explain and implement it, I'm going to suggest that we just modify the exercise to use a more traditional paradigm. @m-a-ge, what are your thoughts on this?

Your current implementation is going to be really hard to write tests for, because it relies on user interaction, which can't be automated through unittest (as far as I know). A better approach might be to implement a Hangman class with methods for setting/picking a word and guessing letters, and write the tests based on this approach. It might be a cool extension to include something in the README about getting people to use their new class to write an interactive game as you've done - we can't test it, but people might find it quite fun.

It would be good to put whatever new description (based loosely on the problem-specifications description) into a .meta/description.md file in this exercise folder so that your new description is persistent when the configlet is used to regenerate the READMEs.

@ilya-khadykin
Copy link
Contributor

Personally, I'm in favor of adding a new exercise even if it contradicts problem-specification in some minor way.
It'll allow users to work on it, and we can always rewrite the example solutions to meet certain standards later (when we have time) by putting it to our backlog.
Such exercises shouldn't be included to core exercises though

@N-Parsons what do you think of such approach to the problems likes these?

@vaibhavsingh97
Copy link
Author

@m-a-ge What should I do know?

@ilya-khadykin
Copy link
Contributor

@vaibhavsingh97 we need more tests to be added

@N-Parsons
Copy link
Contributor

@m-a-ge, sounds good to me.

@cmccandless
Copy link
Contributor

@vaibhavsingh97 are you still working on this?

@vaibhavsingh97
Copy link
Author

Yes, I forgot now will update PR

@stale
Copy link

stale bot commented Nov 25, 2017

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the abandoned label Nov 25, 2017
@stale stale bot closed this Dec 2, 2017
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.

4 participants