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

New exercise: Tower of Hanoi #1270

Closed
udhos opened this issue Aug 23, 2019 · 8 comments
Closed

New exercise: Tower of Hanoi #1270

udhos opened this issue Aug 23, 2019 · 8 comments
Labels
paused Work paused until further notice

Comments

@udhos
Copy link

udhos commented Aug 23, 2019

I would like to contribute an additional exercise for the Go track.

Exercise Tower of Hanoi is sketched here:

https://github.com/udhos/exercism-go/tree/master/tower-of-hanoi

If you think it would fit in, please let me know how to contribute it.

Thanks!

@leenipper
Copy link
Contributor

Hello @udhos . Thanks for the interest in adding an exercise. And you have a good start on it for the Go track of exercism!

The Tower of Hanoi is a classic programming problem and I think it is worth consideration in Exercism for all language tracks.

New generic exercises enter first via the problem specifications repo. See this helpful document for implementing a new exercise. Refer to this general guide on Contributing, particularly the section on Implementing a Completely New Exercise.

In the referenced documents, you see the term "slug", which is just the name of the exercise. In this case, the name would be all lower case, tower-of-hanoi. That sets the name of the new directory in the problem-specifications. Follow the structure of another exercise in problem-specifications to use as an example, such as reverse-string. So, it's just a new directory within exercises, such as tower-of-hanoi, and three standard named files within that directory: canonical-data.json, description.md, and metadata.yml. The canonical-data.json, defines test cases primarily. For tower-of-hanoi, the "property" for each test case is likely just "solve". And the "input" property would perhaps follow what you have in your readme, with nested items such as "disks", "source", "helper", and "target" disk names. Use your wikipedia.org link as the "source_url" in the metadata.yml.

I suggest cloning problem specifications repo and submitting an issue and/or PR there first to get things rolling. It's best if new exercise PR in problem-specifications is merged first, since there may be changes which impact the language track exercises implemented.

Feel free to ask questions here, and have fun!

@udhos
Copy link
Author

udhos commented Aug 26, 2019

Hi @leenipper.

I initially considered to submit the problem for all tracks. However, this issue led me to believe the specification repo is frozen for new exercises:

exercism/problem-specifications#1560

That's why I sketched Tower of Hanoi only for the Go track.

What do you think?

@leenipper
Copy link
Contributor

Oops. Ok, I wasn't aware of the temporary closure to new exercises.

I think it is worth considering to add tower-of-hanoi as a Go track specific exercise.
@bitfield, what do you think ?

@bitfield
Copy link
Contributor

I wasn't aware of that either. Yes, I'm absolutely in favour of adding this to the Go track. Happy to help work on the PR too, by all means add me as a reviewer. Thanks @udhos for suggesting this.

@udhos
Copy link
Author

udhos commented Aug 28, 2019

I clearly don't know what I am doing, so please let me know how to improve the PR. 😅

@leenipper
Copy link
Contributor

@udhos, That's completely understandable, and I hope a few pointers are helpful.

Refer to this section since this is the custom case (Go language track only). You need a .meta subdirectory, with the two files named description.md and metadata.yml. The description is short, and likely is from the first part of your README.md. The metadata.yml is a 4 line file; follow this sample and use applicable values.

The README.md is actually generated using a tool called configlet.
I think these two commands are correct for tower-of-hanoi as you have it now:

   ./bin/fetch-configlet
   ./bin/configlet generate $PWD --only tower-of-hanoi

If the README.md isn't generated to your liking, you can put a hints.md inside the .meta directory, and it's content will also be placed into the README.md. We have several instances of hints.md in the Go track exercises. You can also adjust your description.md and metadata.yml as needed.

You do need a commit for config.json to add it's entry, such as the lines below. The travis-ci build won't succeed until there is a config.json entry, or "slug" as it's called. In the sample entry below, I got the uuid value from here for future reference; it's just a unique id. If you think the difficulty level is higher than 2, feel free to use a higher value. This isn't a "core" exercise, so "core" is false. And it's an exercise that is available without needing to be "unlocked_by" another exercise completion; unless you think a certain exercise applies as a good precursor. You can pick other applicable topics values; I simply put "algorithms" for starters. The PR will get this reviewed, so use an entry that is your best idea, and we go from there.

    {
      "slug": "tower-of-hanoi",
      "uuid": "ae946961-3929-4f79-8e22-1e65c983e57b",
      "core": false,
      "unlocked_by": null,
      "difficulty": 2,
      "topics": [
        "algorithms"
      ]
    },

Thanks for taking this on @udhos !

@udhos
Copy link
Author

udhos commented Aug 29, 2019

@leenipper Thank you a lot for the directions!

I have submitted commits for the config.json slug and the generated README.md.

@junedev
Copy link
Member

junedev commented Oct 23, 2021

Status for this: The merge request #1272 is mostly done and could be re-opened but it needs to be updated so it conforms to the latest specifications https://exercism.org/docs/building/tracks/practice-exercises.

@junedev junedev added the paused Work paused until further notice label Dec 10, 2022
@junedev junedev closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paused Work paused until further notice
Projects
None yet
Development

No branches or pull requests

4 participants