New exercise suggestion: Pop Count

The instructions read,

Keep your hands off that bit-count functionality provided by your standard library!

There are several methods, that make this an easy one-liner. That’s why I wanted to drive the point a bit further.

We still need an icon.

True. CC @ihid

I’ve tried to create an instructional graphic:

coop-example-1-min

I could use some help converting the scalable PDF to SVG as all the converters I’ve tried are breaking the eggs.

Thanks !

Maybe this will fare better if the egg is more of a cartoon style? Just a black oval shape outline and white inside similar to this: Egg icon PNG and SVG Vector Free Download ?

Thanks @glaxxie :

coop-example-1-min

1 Like

I like the art style. If we use an image, we should supply a good alt-text. I have no idea how the current “ascii art” fares with screen readers. Are there people here who can comment on that?

The exercise icons are 160x160 svg.

Here’s an example by a non-artist:

As for serving alt text with exercise icons, I think that would be a website change proposal, affecting all exercises. Perhaps start a separate forum thread.

I had some minor confusion related to this.
I’m plodding through WASM for November and saw I need to solve “pop-count” to get the badge but didn’t see that exercise listed. Discovered this thread and see the exercise has the new name “Eliud’s Eggs” while the pop-up text when I hover over the badge reads “Solve pop-count in …”. Same goes for the descriptive text in the Nibbly November post published at The #12in23 Challenge - still refers to Pop Count and not the new name.

Are any of the November Nibbly Bits tracks using the old exercise title? Those might need to be updated as well.

All three assembly tracks use the new “Eliud’s Eggs” title in the Exercise listing. Under the hood the all three store the exercise in a \pop-count directory.

Looks like this is hard-coded in the website and needs to be updated separately from the tracks.

Thanks for finding that, @sanderploegsma.

I created a PR to update to the new name, paging @ErikSchierboom or @iHiD to take a look at it - Update 12in23.html.haml - Eliud's Eggs recommended exercise for Nibbl… by pdmoore · Pull Request #6578 · exercism/website · GitHub

Please can someone re-open my PR ?
Thanks.

Added 4 SVG images #2501 ( github.com )

I reopened it.

1 Like

Hi, and thank you for the eliuds-eggs exercise!

I am not a programmer. I teach a topic unrelated to programming.

On the Racket track, the eggs exercise seems to me somewhat strangely explained. I found the explanation confusing.

The explanation is in two parts: The first one is related to something that could happen in real life: counting eggs in a farm. The explanation uses nice representations such eggs in a track, with some free spots.

The second part explain the actual task in the exercise: you’re given a number and must return the number of ones in this number.

So, the exercise really is about converting a decimal number into a binary number and then counting the number of ones.

Where are the eggs gone? Where is the initial problem of counting eggs? What is a decimal number (before conversion into a binary one) in real life, on a farm?

My feeling is that more of the farm problem should go into the exercise. Or we should get rid of the egg part and keep only the raw problem of converting decimal to binary.

What is more, the farm problem is the reverse of the actual problem to solve: On the farm you go from counting the existing and missing eggs into converting that to binary and converting that binary into a decimal number, for no obvious reason. As said, the decimal number has no reality in farm life. Why would a display show “89” for 4 eggs?

1 Like

Her granny was an inventor and had a tendency to build things in an overly complicated manner.

An electrical sensor was installed for each position an egg could be picked up. Each sensor reports a high voltage (or 1) if an egg is present, and otherwise a low voltage (or 0).

Eliud’s granny’s junk box had contained a digital display. The manufacturer’s data sheet for the display specified the input pins: the 1’s bit, the 2’s bit, and so on.

Granny recognised a very different way to use the display. She directly wired an electrical sensor to each of the display’s input pins.

@Marcelli After reading the story, I have to agree with you. It feels disconnected from what the exercise actually requires. You start with a number of eggs in the coop, then in step 2, you’re suddenly assuming the layout represents a binary number, converting it to decimal, displaying it, and then counting the number of bits in that decimal, which means you now have to convert to binary again. This last step in only mentioned in the instructions. It’s just an unnecessarily complicated story, which naturally makes it confusing.

There’s no need for an easy exercise to have such a convoluted story, IMO.

1 Like

The introduction introduces and provides background for the student in a way that can be understood by the general public. Therefore, we should keep an introduction but not necessarily the one as currently written. I think the next step is to propose revisions to the introduction, likely in a separate focused thread.