Documentation ¶
Index ¶
- func SetBaseOol(ool []string)
- func SetGame(g string)
- func SetIterations(i int)
- func SetMustTakeTerritory(a bool)
- type ByAttackingPower
- type ByCost
- type ByDefendingPower
- type ConflictProfile
- type FirstRoundResult
- type FirstRoundResultCollection
- type InvalidUnitError
- type RollMap
- func (r RollMap) AddRoll(hitValue, num int) (newMap RollMap)
- func (r RollMap) Get(num int) (index int, rv *RollValue)
- func (r RollMap) HasValue(num int) (has bool)
- func (r RollMap) Len() int
- func (r RollMap) Less(i, j int) bool
- func (r RollMap) Reduce(hitValue, num int) (newMap RollMap)
- func (r RollMap) RemoveUnits(f map[string]int, units []string, mode string)
- func (r RollMap) Swap(i, j int)
- type RollValue
- type Summary
- type Unit
- type Units
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetBaseOol ¶
func SetBaseOol(ool []string)
SetBaseOol allow a custom baseOol to be set for the conflict.
func SetGame ¶
func SetGame(g string)
SetGame sets the game up internally. Altering unit makeup, and ool
func SetIterations ¶
func SetIterations(i int)
SetIterations changes the number of times the simulation will be ran.
func SetMustTakeTerritory ¶
func SetMustTakeTerritory(a bool)
SetMustTakeTerritory toggles the mustTakeTerritory flag for the simulation
Types ¶
type ByAttackingPower ¶
type ByAttackingPower struct{ Units }
ByAttackingPower sorts the units by the higest Attack value of the unit
func (ByAttackingPower) Less ¶
func (p ByAttackingPower) Less(i, j int) bool
Less implementing Sortable
type ByCost ¶
type ByCost struct{ Units }
ByCost sorts the units by the lowest Cost value of the unit
type ByDefendingPower ¶
type ByDefendingPower struct{ Units }
ByDefendingPower sorts the units by the higest Defend value of the unit
func (ByDefendingPower) Less ¶
func (p ByDefendingPower) Less(i, j int) bool
Less implementing Sortable
type ConflictProfile ¶
type ConflictProfile struct { // Rounds is the number of rounds a conflict took Rounds int // DefenderHits is number of losses by round for the attacker DefenderHits []int // AttackerHits is number of losses by round for the defender AttackerHits []int // The number of IPC's that the attacker lost in the conflict AttackerIpcLoss int // The number of IPC's that the defender lost in the conflict DefenderIpcLoss int // Number of Attacking Units Remaining at the end of the Conflict AttackerUnitsRemaining []map[string]int // Number of Defending Units Remaining at the end of the Conflict DefenderUnitsRemaining []map[string]int // AAA Hits represent the number of AAA hits for the conflict AAAHits int // AAA Hits represent the number of Kamikaze hits for the conflict KamikazeHits int // Outcome represents the status of the conflict after the fact. // 1: Attacker Victory // 0: Draw // -1: Defender Victory Outcome int }
ConflictProfile is a struct representing the outcome of a single conflict
type FirstRoundResult ¶
type FirstRoundResultCollection ¶
type FirstRoundResultCollection []FirstRoundResult
func (FirstRoundResultCollection) Add ¶
func (fc FirstRoundResultCollection) Add(result FirstRoundResult) FirstRoundResultCollection
type InvalidUnitError ¶
type InvalidUnitError struct {
// contains filtered or unexported fields
}
InvalidUnitError represents an error where an invalid unit has been entered for a particular game.
func (InvalidUnitError) Error ¶
func (i InvalidUnitError) Error() string
Error returns the string form of the error
type RollMap ¶
type RollMap []RollValue
RollMap is the type that can hold multiple RollValue types
func (RollMap) AddRoll ¶
AddRoll will add a specific RollValue to a RollMap based on a hitValue and num. returning the new RollMap with value added
func (RollMap) Get ¶
Get returns a the index of and the specific RollValue within the RollMap with a hitValue matching the passed in num
func (RollMap) HasValue ¶
HasValue returns whether or not a RollMap has an entry for a RollValue with a hitValue matching the passed in num.
func (RollMap) Reduce ¶
Reduce will reduce the num value of one RollValue within a RollMap. If a RollMap, for example, Contains a RollValue of {hitValue: 3, num:2} and we Reduce(3, 1). The resulting RollMap will contain {hitValue: 3, num: 1}. having reduced the number of rolls at the hitvalue of 3. The new RollMap will be returned by this function
func (RollMap) RemoveUnits ¶
RemoveUnits reduces the roll map by the passed in slice of units for the given. mode. Uses the formation to determine what numbers to remove
type RollValue ¶
type RollValue struct {
// contains filtered or unexported fields
}
RollValue simply defines the basic structure of a thing that can be rolled and assign hits to the opposing units. Given a hitValue (The number that counts as a "hit") and a num (The number of rolls at that number)
type Summary ¶
type Summary struct { // TotalSimulations The number of simulations that have been ran TotalSimulations int `json:"totalSimulations"` // AverageRounds The number of rounds on average a conflict lasted. AverageRounds float64 `json:"averageRounds"` // AttackerWinPercentage The percentage of conflicts that the attacker won AttackerWinPercentage float64 `json:"attackerWinPercentage"` // DefenderWinPercentage The percentage of conflicts that the defender won DefenderWinPercentage float64 `json:"defenderWinPercentage"` // DrawPercentage The percentage of conflicts that was a draw DrawPercentage float64 `json:"drawPercentage"` // AAAHitsAverage The number of AAA hits per round on average AAAHitsAverage float64 `json:"aaaHitsAverage"` // KamikazeHitsAverage The number of kamikaze hits per round on average KamikazeHitsAverage float64 `json:"kamikazeHitsAverage"` // AttackerAvgIpcLoss The number of IPC's the attacker loses on average AttackerAvgIpcLoss float64 `json:"attackerAvgIpcLoss"` // DefenderAvgIpcLoss The number of IPC's the defender loses on average DefenderAvgIpcLoss float64 `json:"defenderAvgIpcLoss"` // FirstRoundResults is the array of first round data. Represents the // number of hits that an attacker and defender get on the first round, // the frequency of such a result, and the victory result of that conflict. FirstRoundResults FirstRoundResultCollection `json:"firstRoundResults"` // AttackerUnitsRemaining represents all the remaining units at the end // of conflict. The units are represented by a string and the number of // times that that formation remained at the end of the conflict is the // value AttackerUnitsRemaining map[string]int `json:"attackerUnitsRemaining"` // DefenderUnitsRemaining represents all the remaining units at the end // of conflict. The units are represented by a string and the number of // times that that formation remained at the end of the conflict is the // value DefenderUnitsRemaining map[string]int `json:"defenderUnitsRemaining"` }
Summary is a type which represents the an averaged results of multiple conflicts.
type Unit ¶
type Unit struct { Alias string Name string Cost int Attack int Defend int IsShip bool IsAAA bool IsSub bool IsAircraft bool IsBunker bool CapitalShip bool CanBombard bool CanTakeTerritory bool PlusOneRolls func(map[string]int) int PlusOneDefend func(map[string]int) int // Number of units receiving a defensive boost if this is a bunker Capacity int // MultiRoll is the number of dice the unit can roll, and select the best // roll for it's hit. MultiRoll int }
Unit represents a specific unit within a game, identifing a lot of specific information related to the unit.
type Units ¶
type Units []Unit
Units is a container for multiple Unit structs