DiscoverTenerife
Static Public Member Functions | Static Private Attributes | List of all members
gameRules Class Reference

This class store as static properties the parameters that affect the game rules. For example it stores the maximum distance to a point to be considered as a valid visit. More...

Static Public Member Functions

static double getMaxDistance ()
 getter of the maxDistance_ static property. More...
 
static double getMinutesOfCooldown ()
 getter of the minutesOfCooldown_ static property. More...
 
static int getMaxPlacesStored ()
 getter of the maxPlacesStored_ static property. More...
 
static long getExpiryTimeForChallenges ()
 getter of the expiryTimeForChallenges_ static property. More...
 
static bool challengeHasExpired (long startTimestamp)
 This method returns true if the current timestamp is bigger than the given timestamp plus the expiryTimeForChallenges static property because if its bigger its means that the expiry time is on the past. More...
 
static int calculateChallengeScore (long startTimestamp, long completationTimestamp, double distanceToUserBase)
 This method calculates the score of a completed challenge using the timestamp of the challenge's begginging, the timestamp of the challenge's completation and the distance in kilometers to the user's base. More...
 
static double getScoreToTheChallenger (double scoreOfChallenged)
 this method returns the score that the challenger should obtain knowing how much score the challenged person earned. More...
 
static double getScoreForVisitingAPlace (int placeVisits, int maxVisits, bool newVisit=false)
 This method calculates the score that the current user has to earn when he visits a place. For calculating the score it needs the visits of that place, the number of visits of the most visited place and it also needs if the user has already visit that place or not. The score will be higher if the user visits a new place than if the user visits a place that he has already visited it. The score will be proportional to the number of visits that place has compared to the most visited place. More...
 
static string calculateRange (int score)
 This method returns the name of the range that the user should be. To calculate the user range it uses the user's score. If the score is a negative number it will return the empty string. More...
 
static int getIndexOfRange (string range)
 This method returns the correspondent index of the given range name, if the given string isnt any defined range, it will return -1. More...
 
static string getAnonymousName ()
 

Static Private Attributes

static double maxDistance_ = 0.05
 double this static property stores the maximum distance between the player and an interesting point to be considerer as a visit. It is represented on kilometers, its default is 50m which is 0.05km More...
 
static double minutesOfCooldown_ = 60
 contains the time in minutes that a player has to wait to visit again a place. Its default value is 60 minutes. More...
 
static int maxPlacesStored_ = 5
 contains the maximum number of places that you can store in the pocket for internetless visits. Its default value is 5. More...
 
static long expiryTimeForChallenges_ = 6048000000000
 contains the time that challenges stay active until they expire. Its default value is 7 days. More...
 
static double scoreToTheChallenger_ = 0.1d
 proportion of points that challenger should get when other user completes his challenges. More...
 
static double baseBonusNewVisit_ = 15.0d
 points that the user will receive as minimum for visiting a new place. More...
 
static double baseBonusVisit_ = 10.0d
 points that the user will receive as minimum for visiting a place that he has already visited. More...
 
static Dictionary< string, int > ranges_
 Dictionary that contains the names of the ranges and the minimum score that a user have to has to be considered of that range. They have to be sorted as higher ranger first. More...
 

Detailed Description

This class store as static properties the parameters that affect the game rules. For example it stores the maximum distance to a point to be considered as a valid visit.

Member Function Documentation

◆ calculateChallengeScore()

static int gameRules.calculateChallengeScore ( long  startTimestamp,
long  completationTimestamp,
double  distanceToUserBase 
)
static

This method calculates the score of a completed challenge using the timestamp of the challenge's begginging, the timestamp of the challenge's completation and the distance in kilometers to the user's base.

Parameters
longtimestamp of the begginging of the challenge.
longtimestamp of the completation of the challenge.
doubledistance in kms to the user.
Returns
int score of the completed challenge.

◆ calculateRange()

static string gameRules.calculateRange ( int  score)
static

This method returns the name of the range that the user should be. To calculate the user range it uses the user's score. If the score is a negative number it will return the empty string.

Parameters
intwith the user's score.
Returns
string with the current user range name.

◆ challengeHasExpired()

static bool gameRules.challengeHasExpired ( long  startTimestamp)
static

This method returns true if the current timestamp is bigger than the given timestamp plus the expiryTimeForChallenges static property because if its bigger its means that the expiry time is on the past.

