Britbot
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | Private Member Functions | Static Private Member Functions | Private Attributes
Britbot.Group Class Reference

Represents a structure of few of our pirates that have a common goal. More...

List of all members.

Public Member Functions

 Group (int[] piratesId)
 Creates a new group with the given pirates.
 Group ()
 Just a ctor to do to common stuff (called from the other ctors above by "this()" statement)
 Group (int index, int amount)
override string ToString ()
 You know what this does, don't you?
void SetTarget (ITarget target)
 Sets the target of the group, while doing so also resets the heading vector if there is need (meaning if we didn't choose the same target again).
Location GetLocation ()
 Returns the average location for this group.
int FightCount ()
 counts how many fighters does an enemy group has, not including ones capturing islands
IEnumerable< KeyValuePair
< Pirate, Direction > > 
GetGroupMoves (CancellationToken cancellationToken)
 Decides where to move each pirate in the group.
double MinimalETATo (Location location)
 Gets the minimal number of turns for the group to reach the given location.
void Update ()
 Does updates for the group when changed.
Location FindCenter (bool forcePirate)
 Find the center of the group.
int LiveCount ()
 counts how many living pirates are in the group
void CalcPriorities (CancellationToken cancellationToken)
 Calculate target priorities for this group.
void AddPirate (int index, bool remove=true)
 Adds a pirate to this group, removing it from any other group it was in.
IEnumerable< GroupSplit (int num)
 Splits 'num' pirates from the group.
void Join (Group g, bool remove=true)
 Joins a group to this group.
int MinDistance (Group b)
 Minimal distance between groups.

Static Public Member Functions

static int GetRingCount (int pirateNum)
 returns the amount of rings in the formation for given amount of pirates
static int GetStructureVolume (int maxRing)
static void Switch (Group bigGroup, Group smallGroup)
 Given two groups it will rearange the pirates in them so that the big group will have the pirates who are the most addvanced.
static bool CheckIfGroupsIntersects (Group g1, Group g2)
 checks if two groups are messed around in one another TODO: make this smarter

Public Attributes

readonly int Id
 The Group ID number useful for debugging.

Properties

HeadingVector Heading [get, set]
 Direction of the group to make navigation more precise.
ObservableCollection< int > Pirates [get, set]
 List of the indexes of the pirates in this group.
ITarget Target [get, set]
 The target of the Group.
List< ScorePriorities [get, set]
 List of priorities for this group.
static int GroupCounter [get, set]
 static member to give each group a unique id based on its number of creation
Dictionary< int, Location > FormOrders [get, set]
 The required location for each pirate in the group to get to attack structure.
int DistanceFromTarget [get]
 The Distance Of a pirate in this group From it's target.

Private Member Functions

IEnumerable< KeyValuePair
< Pirate, Direction > > 
GetStructureMoves (CancellationToken cancellationToken)
 Get the correct moves to get into structure.
double CasualtiesPercent ()
 Return the percent of lost pirates in this group.
bool IsFormed (bool checkCasualties=true)
 Checks if the group is formed.
void GenerateFormationInstructions (Location[] structure=null)
 Generates instructions to form into optimal structure.
Location[][] GenerateGroupStructure (Location pivot, bool trim=true)
 Get the structure for the group.

Static Private Member Functions

static internal List< Location > GenerateRingLocations (Location pivot, int ringOrdinal)
 Get the ring of the specified index relative to the given pivot.

Private Attributes

int _formTurnsAttempt
 Counter of the number of turn this groupis trying to get into structure.
bool _hasChanged
 has the group changed this turn?

Detailed Description

Represents a structure of few of our pirates that have a common goal.

Definition at line 17 of file Group.cs.


The documentation for this class was generated from the following file: