&$enemies, S_ENEMIES => &$s_enemies, AS_ENEMIES => &$as_enemies, AE_ENEMIES => &$ae_enemies, LOCATIONS => &$locations, S_LOCATIONS => &$s_locations, AS_LOCATIONS => &$as_locations, AE_LOCATIONS => &$ae_locations, TREACHERIES => &$treacheries, S_TREACHERIES => &$s_treacheries, AS_TREACHERIES => &$as_treacheries, AE_TREACHERIES => &$ae_treacheries); $masterDeck = array(); $masterShadowDeck = array(); $deck = array(); $shadowDeck = array(); $results = array(); $extraEnemyFrequency = array(); $extraEnemyFrequency = array_pad($extraEnemyFrequency, 10, 0); $numRounds = array(); $numRounds = array_pad($numRounds, 10, 0); function makeMasterDecks() { global $masterDeck, $deckHelper, $shadow, $masterShadowDeck; $masterDeck = array(); foreach ($deckHelper as $cardtype => $cardcount) { for ($i = 0; $i < $cardcount; $i++) { $masterDeck[] = $cardtype; // add the proper type of card to the deck } } // create the shadow deck for ($i = 0; $i < count($masterDeck); $i++) { // add a shadow return card if appropriate if ($i < $shadow) { $masterShadowDeck[] = SHADOW_RETURN; } else { $masterShadowDeck[] = SHADOW_NORMAL; } } return; } function shuffleDecks() { global $deck, $masterDeck, $shadowDeck, $masterShadowDeck; $deck = $masterDeck; $shadowDeck = $masterShadowDeck; // actually randomize the order //shuffle($deck); //shuffle($shadowDeck); return; } function dealCard(& $myDeck) { // deal the top card on the deck //return array_pop($myDeck); // deal a random card and remove it from the deck $card = array_splice($myDeck, array_rand($myDeck), 1); return $card[0]; } function resolveCard($c, $enemyCount, $currentRound) { // Did we get an enemy in the staging area? if ($c == ENEMIES || $c == S_ENEMIES || $c == AS_ENEMIES || $c == AE_ENEMIES) { $enemyCount++; } // Did we just get an enemy accelerator to the staging area? if ($c == AS_ENEMIES || $c == AS_LOCATIONS || $c == AS_TREACHERIES) { $enemyCount++; $currentRound++; // increase the current round, too } // Did we just get an enemy accelerator engaged with the player? elseif ($c == AE_ENEMIES || $c == AE_LOCATIONS || $c == AE_TREACHERIES) { $currentRound++; } // Did we get a surge card? if ($c == S_ENEMIES || $c == S_LOCATIONS || $c == S_TREACHERIES) { // deal another card return resolveCard(dealCard($deck), $enemyCount, $currentRound); } // return the new information return array ("enemyCount" => $enemyCount, "currentRound" => $currentRound); } /////////////////////////////////////////////////////////////////// // prepare the decks makeMasterDecks(); // for each game for ($g = 0; $g < $games; $g++) { shuffleDecks(); $currentRound = 0; $actualRounds = 0; $extraEnemies = 0; // keep going until we've played enough rounds while ($currentRound++ < $rounds) { // start with 1 enemy automatically $enemyCount = 1; // returns a results array $results = resolveCard(dealCard($deck), $enemyCount, $currentRound); // update enemy count as needed $enemyCount = $results['enemyCount']; // update currentRound as needed $currentRound = $results['currentRound']; // deal 1 shadow card if (dealCard($shadowDeck) == SHADOW_RETURN) { // return the enemy to the staging area $enemyCount++; } // do we have >1 enemy? $extraEnemies += $enemyCount - 1; // update actual rounds played $actualRounds++; } // track how many extra enemies we had this game $extraEnemyFrequency[$extraEnemies]++; // track how many actual rounds it took $numRounds[$actualRounds]++; } // for each game // Calculate the average number of extra enemies $averageExtra = 0; for ($i = 1; $i < count($extraEnemyFrequency); $i++) { $averageExtra += $extraEnemyFrequency[$i] * $i; } $averageExtra /= $games; // record extra enemy frequency 4 or greater $loseExtra = 0; for ($i = 4; $i < count($extraEnemyFrequency); $i++) { $loseExtra += $extraEnemyFrequency[$i]; } // calculate the percentage $loseExtra /= $games / 100; // Calculate the average number of rounds $averageRounds = 0; for ($i = 1; $i < count($numRounds); $i++) { $averageRounds += $numRounds[$i] * $i; } $averageRounds /= $games; ?>

A LotR LCG card drawing simulation with games

The percentage of games that had 4+ extra enemies was 0%.
The average number of rounds required was 0.
The average number of extra enemies was 0.

This simulation assumes:
  • Solo game
  • One shadow card per round, and that's the only way enemies ever get returned to the staging area.
  • Enemies are never destroyed while in the staging area.
  • Enemies are destroyed once engaged, unless they return to the staging area.
  • No cards both accelerate the number of rounds AND have surge.

    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } ?>
    Rounds Games Sum
    ".$r."".$numRounds[$r]."".$sumRounds."
    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } ?>
    Extra
    Enemies
    Games Sum
    ".$e."".$extraEnemyFrequency[$e]."".$sumExtras."
    Card Type Normal Surge Accelerator
    to Staging
    Accelerator
    to Engaged
    Enemies:
    Locations:
    Treacheries:
    # of Shadow effects
    that return to Staging:
    Rounds:
    # of Trials:


    If you notice a problem with this page, please e-mail me!