Implement some missing PHP exercises for #48in24

@tomasnorre You asked for suggestions to work on.

  • Circular Buffer: Required in 2 weeks. This is a common problem, and quite easy to do. The problem spec provides more than just test data, you need to interpret and respect that
  • Zebra Puzzle: Required in May. This is very easy on the test side, but hard for the example.php (possibly idiomatic solution, required for CI)
  • Spiral Matrix: Required in July. This looks easy on the test side, but may have hurdles for the example.php (possibly idiomatic solution, required for CI)

The following is missing, too, but I think it is not “easy enough” to start with. I have no idea how to implement that…

  • Parallel Letter Frequency: Required in 3 weeks. This is hard in any part, as PHP has no built-in support for real parallel processing. Just implementing it synchronously fails the purpose

@homersimpsons FYI

Edit: example.php is not seen as idomatic solution nor as something to refer / compare to.

For practice exercises, I see the example file not as the idiomatic exemplar, but as a proof that the exercise can be solved. Other maintainers may have a different perspective.

You may choose to forego the exercise in the track’s config.json.

I see it this way too :slight_smile:

A common rationale I’ve seen for making the CI example idiomatic is sometimes a student looks it up while looking for other solutions. That would indicate to me there aren’t enough community solutions yet so when porting exercises, I often publish my CI example polished up.

Just to confirm: the sole purpose of the example file is to verify that the exercise can be solved. Nothing more, nothing less. Maintainers are of course free to have the example be idiomatic, but it’s not required by any means.

Thanks. I’ll see if I can find the time to solve one of them. I cannot do the one needed in two weeks, that I know for sure, but perhaps the one in May.

@mk-mxp @ErikSchierboom @iHiD

I’ll soon have a first draft of the Zebra Exercise, should I go ahead and make a PR?

Questions/Updates

  1. Another question. Would it be OK, that I make a PR that adds .idea to .gitignore? Currently, I have to ensure manually that I don’t commit it by accident. I cannot do it globally (local) as I have projects where I need to commit it.

  2. Would it be ok, if we sort the config.json alphabetically? It would be easier to avoid merge conflicts.

I have pushed a PR, sorry for being impatient.

I have also pushed a PR draft for the Circular Buffer Exercise.

I’m currently in the flow, please don’t “hate” me.

2 Likes

Please, do so. I don’t see any problem with excluding common tooling files or temporary folders.

No, we can’t. The order in config.json is the order in which the exercises appear in the exercise list. One day we may order them by difficulty (or theme or paradigm), but for sure not alphabetically. And configlet also has its opinion about order.

I’ll create the PR for the .gitignore.

I thought the config.json was sorted by difficulties., but will not touch that now then.

Anything I can do to update this list automatically, with the newly added tracks?

I’ll continue with some of the exercises on the list, but cannot promise the pace of yesterday :)

You could probably tweak that to do difficulty then name

That page is dynamic and should be up-to-date. Are you missing data?

My bad, must have been some browser caching or so. Looks like it’s up to date.
Was missing the 3 exercises I added, but they are there now.

I have added a new Exercise PR for the Kindergarten Garden

And the Knapsack exercise

And the Secret Handshake

And Rotational Cipher

And the Two Bucket

And the Food Chain

And the ISBN Verifier

And the Sublist

And the Strain

And the House

1 Like