ALMaSS Partridge ODdox
1.1
The partridge model description following ODdox protocol
|
Go to the documentation of this file.
38 #ifndef Partridge_CoveyH
39 #define Partridge_CoveyH
66 ForIterator(
int a_min_incl,
int a_max_excl,
int a_step_size,
int a_norm_min_incl,
int a_norm_max_excl );
174 bool NestFindFast(
int a_min_x_incl,
int a_max_x_excl,
int a_min_y_incl,
int a_max_y_excl );
176 int Norm(
int a_coord,
int a_size );
178 int NormInc(
int a_coord,
int a_size );
180 int NormDec(
int a_coord,
int a_size );
196 double Pressure(
double a_distance );
206 double HabitatEvaluate(
int a_center_x,
int a_center_y,
int * a_size_used,
bool a_rethink_size );
210 double HabitatEvaluateFast(
int a_min_x_incl,
int a_max_x_excl,
int a_min_y_incl,
int a_max_y_excl );
212 double HabitatEvaluateSlow(
int a_min_x_incl,
int a_max_x_excl,
int a_min_y_incl,
int a_max_y_excl );
288 bool NestFindSlow(
int a_min_x_incl,
int a_max_x_excl,
int a_min_y_incl,
int a_max_y_excl );
323 double MoveDoIt(
int * a_x,
int * a_y,
int a_dir,
int a_step_size );
592 void MoveDistance(
int a_max_distance,
int a_step_size,
double a_food_density_needed );
647 bool FlyTo(
int a_distance );
650 void MoveTo(
int a_x,
int a_y );
708 unsigned int X(
void ) {
713 unsigned int Y(
void ) {
738 unsigned int ID(
void ) {
773 unsigned int a_center_y,
Landscape * a_map );
int m_covey_x
Covey x-coord.
int m_world_width_div2
Half landscape width.
Partridge_State m_state
The current behavioural state.
int m_ourChicks
No chicks in covey.
bool m_essence_low
flag for excess density - unused
bool NestBadAreasScanFast(int a_min_x, int a_min_y, int a_length, int a_x, int a_y)
Nest location evaluation function.
void BeginStep(void)
Covey BeginStep.
double m_assess_qual
Habitat quality.
void OntheMumDead()
Behaviour when alpha female is killed.
int MoveSelectFuzzy(void)
Fuzzdy movement selection.
bool ManagerIsPermanant(void)
Unused
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
double Pressure(double a_distance)
Get the pressure force.
void OnAddChick(Partridge_Female *a_pf)
Add a chick.
void MoveTo(int a_x, int a_y)
unused
int * m_list
List of points
The partridge male class.
bool LifeEssenceLow(void)
double Getpar_force_ignore_below()
Get the minimum interesting force.
The partridge female class.
double m_maxFoodNeedToday
Food needed today.
void MoveDirectionsAllowed(int a_x, int a_y)
Test possible movement directions.
void ManagerSetPermanent(void)
Unused
int m_center_y
Covey centre.
Partridge_Male * GetMaleInCovey()
Find a male in the covey.
void OnDissolve(int date)
Dissolve message handler.
int NormInc(int a_coord, int a_size)
Wrap-around utility function.
Partridge_Base * GetMember(int a_member)
Returns pointer to a_member.
int NormDec(int a_coord, int a_size)
Wrap-around utility function.
int m_limit
How many points
int MoveCanMove(TTypesOfLandscapeElement a_ele)
Test if we can go there.
The population manager for partridge objects.
void ManagerUpdatePos(void)
int SupplyChickAge(void)
Returns the age of the chicks.
int NestGetX(void)
Return nest x-coord.
Iterator class for wrap around landscape
int m_move_get_index
Internal variable.
Partridge_Base * GetAMember()
Returns a random member.
CoveyManager(unsigned int a_world_width, unsigned int a_world_height, Landscape *a_map)
Constructor.
double m_new_center_y_float
Covey centre as float.
Landscape * m_map
A pointer to the landscape.
void CoveyUpdateMemberPositions(int a_x, int a_y)
Update all covey members x,y coords.
int m_CoveyDissolveDate
Date for covey dissolve.
int m_width
Landscape width.
bool NestFindSlow(int a_min_x_incl, int a_max_x_excl, int a_min_y_incl, int a_max_y_excl)
Find nest location (wrap around)
double GetmaxFoodNeedToday()
Return the maximum food need today.
int AssessGetSize(void)
Get the size ('radius') used during territory evaluation.
bool NestFindFast(int a_min_x_incl, int a_max_x_excl, int a_min_y_incl, int a_max_y_excl)
Find nest location.
bool PressureLimitExceeded(double a_pressure)
Test for exceedence of pressure limit.
void SanityCheck3()
Debug method.
void ManagerDriftPos(void)
void RemoveExtraChick()
Decrement the chick number.
void OnChickDeath()
Remove a dead chick.
double m_center_x_float
Covey centre as float.
int m_height
Landscape height.
double AssessHabitatQualityFaster()
Assess habitat quality (efficient)
int m_world_height
Landscape height.
static vector< Partridge_Covey * > g_covey_list
Partridge_Covey * FindNeighbour()
Finds the closest other covey.
bool AllFlocking2()
Debug method.
int m_maxAllowedMove
Max move distance today.
int m_world_width
Landscape width.
void MoveDistance(int a_max_distance, int a_step_size, double a_food_density_needed)
Entry point for movement.
Base class for all partridge classes.
void ActOnParentDeath()
Determine the chick mortality on parent death.
int GetOurChicks()
Return the number of chicks.
Partridge_Female * m_theMum
Pointer to the alpha male.
int m_flyto_steps
costly intermediate variable
double SupplyDistanceMoved(void)
Return the distance moved today.
void DistanceUpdate(void)
Updates distance to nearest covey.
Partridge_Base * GetUncle()
Find uncle in covey.
int GetChickAge()
Return chick age.
int m_id_counter
Counter to keep track of covey ids.
double MoveMagicVegToFood(int a_polygon)
Move optimising food intake.
Partridge_Female * FindMeAMateInCovey(int a_family_counter)
Is their a suitable female mate in the covey?
ForIterator(int a_min_incl, int a_max_excl, int a_step_size, int a_norm_min_incl, int a_norm_max_excl)
Constructor
void MoveVegConstInit(void)
Part of movement evaluation.
int MoveSelect(void)
Part of movement evaluation.
void KillChicks(int percent)
Kill a proportion of the chicks.
int CoveyDensity(int x, int y, int radius)
Unused.
void MoveOptimalDirectionSlow(int a_x, int a_y)
Choose best foraging direction.
bool NestGoodSpot(int a_x, int a_y)
Evaluate x,y as a nest location.
int GetmaxAllowedMove()
Return the max possible move distance today.
bool m_assess_done
Have assessed habitat quality?
bool DelCovey(Partridge_Covey *a_covey)
Remove a covey.
Partridge_Female * FindMateInArea(int a_max_distance)
Find mate in area.
void MoveOptimalDirectionFast(int a_x, int a_y)
Choose best foraging direction (wrap around)
Partridge_Male * m_theDad
Pointer to the alpha female.
bool NestNearBadAreas(int a_x, int a__y)
Test for proximity to unacceptable areas.
The landscape class containing all environmental and topographical data.
bool AllFlocking()
Debug method.
Partridge_Population_Manager * m_manager
Covey's population manager.
void ManagerRethinkPos(void)
bool TooClose()
Test for another covey too close.
void Tick(void)
Do the covey management for the time-step.
double m_par_force_ignore_below
Minimum interesting force.
bool NestBadArea(int a_x, int a__y)
Nest location evaluation function.
bool NestNearNests(int a_x, int a_y, int a_min_dist_sq)
Nest location evaluation function.
double m_terr_qual
Homerange evaluation score
int m_move_get_size
Internal variable.
double m_move_step_size_inv
Internal variable.
unsigned int XCenter(void)
unsigned int GetCoveySize()
Return the covey size.
int m_neighbourlist_size
Number of coveys close to this covey.
void Setpar_force_ignore_below(double ff)
Set the minimum interesting force.
~ForIterator(void)
Destructor
bool MoveTryExcludeHarder(int a_dist_sq)
Uses the peg force to exclude possible movement directions.
~CoveyManager(void)
Destructor.
void DistanceUpdate2(void)
Updates distance to fixed nearest covey.
Partridge_Object
Partridge object types.
double HabitatEvaluateSlow(int a_min_x_incl, int a_max_x_excl, int a_min_y_incl, int a_max_y_excl)
double SupplyHabitatQuality()
Return habitat quality at our location.
The base class for all ALMaSS animal classes.
The collective for a family of partridges
double m_nearest_covey_dist
Closest covey distance
void Step(void)
Covey Step.
unsigned int m_members_size
Size of covey
Partridge_Female * FindMeAWife(Partridge_Male *a_male)
Find mate in covey.
int MoveWeighDirection(int a_x, int a_y)
Weighted foraging walk.
void SetFixed(bool a_is_fixed)
Prevent/enable peg drift.
int m_center_x
Covey centre.
double m_flyto_ts
costly intermediate variable
int m_move_qual_hist[4][MOVE_QUAL_HIST_SIZE]
Internal variable.
bool NestBadAreasScanSlow(int a_min_x, int a_min_y, int a_length, int a_x, int a_y)
Nest location evaluation function.
int m_assess_size
Current homerange assessment radius.
unsigned int YCenter(void)
unsigned int m_id
Unique ID no-
void CoveyIndividualEmigrate()
Test for individuals from covey emigrating.
Partridge_Object GetObjectType(void)
Return object type.
void SetCoveyDissolveDate(int date)
Set the dissolve date.
void ChickExtraMortality()
Apply extra chick mortality.
bool FlyTo(int a_distance)
Fly to
double m_food_today
Food collected.
int m_covey_y
Covey y-coord.
void MoveQualMemory(int a_qual)
Make a move based on memory of quality.
bool FlyToFast(int a_distance)
Move a_distance from current covey position.
Partridge_Female * GetUnpairedFemale()
Finds the first unpaired female in the covey.
bool m_move_done
Have moved?
double BroodGeoMean()
Calculate the geometric mean of no of chicks.
int m_move_step_size
Internal variable.
void SetChickAge(int age)
Set chick age.
void SanityCheck()
Debug method.
bool NestOnNest(void)
Are we nesting?
int m_ChickAge
Age of chicks.
bool NestFindLocation(void)
Try to locate a suitable nesting location.
void SanityCheck2(int no_chicks)
Debug method.
double AssessHabitatQuality(int &a_sz)
Assess habitat quality (with checks)
Partridge_Covey(Partridge_Base *a_first_member, Partridge_Population_Manager *a_manager, unsigned int a_center_x, unsigned int a_center_y, Landscape *a_map)
Constructor.
double HabitatEvalPoly(TTypesOfLandscapeElement a_cet, int a_poly)
bool IsMember(Partridge_Base *a_possible_member)
void FixHabitat(void)
Accept this breeding location.
bool FlyToSlow(int a_distance)
Move a_distance from current covey position (wraparound)
bool m_nest_on_nest
Nesting flag.
double DistanceToCovey(Partridge_Covey *a_covey)
Get distance too covey.
double m_dist_moved
Distance moved.
void ManagerCheckMerge(void)
int m_world_height_div2
Half landscape height.
int m_terr_size
Homerange width.
void SetUncle()
Swap uncle to alhpha.
bool MoveTryExclude(int a_dist_sq)
Uses the peg force to exclude possible movement directions.
int m_move_qual_memory[4]
Steps remembered.
int NestGetY(void)
Return nest y-coord.
double m_new_center_x_float
Covey centre as float.
int m_nest_y
Nest coord-y.
int GetUncleNumber()
Returns the number of uncles.
void SanityCheck4()
Debug method.
void AddMember(Partridge_Base *a_new_member)
int GetLimit(void)
Get how many points
bool CoveyEmigrate()
Test for covey emigration.
bool m_peg_is_fixed
flag for fixed homerange
double HabitatEvaluateFaster(int a_center_x, int a_center_y)
Evaluate habitat fast.
int m_move_whence_we_came
Internal variable.
void OntheDadDead()
Behaviour when alpha male is killed.
Partridge_Base * m_members[100]
List of covey members
double SupplyFoodToday(void)
Return the food obtained today.
bool HaveWeChicks(void)
Check if covey contains chicks.
int m_flyto_dist
costly intermediate variable
bool ArePaired()
Debug method.
Landscape * m_map
Pointer to the landscape.
bool IsFixed(void)
Wonder whether the peg is fixed?
Partridge_Female * GetUnpairedFemale_virgin()
Finds the first never paired female in the covey.
double HabitatEvaluate(int a_center_x, int a_center_y, int *a_size_used, bool a_rethink_size)
Entry point for habitat evaluation.
double MoveDoIt(int *a_x, int *a_y, int a_dir, int a_step_size)
We know where we want to go. Now do it!
void KillExcessChicks(int remaining)
Kill extra chicks.
void AddCovey(Partridge_Covey *a_covey)
Add a new covey.
void SanityCheck1()
A debug function.
bool CanWeMerge(int a_NoUncles)
Merging test.
int HabitatEvalPolyField(int a_field)
Evaluate a field's habitat quality.
Partridge_Covey * m_neighbourlist[50]
List of coveys close to this covey.
bool MoveSelectLimit(int a_limit, int a_x, int a_y)
Part of movement evaluation.
void EndStep(void)
Covey EndStep.
int MoveEvalEdgesAndQual(int a_edges, double a_qual)
Move evaluation taking edges into account.
unsigned int Memberships(void)
Get covey size.
virtual ~Partridge_Covey(void)
Destructor.
void OnChickMature()
Remove a matured chick.
bool m_dist_done
Signals distance updating is done for today
int m_nest_x
Nest coord-x.
bool m_terr_done
Signals homerange evaluation done
Partridge_Male * FindMeAHusband(Partridge_Female *a_female)
Find mate in covey.
int Norm(int a_coord, int a_size)
Wrap-around utility function.
bool m_step_done
Signals Step is done for today
void NestLeave(void)
Leave the nest
class CoveyManager * g_covey_manager
double HabitatEvaluateFast(int a_min_x_incl, int a_max_x_excl, int a_min_y_incl, int a_max_y_excl)
Evaluate habitat (wrap around)
bool m_permanent_marker
Unused
double m_center_y_float
Covey centre as float.
int * GetList(void)
Get pointer to list of points