exercism / go

Exercism exercises in Go.
https://exercism.org/tracks/go
MIT License
975 stars 650 forks source link

for-loops: Port "Bird Watcher" exercise from JS or C# #1617

Closed ErikSchierboom closed 2 years ago

ErikSchierboom commented 2 years ago

This is part of our September Spring to get the Go Track in shape. Please read the Overview issue for more details. This exercise is claimed by @sachinmk27.


Before building this exercise, please read up on the documentation.

The goal of this exercise is to teach how to write a for loop, the different parts of the loop header, explain that there are no other loops in go than "for", break, continue, about should mention endless loops as pitfall

Copy/paste/modify the JS bird watcher exercise. This exercise will be teaching the for-loops concept.

The new exercise will have two prerequisites: numbers and conditionals-if.


https://github.com/exercism/go/issues/1380 can be closed once this is done.

sachinmk27 commented 2 years ago

I'd like to work on this

junedev commented 2 years ago

@sachinmk27 Thanks! I assigned you. I recommend you first check out the JavaScript exercise and also the for-loops concept in the JavaScript track (introduction and about). You can probably re-use a lot from there.

Note that this exercise/concept should NOT include range. This is covered in another exercise later in the concept tree.

jmrunkle commented 2 years ago

FYI: this is blocking #1565, so please comment on that issue once this is implemented.

ErikSchierboom commented 2 years ago

@sachinmk27 And let us know when you have any questions, we're here to help.

junedev commented 2 years ago

@sachinmk27 The increment and decrement operator was introduced as part of "arithmetic operators" concept in the exercise that teaches numbers. That means you dont need to introduce it here anymore.

ErikSchierboom commented 2 years ago

@sachinmk27 Just out of curiosity: how is the porting going?

sachinmk27 commented 2 years ago

Hi, have gone through the docs. Haven't been able to make time to implement it, hopefully should be done in the next couple of days. Is that okay?

ErikSchierboom commented 2 years ago

Yeah sure!

jmrunkle commented 2 years ago

@sachinmk27 - just checking in again since this is blocking one of my issues. As a note - it may be easier to work on if you break this down into a few smaller steps (rather than trying to do the full implementation at once). If the top level config.json has the status "wip" for this exercise it will not show up on the website (which can be useful for partial implementations). For example, you could check-in the initial file stubs without completing the whole exercise just to get the structure down and some of the initial metadata. Another way is to start is to leverage a draft PR so that you can start getting some initial feedback and suggestions if you are having any trouble getting it setup. Cheers!

sachinmk27 commented 2 years ago

@jmrunkle Thank you. Will do it now.

sachinmk27 commented 2 years ago

@jmrunkle @ErikSchierboom @junedev I am sorry about the delay caused. Kindly review the draft PR.

junedev commented 2 years ago

1775 contains the work that was already done (80%). We need someone to finish this up.

Lewiscowles1986 commented 2 years ago

Just a note on this. The third challenge text seems like incorrect or misleading English.

You figured out that this bird always spent every second day in your garden.

But in the example and tests, then the first day (offset 0) and then each odd day is expected to increment.

I would expect that the second day, would be odd days, not even in array-land, because of the zero offset.

birdsPerDay := []int{2, 5, 0, 7, 4, 1}
FixBirdCountLog(birdsPerDay)
// => [3 5 1 7 5 1]

I think should be

birdsPerDay := []int{2, 5, 0, 7, 4, 1}
FixBirdCountLog(birdsPerDay)
// => [2 6 0 8 4 2]

Although the text could likewise be altered to keep the challenge.

You figured out that this bird returned to your garden every other day, starting with the first.

This would allow dropping:

Your bird watcher intuition also tells you that the bird was in your garden on the first day that you tracked in your list.

junedev commented 2 years ago

@Lewiscowles1986 Can you provide a PR with the new text you suggested?

Lewiscowles1986 commented 2 years ago

Sure if you think it will benefit. Mostly I wanted to 🦆 check this to see if it was reasonable.