[Community Puzzle] Tiny Forest

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @AdrienLB,validated by @Timinator,@lllllllllllllllllll1 and @FredericLocquet.
If you have any issues, feel free to ping them.

Hi there,

I just finished this tiny forest puzzle, and my first impression is that there are missing test cases.
To cover more cases that help understand the logic behind this puzzle you could add this test case:


. . . . .
. . . . .
. . Y . .
. . . . .
. . . . .

Expected Output:


This one shows that the seed could be placed under a space occupied by “a tree when you don’t plant the initial seed”.

It may seems like a corner case, but my initial solution passed all existing test cases but failed 2 validators. It goes without saying that it was not hard-coded :slight_smile:

1 Like

@AdrienLB Did you have a look :slight_smile: ?

The author is last seen on the forum around 2 months ago, so they probably haven’t read your message…

Could any approver @Timinator,@lllllllllllllllllll1 and @FredericLocquet take a look?

What language did you write your initial solution in? Is it published? I’d like to explore this a bit more with you and see how your solution can pass all test cases, but not all validators.

Let’s assume we have your 5x5 plot of land with one tree already on the middle spot. Even if you don’t plant any seed at all, the resulting forest will cover the entire 5x5 plot except for the four corners. A single seed placed in the middle row or the middle column on a 5x5 plot of land will produce a pattern that will cover the two closest corners, but not the two distant corners. So, yes, I believe your proposed test case is accurate. However, I need help understanding what situation is covered by this test case that is not covered in the existing test cases?

Hey @Timinator thank you for looking into this :slight_smile: !
My solution is published, in Rust.

I also have the code that passes all tests but not the all validators.
Can we discuss the solution here without spoiling people or should we take it elsewhere ?

ps: @5DN1L thanks for the heads up

1 Like

I will send you a PM where you can share your code privately.

Hello, sorry I didn’t know this forum part existed, I haven’t had notifications before.
I will look at your problem asap !! :slight_smile:

I don’t think there are any notification on the website, which is a shame !
There are only email notifications :confused:

Did I miss something? Are we going to look at the code that passes all test cases but not all validators? I never saw any code. I miss things all the time, so I might just need to be pointed in the right direction.

Sorry, I was in the process of answering you yesterday, and got taken in by some code :sweat_smile:
You have the code in PM, and I added @AdrienLB to the discussion.

1 Like

I will answer there too :
I executed your code.
I didn’t read and understand your code, don’t know rust, but I think I don’t need.
The output is somewhat clear, you are doing a simple run without planting seed and then you determine what is the best place from the places left.


X, , , ,
, , , ,
, ,Y, ,
, , , ,
, , , ,

Like above you put the seed in the corner, to fill one of the four empty spaces, but if you put it at equal distance from two empty spot it will cover in the end two corner not one.
Solution should be:
, , X , ,
, , , ,
, ,Y, ,
, , , ,
, , , ,
So you will have one more tree in the end.
I have added a testcase
Thank you @OoLaVache for pointing this problem
Thank you @Timinator for asking for the code

Tell me if everything is ok now :slight_smile:

I need some time to implement the difficult version of this puzzle, but diablo4 just went out, so later xD

1 Like

The new test case correctly failed with my code that wasn’t passing the validators.
Thank you for adding it :hugs:

1 Like

Great puzzle, but the instructions need minor clarification.

You say that “seeds need 10 years to grow into a tree”. This can only mean that a seed that is less than ten years old is not a tree.

The task is to “find the maximum number of trees after 33 years you can have by planting the seed at the best place”. From the first statement, one can only conclude that seeds less than 10 years old at the 33rd year should not be counted as trees for this purpose.

Only from running the test cases does it becomes clear that your intent was to say that “A seed is counted as a tree, but does not produce more seeds for 10 years after it is planted or dropped by a parent tree.”

Actually, i hv also tried to solve it. During its solving , i just wanted to know how to determine seeds nd trees specific positions over the iterations.