Just like I participate in a couple of Christmas events (one for math, one for code), this year I participated in an #Easter event (called easters.dev), primarily for #code. And as a reward for completing the #challenge I got these 3 happy eggs:

It took some time, but I’ve essentially solved all 3 x 2 puzzles without outside help. There wasn’t a helpful forum, and I didn’t just want to publish my code and ask for a review. (A lot of places on the leaderboard haven’t been taken yet.)
These are some of my experiences.
On Friday and Saturday, within a reasonable time I got a program solving 1st test case, 1st actual case and 2nd test case and then got stuck. Trying to figure out where the error is is hard!
Sunday I just ran through!
10101
1.G...
0..O..
1.O...
0G...O
1...G.
Above are the test data for Sunday.
The numbers on top and on the left describe the columns and rows. Like, the 1st 1 says, there will be 1 example of (item) in this column. Part of the puzzle is to place items, so that all the numbers are correct. I’ve seen a lot of games do something similar, like Picross. So I basically tried to solve it like that. I copied the map into a spreadsheet, so that the numbers could automatically be calculated and compared to expectations, and then I solved it by hand.
Some cells are very easy to fill. A number is 0? Go across and mark all the undecided cells as empty. Some you have to work a little harder for.
***
Next I came back to Saturday. I will spare you the debugging details.
123
456
123
789
Above we have some of the test data. This says, if the program (3rd block of digits) contains the target (1st block of numbers), substitute in the replacement (2nd block of numbers). So, in this simple case, 123 would be replaced with 456 in the program.
It’s much more complicated than that, and a lot of stuff has to be checked before a replacement goes through, and the replacement itself might also be complicated.
In writing my code, some of it was: Will there be a replacement? And then a handful of cases, where the answer was no. What I learned from this puzzle was: Create test data for each of these cases.
***
Finally I came back to Friday. It didn’t seem like I could transfer my new coding practice to this puzzle.
In this puzzle strings are translated into other strings. Like, I have to translate “cuzb” into “awa”. There are rules for which translations are possible and how much they cost, and the goal is to find the lowest accumulated cost.
Again, after a lot of tedious debugging, I was halfway there. I had found a case, where my handmade translation was cheaper than the one my program found. But I didn’t know the reason yet.
By the way, creating a handmade translation involved analyzing the rules. The rules were represented by a map, and it was fun to play around with the map and see, that the structure shown was actually something like 8 structures smooshed together, so that they just looked like 1.
So. I fiddled around with my case. At some point I realized, that my handmade translation was much better at handling the final few characters in the string. Fiddle, flail, fiddle. And suddenly I was staring at 5 lines of code, that seemed wrong.
The task is to translate “weeds” (“cuzb”) into a nice pattern of “plants” (“awa”). (Yes, that’s a nice pattern.) I handle this recursively. Given that I want to go from “cuzb” to “awa”, and with a choice of beginning with 1 of 3 different actions, let’s just try all 3!
- I can translate “cuzb” into “acuzb” (as a middle step) by introducing a new plant “a” + translating “cuzb” into “wa”.
- I might be able to transform “c” into “a” + translating “uzb” into “wa”.
- Or I can get rid of “c” + try to translate “uzb” into “awa”.
And then I just repeat for these shorter strings. When I know enough, I can choose the cheapest. Recursion, baby. (Actually fastest.)
So now for my 5 lines of weird code.
If I have 0 weeds and 0 pattern left, I am done. Fine.
If I have some weeds and 0 pattern left, well, my first thought was, that I would be stuck, ending in an impossible situation. But I suddenly realized, that was false. Of course I could handle this situation, by getting rid of the rest of the weeds.
And suddenly my program ran correctly!
***
That was fun. And apparently I have a position on the leaderboard as #3 and can’t be dislodged.

***
Link: easters.dev.
![]()