Logo Search packages:      
Sourcecode: vdr-plugin-spider version File versions

int Tableau::points (  ) 

Current count of points

Definition at line 74 of file tableau.c.

{
  int openCard        = 10;
  int openPile        = 15;
  int matchingCard    = 2;
  int readyFinal      = 50;
  int bonusFinal      = 2;
  int bonusfreeFinals = 3;

  int points = openCard * cardsToOpen;
  for (unsigned int p = 0; p < piles.size(); ++p)
  {
    if (piles[p]->count() > piles[p]->open())
      points -= openCard * (piles[p]->count() - piles[p]->open());
    else
      points += openPile;
    points += matchingCard * piles[p]->getMatching();
  }
  int emptyFinals = 0;
  int bonusFinals = 0;
  for (unsigned int f = 0; f < finals.size(); ++f)
    if (finals[f]->empty())
      ++emptyFinals;
    else if (finals[f]->getBonus())
      ++bonusFinals;
  points += readyFinal * (finals.size() - emptyFinals);
  if (emptyFinals == 0 && bonusFinals > bonusfreeFinals)
    points += bonusFinal * (bonusFinals - bonusfreeFinals);
  return points;
}


Generated by  Doxygen 1.6.0   Back to index