Examples
Configuration
Statistics
- Probability of killing anything: 99.976%
- Probability of killing Player 2: 0.000%
- Probability of killing all 3 minions for Player 2: 84.563%
- Probability of killing at least 2 minions for Player 2: 98.961%
- Probability of killing at least 1 minion for Player 2: 99.976%
- Probability of killing any 1-health minion: 99.976%
- Probability of any minion at or less than 1-health: 100.000%
- Probability of all minions at or less than 1-health: 100.000%
Chance of Individual Result
Player 2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
HP | Chance | Σ↑ |
---|
18/21 | 84.563% | 84.56% | 17/21 | 14.398% | 98.96% | 16/21 | 1.015% | 99.98% | 15/21 | 0.024% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 5.500% | 5.50% | Dead | 94.500% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 5.500% | 5.50% | Dead | 94.500% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 5.500% | 5.50% | Dead | 94.500% | 100.00% |
|
Board States
1 attack (4 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
25.000% | 21→20 | 1→1 | 1→1 | 1→1 | 25.000% | 21→21 | 1→0 | 1→1 | 1→1 | 25.000% | 21→21 | 1→1 | 1→0 | 1→1 | 25.000% | 21→21 | 1→1 | 1→1 | 1→0 |
| 2 attack (7 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
16.667% | 21→21 | 1→0 | 1→0 | 1→1 | 16.667% | 21→21 | 1→0 | 1→1 | 1→0 | 16.667% | 21→21 | 1→1 | 1→0 | 1→0 | 14.583% | 21→20 | 1→0 | 1→1 | 1→1 | 14.583% | 21→20 | 1→1 | 1→0 | 1→1 | 14.583% | 21→20 | 1→1 | 1→1 | 1→0 | 6.250% | 21→19 | 1→1 | 1→1 | 1→1 |
| 3 attack (8 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
25.000% | 21→21 | 1→0 | 1→0 | 1→0 | 18.056% | 21→20 | 1→0 | 1→0 | 1→1 | 18.056% | 21→20 | 1→0 | 1→1 | 1→0 | 18.056% | 21→20 | 1→1 | 1→0 | 1→0 | 6.424% | 21→19 | 1→0 | 1→1 | 1→1 | 6.424% | 21→19 | 1→1 | 1→0 | 1→1 | 6.424% | 21→19 | 1→1 | 1→1 | 1→0 | 1.563% | 21→18 | 1→1 | 1→1 | 1→1 |
|
4 attack (8 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
52.083% | 21→20 | 1→0 | 1→0 | 1→0 | 13.310% | 21→19 | 1→0 | 1→0 | 1→1 | 13.310% | 21→19 | 1→0 | 1→1 | 1→0 | 13.310% | 21→19 | 1→1 | 1→0 | 1→0 | 2.532% | 21→18 | 1→0 | 1→1 | 1→1 | 2.532% | 21→18 | 1→1 | 1→0 | 1→1 | 2.532% | 21→18 | 1→1 | 1→1 | 1→0 | 0.391% | 21→17 | 1→1 | 1→1 | 1→1 |
| 5 attack (8 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
72.049% | 21→19 | 1→0 | 1→0 | 1→0 | 8.343% | 21→18 | 1→0 | 1→0 | 1→1 | 8.343% | 21→18 | 1→0 | 1→1 | 1→0 | 8.343% | 21→18 | 1→1 | 1→0 | 1→0 | 0.942% | 21→17 | 1→0 | 1→1 | 1→1 | 0.942% | 21→17 | 1→1 | 1→0 | 1→1 | 0.942% | 21→17 | 1→1 | 1→1 | 1→0 | 0.098% | 21→16 | 1→1 | 1→1 | 1→1 |
| 6 attack (8 outcomes)Chance | P2 | #1 (1hp) | #2 (1hp) | #3 (1hp) |
---|
84.563% | 21→18 | 1→0 | 1→0 | 1→0 | 4.799% | 21→17 | 1→0 | 1→0 | 1→1 | 4.799% | 21→17 | 1→0 | 1→1 | 1→0 | 4.799% | 21→17 | 1→1 | 1→0 | 1→0 | 0.338% | 21→16 | 1→0 | 1→1 | 1→1 | 0.338% | 21→16 | 1→1 | 1→0 | 1→1 | 0.338% | 21→16 | 1→1 | 1→1 | 1→0 | 0.024% | 21→15 | 1→1 | 1→1 | 1→1 |
|
Algorithm
// turn an array of healths into a decodable-string
// note: we need strings since php arrays are shit
function encode($a) {
return implode(':', $a);
}
// turn an encoded-string into an array of healths
function decode($s) {
return array_map('intval', explode(':', $s));
}
// given a hash of states: encoded(healths) -> probability
// return the probability of each possible resulting state
// after applying one random attack to all remaining units
function bomb($states) {
$u = array();
foreach ($states as $enc => $prior) {
$x = decode($enc);
$a = array();
for ($i = 0; $i < count($x); $i++) { // collect indices of living units
if ($x[$i] > 0) {
$a[] = $i;
}
}
foreach ($a as $i) { // apply an attack to each unit
$v = $x; // copy the healths
$v[$i]--; // reduce hp by one
$k = encode($v);
$c = array_key_exists($k, $u) ? $u[$k] : 0;
$u[$k] = $c + $prior / count($a); // update probabilities
}
}
return $u;
}
Example
// initial board state
$healths = array(2, 2);
// initial board distribution
// (100% chance we have 2x 2-hp units)
$s0 = array(encode(healths) => 1);
[2:2] => 1.00000
// apply one random attack
$s1 = bomb($s0);
[1:2] => 0.50000
[2:1] => 0.50000
// apply another
$s2 = bomb($s1);
[0:2] => 0.25000
[1:1] => 0.50000
[2:0] => 0.25000