Parameters
longwith the timestamp when the challenge was started.
Returns
bool true if the challenge that started on the given timestmap has already expired, false in other case.

◆ getAnonymousName()

static string gameRules.getAnonymousName ( )
static
Returns
string with the name defined for anonymous users

◆ getExpiryTimeForChallenges()

static long gameRules.getExpiryTimeForChallenges ( )
static

getter of the expiryTimeForChallenges_ static property.

Returns
the time that challenges stay active until they expire.

◆ getIndexOfRange()

static int gameRules.getIndexOfRange ( string  range)
static

This method returns the correspondent index of the given range name, if the given string isnt any defined range, it will return -1.

Parameters
stringsearched range name
Returns
int with the index of the correspondent range

◆ getMaxDistance()

static double gameRules.getMaxDistance ( )
static

getter of the maxDistance_ static property.

Returns
double that contains the maximum distance in kilometers to decide if a player is too far away from an interesting point to visit that point.

◆ getMaxPlacesStored()

static int gameRules.getMaxPlacesStored ( )
static

getter of the maxPlacesStored_ static property.

Returns
the maximum number of places that you can store in the pocket for internetless visits.

◆ getMinutesOfCooldown()

static double gameRules.getMinutesOfCooldown ( )
static

getter of the minutesOfCooldown_ static property.

Returns
double that contains the time in minutes that a player has to wait to visit again a place.

◆ getScoreForVisitingAPlace()

static double gameRules.getScoreForVisitingAPlace ( int  placeVisits,
int  maxVisits,
bool  newVisit = false 
)
static

This method calculates the score that the current user has to earn when he visits a place. For calculating the score it needs the visits of that place, the number of visits of the most visited place and it also needs if the user has already visit that place or not. The score will be higher if the user visits a new place than if the user visits a place that he has already visited it. The score will be proportional to the number of visits that place has compared to the most visited place.

Parameters
intnumber of visits of the visited place.
intnumber of visits of the most visited place.
booltrue if the user never has visited that place. Its default value is false.
Returns
double score that should earn the current user.

◆ getScoreToTheChallenger()

static double gameRules.getScoreToTheChallenger ( double  scoreOfChallenged)
static

this method returns the score that the challenger should obtain knowing how much score the challenged person earned.

Parameters
doublethat is the score that earned the challenged person.
Returns
double with scored that the challenger should earn.

Member Data Documentation

◆ baseBonusNewVisit_

double gameRules.baseBonusNewVisit_ = 15.0d
staticprivate

points that the user will receive as minimum for visiting a new place.

◆ baseBonusVisit_

double gameRules.baseBonusVisit_ = 10.0d
staticprivate

points that the user will receive as minimum for visiting a place that he has already visited.

◆ expiryTimeForChallenges_

long gameRules.expiryTimeForChallenges_ = 6048000000000
staticprivate

contains the time that challenges stay active until they expire. Its default value is 7 days.

◆ maxDistance_

double gameRules.maxDistance_ = 0.05
staticprivate

double this static property stores the maximum distance between the player and an interesting point to be considerer as a visit. It is represented on kilometers, its default is 50m which is 0.05km

◆ maxPlacesStored_

int gameRules.maxPlacesStored_ = 5
staticprivate

contains the maximum number of places that you can store in the pocket for internetless visits. Its default value is 5.

◆ minutesOfCooldown_

double gameRules.minutesOfCooldown_ = 60
staticprivate

contains the time in minutes that a player has to wait to visit again a place. Its default value is 60 minutes.

◆ ranges_

Dictionary<string,int> gameRules.ranges_
staticprivate
Initial value:
= new Dictionary<string,int>(){
{"Mencey", 50000},
{"Achimencey", 10000},
{"Guañameñe", 3000},
{"Tagorero", 1500},
{"Sigoñes", 750},
{"Cichiciquitzos", 300},
{"Achicaxna", 100},
{"Achicaxnais", 0},
}

Dictionary that contains the names of the ranges and the minimum score that a user have to has to be considered of that range. They have to be sorted as higher ranger first.

◆ scoreToTheChallenger_

double gameRules.scoreToTheChallenger_ = 0.1d
staticprivate

proportion of points that challenger should get when other user completes his challenges.


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