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

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

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

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.