Description Usage Arguments Details Value Examples
Simulate Axis and Allies two-wave Battles
1 2 3 4 5 6 7 8 9 10 | simulateTwoWaveBattles(
oolFirstAttacker,
oolSecondAttacker,
oolDefender,
FUN = play_LHTR_battle,
...,
iterations = 2000,
replications = 3,
reinforcement = function(x) { x }
)
|
oolFirstAttacker |
character() vector of unit codes in preferred order of loss for first attack wave, formatted as |
oolSecondAttacker |
character() vector of unit codes in preferred order of loss for second attack wave, formatted as |
oolDefender |
character() vector of unit codes in preferred order of loss for defender, formatted as |
FUN |
function for running one battle |
... |
additional arguments passed to FUN |
iterations |
number of iterations to simulate for each replication |
replications |
number of replicates to run |
reinforcement |
function for adjusting 'oolDefender' between waves, accepts and returns argument formatted as |
This function simulates two waves of attack against a defender, with possible reinforcement of defence between the waves. Reinforcements are specified by a function (argument 'reinforcement') that modifies the surviving units from the first wave before the second wave commences.
Note that the defenders unit configuration is set up eactly as it was left after the first round of attack. Exactly what is left after the first round of attack is defined by the battle function provided in 'FUN' For some virtual units that may cause the second wave to not be incorrectly modeled. Consider for instance a defender OOL set up with virtual units to reflect first hits on battle ships. These are not automatically restored before the second wave, but must be configured with the 'reinforcement' argument.
The 'reinforcement' argument may otherwise be used to model the reinforcement of allied units between the two waves of attack.
The battle function 'FUN' implements the ruleset used.
FUN must accept the arguments 'oolAttacker' and 'oolDefender' and a logical argument suppressChecks,
it must return battleResults
twoWaveSimulationResults
1 2 3 4 5 6 | # simulate a two wave attack against 10 infantry,
# reinforced by 3 fighters added at the end of order of loss specification
# first wave of attack consists of 10 infantry
# second wave of attack consists of 10 infantry
result <- simulateTwoWaveBattles("10 inf", "10 inf", "10 inf",
reinforcement = function(x){c(x, rep("ftr", 3))})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.