# .font: font.text_2
2022-12-22 19:13 dustin  
# .font: font.text_1
some math behind this cave, just for fun :d  
  
on average, ^ needs...  
4.06 attempts until one Θ survives (enough to solve the cave)  
35.53 attempts until two ΘΘ survive  
567 attempts until three ΘΘΘ survive  
15929 attempts until four ΘΘΘΘ survive  
833591 attempts until five ΘΘΘΘΘ survive  
104 million attempts until all six ΘΘΘΘΘΘ survive! :d

# .font: font.text_2
2022-12-23 16:36 DarkStoorM  
# .font: font.text_1
I'm actually wondering how does the chance per room look like :D  
  
Am I right to assume, that there are 4 Θ per each room, that can grow? The first four in the scan order of each box.  
  
The corner ΘΘ have two chances of growing, while top+left next to the Ζ only have one chance. So, does that mean that, It's actually 0.1875 chance of surviving of at least one of those four amoebas in one room?  
  
I'd like to see how the actual math looks like :D

# .font: font.text_2
2022-12-23 18:18 dustin  
# .font: font.text_1
 darkstoorm , it's a pleasure for me :d  
  
yes, actually there are four ΘΘΘΘ in each box which can grow. two of them have two chances, two have one chance. so far, so good.  
  
now if you put an Θ in the middle of a cave where it could grow into every direction, then the chances that it does grow are 0.03125 per frame (4/128). however, if the amoeba can only grow into one direction, then the chance that it does is only 0.03125/4 = 0.0078125 = 1/128. likewise, the amoebas which have two chances to grow have a 2/128 chance to do so.   
  
now if we would add these odds, then we would get a 6/128 = 0.046875 chance for each box. multiplying by 6 would give a chance of 0.28125 that at least one Θ survives.  
  
however, this calculation is not entirely correct. adding probabilities is only allowed if the chances exclude each other. but it is possible (although unlikely) that two ΘΘ grow at the same time, even in one and the same box.  
  
so to get precise results, we must calculate differently. the chances that in a given box n o amoeba grows can be calculated by multiplying the odds for each Θ. we get (126/128)*(127/128)*(126/128)*(127/128) = 0.95391275.  
multiplying odds is always allowed if they do not influence each other. whether one piece of Θ grows has no influence on whether another piece of Θ grows in the same frame.   
  
so finally we have the first reault:  
the odds that in a given box the ΘΘΘ (as a whole) survives are 1-0.95391275 = 0.04608725.  
  
summing up the two most important rules about calculating with odds:   
\ rule 1: the odds of two events a and b can be added if they exclude each other (and if we need only one event to happen).  
\ rule 2: the odds of events a and b can be multiplyed if we need both of them to happen and if they do not influence each other.  
  
ok, so what are the chances that at least one Θ in the whole cave survives (so the cave is solvable)?  
  
again, to get a precise result, we cannot just multiply the 0.0460... odd with 6 because it's also possible that more than one Θ grows (so rule 1 does not work). so again we calculate the reverse odds first. if we don't want any Θ to grow in the whole cave, then we can work with rule 2 and multiply 0.95... six times by itself:  
0.95391275 to the 6th power = 0.753445636.  
so the chances to have an Θ in the cave are 1-0.75... = 0.246554364.  
  
the reciprocal of this is the average number of attempts needed to solve the cave:  
1/0.24... = 4.0559...  
voila the first result of my first comment! :d

# .font: font.text_2
2022-12-23 18:25 dustin  
# .font: font.text_1
this whole calulation is based on the assumption that the ΘΘΘ rng works as follows:  
  
for each Θ independantly, a random number from 1-128 is generated.  
1 = grow up (if possible, otherwise do not grow at all)  
2 = grow right  
3 = grow down  
4 = grow left  
5,6,...,128 = do not grow  
when done, forget the number, go to the next Θ and create a new random number, and so on.  
  
probably the ΘΘΘ rng does not work exactly like that, but without knowing how exactly it does work, the above description is the best approximation to work with ;)

# .font: font.text_2
2022-12-23 19:05 DarkStoorM  
# .font: font.text_1
 dustin , Ohh! :D Thanks for the explanation, I totally forgot to take blocked paths into account, so I was trying to figure this out for 0.03125 instead of 0.03125/4 when 3 directions are blocked :D now that makes sense to me!  
  
And about the rng, hard to tell, maybe  nesdori  has some information :D  
My only source was BD object specification I found online, it only says: for every direction (up, left, right, down), generate random number from 0 to "growth factor" (15 or 127) and if it's less than 4, grow in that direction"

# .font: font.text_2
2022-12-23 19:22 dustin  
# .font: font.text_1
 darkstoorm , does your source really say that the rng should generate an own random number for each direction? a number for growing up, and if it's negative, then another number for growing down etc.? this would make the Θ grow a lot faster :d

# .font: font.text_2
2022-12-23 19:44 DarkStoorM  
# .font: font.text_1
 dustin : this was the source I used:  
<a href="http://www.elmerproductions.com/sp/peterb/BDCFF/objects/000A.html" target="external">http://www.elmerproductions.com/sp/peterb/BDCFF/objects/000A.html</a>  
  
and oh, I just noticed it's a bit different, there is "GetRandomDirection" function mentioned, but it's not documented on this page, so now I don't know how the randomm direction is selected :D  
  
I didn't notice that the pseudo code does a "for each direction" loop just to check if Θ can grow.  
  
I also don't have the original source code, so now I'm clueless :D

# .font: font.text_2
2022-12-23 20:10 nesdori  
# .font: font.text_1
the amoeba growth check is done with one random number. 8-bit random number is first bitwise anded with either 127 (slow) or 15 (fast). if the result is 4 or higher, the amoeba won't grow. otherwise the lowest 2 bits determine the direction where it tries to grow. so basically the actual implementation is very close to  dustin 's model :)