Get estimate points

@param EloPlayerInterface $player

@return integer
975698
private function estimateRange(EloPlayerInterface $player)
    {
        $baseRange = new ArrayCollection($this->configuration->getBaseRange());
        $keys = array_keys($this->configuration->getBaseRange());
        $estimatedRange = $baseRange->first();

        $i = 0;
        foreach ($baseRange as $eloMin => $range) {
            if (!isset($keys[$i +1]) && $player->getElo() > $baseRange->last()) {
                $estimatedRange = $baseRange->last();
                break;
            }

            if ($player->getElo() >= $eloMin && isset($keys[$i +1]) && $player->getElo() <= $keys[$i +1]) {
                $estimatedRange = $range;
                break;
            }

            $i++;
        }

        return $estimatedRange;
    }
1308862
public function giveButtonToPlayer(PlayerContract $player)
    {
        $playerIndex = $this->playersSatDown()
            ->filter
            ->equals($player)
            ->keys()
            ->first();

        if ($playerIndex === null) {
            throw TableException::invalidButtonPosition();
        }

        $this->button = $playerIndex;
    }
253788
public function canPayToPlay($game, $user)
    {
        // Is there a limitation on the game ?
        $cost = $game->getCostToPlay();
        if ($cost && $cost > 0) {
            $availableAmount = $this->getEventManager()->trigger(
                'leaderboardUserTotal',
                $this,
                [
                    'user' => $user,
                ]
            )->last();
            if ($availableAmount && $availableAmount >= $cost) {
                return true;
            }
        } else {
            return true;
        }

        return false;
    }
1059849
public function createPlayer(PlayerInfo $playerInfo, PlayerDetailedInfo $playerDetailedInfo)
    {
        $class = $this->class;
        $player = new $class();

        $player->merge($playerInfo);
        $player->merge($playerDetailedInfo);

        return $player;
    }
318240
public function getPlayerPosition($login)
    {
        return isset($this->positionPerPlayer[$login]) ? $this->positionPerPlayer[$login] : null;
    }
158203
public function getPointOnSurface(): Point {
        $event = new ProcessOpEvent($this);
        $this->fireOperationEvent(ProcessOpEvent::POINT_ON_SURFACE_EVENT, $event);
        return $event->getResults();
    }
1149830
public function playerHand(PlayerContract $player): Hand
    {
        $hand = $this->hands()->findByPlayer($player);

        if ($hand === null) {
            throw RoundException::playerHasNoHand($player);
        }

        return $hand;
    }
1350087
public function getNumberOfEntries($game = null)
    {
        $em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
        $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
        $rsm->addScalarResult('c', 'c');
        if ($game !== null) {
            $query = $em->createNativeQuery('
                SELECT COUNT(e.id) AS c
                FROM game_entry e
                WHERE e.game_id = '.((int) $game).'
            ', $rsm);
        } else {
            $query = $em->createNativeQuery('
                SELECT COUNT(e.id) AS c
                FROM game_entry e
            ', $rsm);
        }
        $count = $query->getSingleScalarResult();
        return $count;
    }
747522
public function storeRemainingSeeds($player)
    {
        for ($i = 0; $i < 6; $i++) {
            $this->grid[$player]['attic'] += $this->grid[0]['seeds'][$i];
            $this->grid[0]['seeds'][$i] = 0;

            $this->grid[$player]['attic'] += $this->grid[1]['seeds'][$i];
            $this->grid[1]['seeds'][$i] = 0;
        }

        return $this;
    }
660621
public function getWinner()
    {
        if (!$this->isGameOver()) {
            return null;
        }

        if ($this->getScore(self::PLAYER_0) === $this->getScore(self::PLAYER_1)) {
            return self::DRAW;
        } elseif ($this->getScore(self::PLAYER_0) > $this->getScore(self::PLAYER_1)) {
            return self::PLAYER_0;
        } else {
            return self::PLAYER_1;
        }
    }
618991
public function estimateBitStreamSize($version)
    {
        $bits = 0;

        foreach($this->items as $item) {
            $bits += $item->estimateBitStreamSizeOfEntry($version);
        }

        return $bits;
    }
1275550
public function getTotal($user, $type = '', $count = 'points')
    {
        $em = $this->serviceLocator->get('playgroundflow_doctrine_em');

        if ($count == 'points') {
            $aggregate = 'SUM(e.points)';
        } elseif ($count == 'count') {
            $aggregate = 'COUNT(e.id)';
        }

        switch ($type) {
            case 'game':
                $filter = array(12);
                break;
            case 'user':
                $filter = array(1,4,5,6,7,8,9,10,11);
                break;
            case 'newsletter':
                $filter = array(2,3);
                break;
            case 'sponsorship':
                $filter = array(20);
                break;
            case 'social':
                $filter = array(13,14,15,16,17);
                break;
            case 'quizAnswer':
                $filter = array(30);
                break;
            case 'badgesBronze':
                $filter = array(100);
                break;
            case 'badgesSilver':
                $filter = array(101);
                break;
            case 'badgesGold':
                $filter = array(102);
                break;
            case 'anniversary':
                $filter = array(25);
                break;
            default:
                $filter = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,25,100,101,102,103);
        }

        $query = $em->createQuery('SELECT ' . $aggregate . ' FROM PlaygroundFlow\Entity\Event e WHERE e.user = :user AND e.actionId in (?1)');
        $query->setParameter('user', $user);
        $query->setParameter(1, $filter);
        $total = $query->getSingleScalarResult();

        return $total;
    }
309340
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getMapuid();
                break;
            case 2:
                return $this->getNblaps();
                break;
            case 3:
                return $this->getScore();
                break;
            case 4:
                return $this->getNbfinish();
                break;
            case 5:
                return $this->getAvgscore();
                break;
            case 6:
                return $this->getCheckpoints();
                break;
            case 7:
                return $this->getPlayerId();
                break;
            case 8:
                return $this->getCreatedAt();
                break;
            case 9:
                return $this->getUpdatedAt();
                break;
            default:
                return null;
                break;
        } // switch()
    }
