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.
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:
one-tree-2
Input:
5
5
. . . . .
. . . . .
. . Y . .
. . . . .
. . . . .
Expected Output:
23
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
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 !
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
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 !!
I don’t think there are any notification on the website, which is a shame !
There are only email notifications
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
You have the code in PM, and I added @AdrienLB to the discussion.
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.
YEAR 33
,Y,Y,Y,
Y,Y,Y,Y,Y
Y,Y,Y,Y,Y
Y,Y,Y,Y,Y
,Y,Y,Y,
YEAR 0
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
I need some time to implement the difficult version of this puzzle, but diablo4 just went out, so later xD
The new test case correctly failed with my code that wasn’t passing the validators.
Thank you for adding it