Examples
Configuration
Statistics
- Probability of killing anything: 96.973%
- Probability of killing Player 2: 0.000%
- Probability of killing all 3 minions for Player 2: 11.227%
- Probability of killing at least 2 minions for Player 2: 66.319%
- Probability of killing at least 1 minion for Player 2: 96.973%
- Probability of killing any 1-health minion: 80.480%
- Probability of killing any 2-health minion: 77.199%
- Probability of any minion at or less than 1-health: 100.000%
- Probability of any minion at or less than 2-health: 100.000%
- Probability of all minions at or less than 1-health: 71.238%
- Probability of all minions at or less than 2-health: 100.000%
Chance of Individual Result
Player 2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
HP | Chance | Σ↑ |
---|
Full | 11.227% | 11.23% | 20/21 | 38.600% | 49.83% | 19/21 | 35.952% | 85.78% | 18/21 | 12.206% | 97.98% | 17/21 | 1.918% | 99.90% | 16/21 | 0.098% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 14.900% | 14.90% | 1/2 | 38.080% | 52.98% | Dead | 47.020% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 14.900% | 14.90% | 1/2 | 38.080% | 52.98% | Dead | 47.020% | 100.00% |
| HP | Chance | Σ↑ |
---|
Full | 19.520% | 19.52% | Dead | 80.480% | 100.00% |
|
Board States
1 attack (4 outcomes)Chance | P2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
25.000% | 21→20 | 2→2 | 2→2 | 1→1 | 25.000% | 21→21 | 2→1 | 2→2 | 1→1 | 25.000% | 21→21 | 2→2 | 2→1 | 1→1 | 25.000% | 21→21 | 2→2 | 2→2 | 1→0 |
| 2 attack (9 outcomes)Chance | P2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
14.583% | 21→20 | 2→2 | 2→2 | 1→0 | 14.583% | 21→21 | 2→1 | 2→2 | 1→0 | 14.583% | 21→21 | 2→2 | 2→1 | 1→0 | 12.500% | 21→20 | 2→1 | 2→2 | 1→1 | 12.500% | 21→20 | 2→2 | 2→1 | 1→1 | 12.500% | 21→21 | 2→1 | 2→1 | 1→1 | 6.250% | 21→19 | 2→2 | 2→2 | 1→1 | 6.250% | 21→21 | 2→0 | 2→2 | 1→1 | 6.250% | 21→21 | 2→2 | 2→0 | 1→1 |
| 3 attack (14 outcomes)Chance | P2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
12.847% | 21→20 | 2→1 | 2→2 | 1→0 | 12.847% | 21→20 | 2→2 | 2→1 | 1→0 | 12.847% | 21→21 | 2→1 | 2→1 | 1→0 | 9.375% | 21→20 | 2→1 | 2→1 | 1→1 | 6.944% | 21→21 | 2→0 | 2→2 | 1→0 | 6.944% | 21→21 | 2→2 | 2→0 | 1→0 | 6.424% | 21→19 | 2→2 | 2→2 | 1→0 | 5.208% | 21→20 | 2→0 | 2→2 | 1→1 | 5.208% | 21→20 | 2→2 | 2→0 | 1→1 | 5.208% | 21→21 | 2→0 | 2→1 | 1→1 | 5.208% | 21→21 | 2→1 | 2→0 | 1→1 | 4.688% | 21→19 | 2→1 | 2→2 | 1→1 | 4.688% | 21→19 | 2→2 | 2→1 | 1→1 | 1.563% | 21→18 | 2→2 | 2→2 | 1→1 |
|
4 attack (17 outcomes)Chance | P2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
15.191% | 21→20 | 2→1 | 2→1 | 1→0 | 9.491% | 21→21 | 2→0 | 2→1 | 1→0 | 9.491% | 21→20 | 2→0 | 2→2 | 1→0 | 9.491% | 21→20 | 2→2 | 2→0 | 1→0 | 9.491% | 21→21 | 2→1 | 2→0 | 1→0 | 7.595% | 21→19 | 2→1 | 2→2 | 1→0 | 7.595% | 21→19 | 2→2 | 2→1 | 1→0 | 5.816% | 21→20 | 2→0 | 2→1 | 1→1 | 5.816% | 21→20 | 2→1 | 2→0 | 1→1 | 4.688% | 21→19 | 2→1 | 2→1 | 1→1 | 3.472% | 21→21 | 2→0 | 2→0 | 1→1 | 2.908% | 21→19 | 2→0 | 2→2 | 1→1 | 2.908% | 21→19 | 2→2 | 2→0 | 1→1 | 2.532% | 21→18 | 2→2 | 2→2 | 1→0 | 1.563% | 21→18 | 2→1 | 2→2 | 1→1 | 1.563% | 21→18 | 2→2 | 2→1 | 1→1 | 0.391% | 21→17 | 2→2 | 2→2 | 1→1 |
| 5 attack (18 outcomes)Chance | P2 | #1 (2hp) | #2 (2hp) | #3 (1hp) |
---|
16.493% | 21→20 | 2→0 | 2→1 | 1→0 | 16.493% | 21→20 | 2→1 | 2→0 | 1→0 | 11.299% | 21→19 | 2→1 | 2→1 | 1→0 | 11.227% | 21→21 | 2→0 | 2→0 | 1→0 | 8.247% | 21→19 | 2→0 | 2→2 | 1→0 | 8.247% | 21→19 | 2→2 | 2→0 | 1→0 | 5.613% | 21→20 | 2→0 | 2→0 | 1→1 | 4.080% | 21→19 | 2→0 | 2→1 | 1→1 | 4.080% | 21→19 | 2→1 | 2→0 | 1→1 | 3.766% | 21→18 | 2→1 | 2→2 | 1→0 | 3.766% | 21→18 | 2→2 | 2→1 | 1→0 | 1.953% | 21→18 | 2→1 | 2→1 | 1→1 | 1.360% | 21→18 | 2→0 | 2→2 | 1→1 | 1.360% | 21→18 | 2→2 | 2→0 | 1→1 | 0.942% | 21→17 | 2→2 | 2→2 | 1→0 | 0.488% | 21→17 | 2→1 | 2→2 | 1→1 | 0.488% | 21→17 | 2→2 | 2→1 | 1→1 | 0.098% | 21→16 | 2→2 | 2→2 | 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