851581
public function play($game, $user, &$error = null)
    {
        //some entries can stay open during days.
        // The player can take back the entry to go on playing
        // like in a postvote or for quizzes
        // We create also an entry before the game when an optin is needed
        $entry = $this->checkExistingEntry($game, $user, true);

        // If the game needs an optin and the player has not opted in
        if ($entry && $game->getTermsOptin() && !$entry->getTermsOptin()) {
            $error = -2;
            return false;
        }

        // If the game has a cost and the player has not paid yet
        // (this case occurs when the entry has been created by the termsOptin
        // and the game has a price to play)
        if ($entry && !$entry->getPaid() && $game->getCostToPlay() > 0) {
            if (!$this->payToPlay($game, $user, $entry)) {
                $error = -3;
                return false;
            } else {
                $entry->setPaid(1);
                $entry->setPaidAmount($game->getCostToPlay());
                $entry = $this->getEntryMapper()->update($entry);
            }
        }

        if (! $entry) {
            // Play limit reached
            if ($this->hasReachedPlayLimit($game, $user)) {
                $error = -1;
                return false;
            }
            // Can't pay for the game
            if (!$this->canPayToPlay($game, $user)) {
                $error = -3;
                return false;
            }
            // Terms optin not checked
            if ($game->getTermsOptin()) {
                $error = -2;
                return false;
            }

            $ip = $this->getIp();
            $geoloc = $this->getGeoloc($ip);
            $entry = new Entry();
            $entry->setGame($game);
            $entry->setUser($user);
            $entry->setPoints(0);
            $entry->setIp($ip);
            $entry->setGeoloc($geoloc);
            $entry->setAnonymousId($this->getAnonymousId());
            
            if ($this->getAnonymousIdentifier()) {
                $entry->setAnonymousIdentifier($this->getAnonymousIdentifier());
            }
            if ($game->getCostToPlay() === 0) {
                $entry->setPaid(true);
                $entry = $this->getEntryMapper()->insert($entry);
                $this->getEventManager()->trigger(
                    __FUNCTION__ . '.post',
                    $this,
                    [
                        'user' => $user,
                        'game' => $game,
                        'entry' => $entry,
                    ]
                );
            } else {
                $entry = $this->getEntryMapper()->insert($entry);
                $entryPaid = $this->payToPlay($game, $user, $entry);
                if ($entryPaid) {
                    $entry = $this->getEntryMapper()->update($entryPaid);
                    $this->getEventManager()->trigger(
                        __FUNCTION__ . '.post',
                        $this,
                        [
                            'user' => $user,
                            'game' => $game,
                            'entry' => $entry,
                        ]
                    );
                } else {
                    $entry->setActive(false);
                    $entry = $this->getEntryMapper()->update($entry);
                    $error = -3;
                    return false;
                }
            }
        }

        return $entry;
    }
1319961
private function predictEndpoint()
    {
        return static function (callable $handler) {
            return function (
                CommandInterface $command,
                RequestInterface $request = null
            ) use ($handler) {
                if ($command->getName() === 'Predict') {
                    $request = $request->withUri(new Uri($command['PredictEndpoint']));
                }
                return $handler($command, $request);
            };
        };
    }
119561
public function findPlayerByName($playerName): Player
    {
        return $this->players()
            ->filter(function (Player $player) use ($playerName) {
                return $player->name() === $playerName;
            })
            ->first();
    }
116758
function getKarma($circle, $player)
	{
		if(!$circle)
		{
			throw new Exception('Invalid circle');
		}
		if(!$player)
		{
			throw new Exception('Invalid player');
		}
		
		return $this->execute('GET', '/trust/%s/karma/%s/', array($circle, $player));
	}