$dbTeam['name'], 'players' => [], 'playerRating' => 0, 'expected' => NULL, 'score' => NULL, ]; $teamPlayers = 0; $players = getTeamPlayers($conn, $dbTeam['id']); foreach($players as $player){ $team['players'][] = [ 'ign' => $player['ign'], 'rating' => $player['rating'], 'kfactor' => 40, ]; $team['playerRating'] += $player['rating']; $teamPlayers++; } $team['playerRating'] = $team['playerRating']/$teamPlayers; $teams[] = $team; } //die("Db stuff only"); // Expected result of the match // 1/(1+10^((OpponentRating - Your rating)/400)) // this is for bo1 // TODO: $teams[0]['expected'] = 1 / ( 1 + ( pow( 10 , ( $teams[1]['playerRating'] - $teams[0]['playerRating'] ) / 400 ) ) ); $teams[1]['expected'] = 1 / ( 1 + ( pow( 10 , ( $teams[0]['playerRating'] - $teams[1]['playerRating'] ) / 400 ) ) ); $teams[0]['score'] = 1; $teams[1]['score'] = 0; $t = 1; $i = 1; ?>