kvalue $kArray = array(2100 => 16, 1800 => 24, 0 => 32); $kArrayProvisional = array(2100 => 16, 1800 => 24, 0 => 32); define("ELO_DIVIDE_FACTOR",400); // This number regulates the win expectancy and is a part of the Elo formula. Leave it on 400 in full information games with 0 randomness like chess. Make it 800 or so in games with some more randomness in them. The more randomness, the higher the number should be, but, the higher the number and the more randomness, the more useless the Elo system gets. define("BASE_RATING", 1500); // this is what a new player gets define("MAX_DIFFERENCE", 1000); //1200 is so high this never gets used define("PROVISIONAL", 10); //The number of games it takes to not be provisional anymore define("PROVISIONAL_PROTECTION", 2); //The amount provisional rating is divided by. // Variableis that used to be stored in the database. They have been unified in this one configuration file. $standingsnogames = 0; $pctnum = 0; $hotcoldnum = 5; $gamesmaxday = 30; $gamesmaxdayplayer = 10; $approve = 'no'; $approvegames = 'no'; $system = 'elorating'; $pointswin = 2; $pointsloss = -1; $report = 'winner'; $leaguename = 'Ladder of Wesnoth'; //$copyright = 'powered by: WebLeague'; $copyright = ''; // Config ends here! Don't edit anything beyond this line unless you know what your doing. $latestGameSql = "select name, max(latest_game) as latest_game from ( select name, max(reported_on) as latest_game FROM $playerstable JOIN $gamestable ON (name = winner) WHERE contested_by_loser = 0 AND withdrawn = 0 GROUP BY 1 UNION ALL select name, max(reported_on) as latest_game FROM $playerstable JOIN $gamestable ON (name = loser) WHERE contested_by_loser = 0 AND withdrawn = 0 GROUP BY 1 ) latest_game GROUP BY 1"; // This is the sql used to insert into the standings cache table for speed $cacheSql = "select * from (select a.name, g.reported_on, CASE WHEN g.winner = a.name THEN g.winner_elo ELSE g.loser_elo END as rating, CASE WHEN g.winner = a.name THEN g.winner_wins ELSE g.loser_wins END as wins, CASE WHEN g.winner = a.name THEN g.winner_losses ELSE g.loser_losses END as losses, CASE WHEN g.winner = a.name THEN g.winner_games ELSE g.loser_games END as games, CASE WHEN g.winner = a.name THEN g.winner_streak ELSE g.loser_streak END as streak FROM ($latestGameSql) a JOIN $gamestable g ON (g.reported_on = a.latest_game)) standings "; // This selects the standings against every player $standingsSql = "select * from $standingscachetable join $playerstable USING (name)"; // Apply the restrictions to standings $standingsSqlWithRestrictions = $standingsSql." WHERE reported_on > now() - interval $passivedays day AND rating >= $ladderminelo AND games >= $gamestorank ORDER BY 3 desc, 6 desc"; // variabledb.php used to connect to the database, I've added a temporary hack here to do that in the config file, it should be // moved somewhere more appropriate $db = mysql_connect($databaseserver, $databaseuser, $databasepass); mysql_select_db($databasename,$db); ?>

News