exercism / crystal

Exercism exercises in Crystal.
https://exercism.org/tracks/crystal
MIT License
75 stars 52 forks source link

[New Practice Exercise]: Zebra Puzzle #586

Closed meatball133 closed 6 months ago

meatball133 commented 10 months ago

For #48in24, the Crystal track missing a few exercises, we would appreciate contributors to help out with implementing exercises.

✅ Getting started

Before you start, write a message in this issue that you like to claim the issue.

Docs

This doc do you have to read first, if you are a first-time contributor:

How to use the Crystal track generator General information about how to implement practice exercise

Here are some documents that might be useful (not mandatory to read):

Contributing to Exercism | Exercism and GitHub | - Contributor Pull Request Guide What are those Weird Task Tags about? Exercism Formatting and Style Guide Exercism Markdown Specification Reputation

Start

Fetch configlet by:

bin/fetch-configlet

Then

bin/configlet create --practice-exercise zebra-puzzle

Read problem spec canonical data, then look at already written test_template.ecr, which can be found under most practice exercises .meta folder.

Then write a template, to test if the template works you can just (this requires Crystal to be installed):

bin/generator.sh zebra-puzzle

After that should the spec file be updated if not an error should have been raised which may or may not have to be solved. Then you just write a solution and put that in .meta/src/example.cr, then make a stub file in src/<exercise_name>. Then in config.json of the exercise add your GitHub username and you just push and your pr is ready for review.

Got stuck?

No problem, we are here to help, just drop a comment in the issue with what you need help with.

ryanplusplus commented 10 months ago

@meatball133 do you have any ideas for what this would look like in Crystal? I looked at the canonical data and description of this a few months back and couldn't figure out how it would map to an exercise and I've also never run into this problem on another track.

meatball133 commented 10 months ago

As for the basic implementation, I am thinking of just 2 tests upp right from the canonical data, like the python's test file: https://github.com/exercism/python/blob/main/exercises/practice/zebra-puzzle/zebra_puzzle_test.py .

And then either a more functional approach like the pythons track solution, with 2 functions one for drink_water and one for owns_water. Another approach is using a more object oriented approach, like the javascript one: https://github.com/exercism/javascript/blob/main/exercises/practice/zebra-puzzle/zebra-puzzle.js

I am open for both of these approaches

ryanplusplus commented 10 months ago

So there's no test input and the expectation is that the student will encode the problem statement as part of their solution?

meatball133 commented 10 months ago

By looking at how other languages have implemented the problem so would I say yes.

kahgoh commented 6 months ago

I'd be happy to work on this one.