[Community Puzzle] Can you save the forest - Episode 1

https://www.codingame.com/training/medium/can-you-save-the-forest---episode-1

Send your feedback or ask for help here!

Created by @chabes,validated by @Alex-1,@slempel and @Nagato_Uzumaki.
If you have any issues, feel free to ping them.

Excellent! I made a mistake in my decision, it cost me gray hair)
Thanks to the author for an interesting mini-game!

1 Like

Nice puzzle, congrats!
I used beam search for the first time ever.

There are way too many puzzles with “Episode 1” or “Part 1” in the title with missing follow-up.
Please avoid this fate, this puzzle deserves a second episode!

2 Likes

TBali, The second episode is currently under moderation.

2 Likes

And the episode 3 is well advanced although I paused development since the Spring Challenge and did not restart it since.

My first beam search too :slight_smile:

Hi all. I’m passing all the tests except for “several outbreaks”. My code is not finding a single “winner branch” of the possibility-Tree. Very shortly: i’m using a “weighted” Monte Carlo Tree Search , so i have the standard 4-component : select → find an expandable leaf, expand → actually expand the leaf found, simulate → from the node just created play randomly a game until the end , backtrack → keep track of the score, but i think this is not a beam search: i do not have a cut-off for the number of children that a given node can have. Last precisation is: i’m not expanding and simulating randomly, becouse i give a weight to the action to choose such that it prioritize, increasing the probability to play that move in that state, the level-3 fire squares (i’m weighting in this way 1->1 , 2 ->2 , 3 with 0 neighbours where to spread ->3 , 3 with 1 neighbours available to spread → 3+1 , …, 3 with 4 neighbours available → 3 +4 = 7 , and then normalized to the sum ofc).
That said my question is: if i should prefer to put a cut-off on the number of child that a node can have, how to choose such number of max_child ? How to calculate it ? And should it be variable from node to another ? Or maybe the problem is in the way i am prioritizing the search ?
P.S. theoretically, if i play A LOT of games (eventually exploring all the state-space) i should be able to find at least 1 winning-tree-path, but i cannot becouse of timeout (at best i can search for 1000 child, for every 1 of these i have played 1 “random” game till the end and lost everytime). I have no idea of the magnitude-order of the number of possible state for the game, so i cannot say if it is a waaaaay to big than 1000.

Thank you very much for the help! really nice puzzle

I litteraly tried this puzzle for 2 weeks, and 2h after i wrote this i found a solution. Now i strongly play non-randomly.