quote:
Originally posted by Mnjul
Lobster: Could you use math equations to explain your post?
http://shoutbox.menthix.net/showthread.php?tid=20...d=189580#pid189580
In your post I at least know standard deviation...anyway just post your equations and I'll try to work it out
Thanks
If you don't want to..it's ok too
OK, the way I'll do this is to do the equations php-style, which afaik is almost if not completely identical to c...
Supposing you had a class array named $combination which had a number of different properties. Each item in the array represents a possible combination in which the current visible squares are all satisfied (e.g. every 2 has two mines next to it)
foreach($combination as $i=>$value){
$combination[$i]->squaresinvolved = $combination[$i]->knownemptysquares + $combination[$i]->knownmines ;
$combination[$i]->deviation = ($combination[$i]->squaresinvolved / $combination[$i]->knownmines)-(256/51) ;
$totaldev += sqrt($combination[$i]->deviation ^ 2);
}
$standarddev = $totaldev / count($combination) ;
foreach($combination as $i=>$value){
$combination[$i]->standardisedscore = $combination[$i]->deviation / $standarddev ;
}
Now each combination has a standardised score which represents the number of standard deviations from the average and ideal situation. The closer to 0 this value is, the more likely the combination is. To make the closeness to zero a positive thing, I think at this point it needs to be depolarised and reciprocated. Then the reciprocal can be found as a fraction of the total and it's that fraction that is the direct probability of each combination.
foreach($combination as $i=>$value){
$combination[$i]->standardisedscore = 1/(sqrt($combination[$i]->standardisedscore ^ 2)) ;
$totalreciprocalstandardisedscore += $combination[$i]->standardisedscore ;
}
foreach($combination as $i=>$value){
$combination[$i]->probability = $combination[$i]->standardisedscore/$totalreciprocalstandardisedscore ;
}
Now we have to apply the combination's probability to each square to see which one it affects the most. Let's take every square that [o] might want to click on (i.e. every one that is adjacent to the existing cluster of uncovered squares) and throw them into some sort of array. And let's suppose each of these squares has a property called "influences" which is an array of probabilities that have effect on that square. For example, if it's adjacent to a 1 with 4 free spaces next to it, an array item would be added with a value of 0.25. The number of items in the array would depend on the number of opened squares. For each of these probabilities you multiply it by the combination's probability, and then at the end take the average of these probabilities. For each combination, the average probability is added to get a perfect (i think) probability:
foreach($combination as $i=>$value){
foreach($possiblesquare as $j=>$value1){
foreach($possiblesquare[$j]->influences as $k=>$value2){
$possiblesquare[$j]->influences[$k] = $possiblesquare[$j]->influences[$k] * $combination[$i]->probability ;
}
$possiblesquare[$j]->probability[$i] = sum($possiblesquare[$j]->influences) / count($possiblesquare[$j]->influences);
}
}
foreach($possiblesquare as $i=>$value){
$possiblesquare[$i]->overallprobability = sum($possiblesquare[$i]->probability);
}
And if I'm right, that's the way the cookie crumbles