mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Added Ace of Coders tournament rankings.
This commit is contained in:
parent
89b9ffae20
commit
afa410a370
3 changed files with 1407 additions and 17 deletions
|
@ -23,7 +23,7 @@ block content
|
|||
p
|
||||
span(data-i18n="ladder.tournament_blurb") Write code, collect gold, build armies, crush foes, win prizes, and upgrade your career in our $40,000 Greed tournament! Check out the details
|
||||
|
|
||||
a(href="http://blog.codecombat.com/multiplayer-programming-tournament", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
a(href="http://blog.codecombat.com/a-31-trillion-390-billion-statement-programming-war-between-545-wizards", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
| .
|
||||
p
|
||||
strong Tournament ended!
|
||||
|
@ -60,7 +60,7 @@ block content
|
|||
p
|
||||
span(data-i18n="ladder.tournament_blurb_criss_cross") Win bids, construct paths, outwit opponents, grab gems, and upgrade your career in our Criss-Cross tournament! Check out the details
|
||||
|
|
||||
a(href="http://blog.codecombat.com/6-programming-languages-one-victor-codecombats-newest-tournament", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
a(href="http://blog.codecombat.com/a-good-new-fashioned-programming-throwdown", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
| .
|
||||
p
|
||||
strong Tournament ended!
|
||||
|
@ -85,7 +85,7 @@ block content
|
|||
p
|
||||
span(data-i18n="ladder.tournament_blurb_zero_sum") Unleash your coding creativity in both gold gathering and battle tactics in this alpine mirror match between red sorcerer and blue sorcerer. The tournament began on Friday, March 27 and will run until Monday, April 6 at 5PM PDT. Compete for fun and glory! Check out the details
|
||||
|
|
||||
a(href="http://blog.codecombat.com/zero-sum", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
a(href="http://blog.codecombat.com/kings-of-zero-sum-strategies-from-the-ai-wars", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
| .
|
||||
p
|
||||
strong Tournament ended!
|
||||
|
@ -109,13 +109,12 @@ block content
|
|||
p
|
||||
span(data-i18n="ladder.tournament_blurb_ace_of_coders") Battle it out in the frozen glacier in this domination-style mirror match! The tournament began on Wednesday, September 16 and will run until Wednesday, October 14 at 5PM PDT. Check out the details
|
||||
|
|
||||
a(href="http://blog.codecombat.com/ace-of-coders-multiplayer-programming-tournament", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
a(href="http://blog.codecombat.com/the-true-ace-of-coders", data-i18n="ladder.tournament_blurb_blog") on our blog
|
||||
| .
|
||||
p
|
||||
strong Tournament ended!
|
||||
// a(href="#winners") Behold the winners
|
||||
// | . Thanks for playing! You can
|
||||
| Thanks for playing! You can
|
||||
a(href="#winners") Behold the winners
|
||||
| . Thanks for playing! You can
|
||||
strong still play
|
||||
| Ace of Coders as long as you like.
|
||||
p
|
||||
|
@ -151,7 +150,7 @@ block content
|
|||
if level.get('name') == 'Greed'
|
||||
li
|
||||
a(href="#rules", data-toggle="tab", data-i18n="ladder.rules") Rules
|
||||
if level.get('name') == 'Greed' || level.get('name') == 'Criss-Cross' || level.get('name') == 'Zero Sum'
|
||||
if level.get('name') == 'Greed' || level.get('name') == 'Criss-Cross' || level.get('name') == 'Zero Sum' || level.get('name') == 'Ace of Coders'
|
||||
li
|
||||
a(href="#winners", data-toggle="tab", data-i18n="ladder.winners") Winners
|
||||
|
||||
|
@ -860,4 +859,33 @@ block content
|
|||
else
|
||||
td
|
||||
td
|
||||
td
|
||||
td
|
||||
|
||||
if level.get('name') == 'Ace of Coders'
|
||||
.tab-pane.well#winners
|
||||
h1(data-i18n="ladder.winners") Winners
|
||||
|
||||
table.table.table-hover.table-condensed
|
||||
thead
|
||||
tr
|
||||
th(data-i18n="ladder_prizes.rank") Rank
|
||||
th
|
||||
th(data-i18n="general.player") Player
|
||||
th Wins
|
||||
th Losses
|
||||
th(data-i18n="play.spectate") Spectate
|
||||
tbody
|
||||
each player in winners.humans
|
||||
tr
|
||||
td= player.rank
|
||||
td.code-language-cell(style="background-image: url(/images/common/code_languages/" + player.codeLanguage + "_icon.png)" title=_.string.capitalize(player.codeLanguage))
|
||||
td= player.name
|
||||
td
|
||||
span.win= player.wins
|
||||
td
|
||||
span.loss= player.losses
|
||||
td
|
||||
if player.team == "ogres"
|
||||
a(href="/play/spectate/" + level.get('slug') + "?session-one=55df8c9207d920b7e4262f33" + "&session-two=" + player.sessionID, data-i18n="ladder.watch_battle") Watch the battle
|
||||
else
|
||||
a(href="/play/spectate/" + level.get('slug') + "?session-one=" + player.sessionID + "&session-two=55e1d23686c019bc47b640fe", data-i18n="ladder.watch_battle") Watch the battle
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -598,6 +598,8 @@ request = require '../../node_modules/request'
|
|||
|
||||
allSessionIDs = {}
|
||||
usernamesBySessionID = {}
|
||||
userIDsBySessionID = {}
|
||||
codeLanguagesByUserID = {}
|
||||
teamNames = ['humans', 'ogres']
|
||||
matchesByTeam = {humans: {}, ogres: {}}
|
||||
# Each object's first keys are first team session IDs, second are alternate teams' session IDs.
|
||||
|
@ -635,7 +637,7 @@ for file in files
|
|||
[sessionsDone, needed] = [0, 0]
|
||||
getName = (sessionID) ->
|
||||
++needed
|
||||
request "http://localhost:3000/db/level.session/#{sessionID}?project=creatorName,creator", (err, resp, body) ->
|
||||
request "http://localhost:3000/db/level.session/#{sessionID}?project=creatorName,creator,submittedCodeLanguage", (err, resp, body) ->
|
||||
if err
|
||||
console.log '\nGot err fetching session', sessionID, err, '-- retrying...'
|
||||
--needed
|
||||
|
@ -648,6 +650,8 @@ getName = (sessionID) ->
|
|||
console.log '\nGot err parsing', session, err, '-- retrying...'
|
||||
return getName sessionID
|
||||
usernamesBySessionID[sessionID] = session.creatorName or session.creator
|
||||
userIDsBySessionID[sessionID] = session.creator
|
||||
codeLanguagesByUserID[session.creator] = session.submittedCodeLanguage
|
||||
if ++sessionsDone is needed
|
||||
console.log ""
|
||||
finish()
|
||||
|
@ -667,7 +671,7 @@ finish = ->
|
|||
sessionCreatorName = usernamesBySessionID[session]
|
||||
otherSessionCreatorName = usernamesBySessionID[otherSession]
|
||||
continue if sessionCreatorName is otherSessionCreatorName
|
||||
teamRankings[team][sessionCreatorName] ?= {wins: 0, losses: 0}
|
||||
teamRankings[team][sessionCreatorName] ?= {wins: 0, losses: 0, sessionID: session}
|
||||
if result is 1
|
||||
++teamRankings[team][sessionCreatorName].wins
|
||||
else
|
||||
|
@ -686,15 +690,25 @@ finish = ->
|
|||
for playerName, teamScore of players
|
||||
player = playersSeenOnlyOnce[playerName]
|
||||
if player
|
||||
player[1] += teamScore.wins
|
||||
player[2] += teamScore.losses
|
||||
player.wins += teamScore.wins
|
||||
player.losses += teamScore.losses
|
||||
delete playersSeenOnlyOnce[playerName]
|
||||
else
|
||||
topPlayers.push [playerName, teamScore.wins, teamScore.losses]
|
||||
userID = userIDsBySessionID[teamScore.sessionID]
|
||||
topPlayers.push {name: playerName, userID: userID, sessionID: teamScore.sessionID, wins: teamScore.wins, losses: teamScore.losses, codeLanguage: codeLanguagesByUserID[userID], team: team}
|
||||
playersSeenOnlyOnce[playerName] = topPlayers[topPlayers.length - 1]
|
||||
|
||||
topPlayers.sort (a, b) -> b[1] - a[1]
|
||||
topPlayers = (p.join('\t') for p in topPlayers)
|
||||
teamCounts = humans: Object.keys(teamRankings.humans).length, ogres: Object.keys(teamRankings.ogres).length
|
||||
console.log '\nPlayers per team:', teamCounts.humans, 'humans,', teamCounts.ogres, 'ogres'
|
||||
|
||||
topPlayers.sort (a, b) ->
|
||||
aScore = 1000 * a.wins - a.losses
|
||||
bScore = 1000 * b.wins - b.losses
|
||||
aScore *= 0.999 + (if a.team is 'ogres' then (teamCounts.ogres / teamCounts.humans) else (teamCounts.humans / teamCounts.ogres)) if a.name of playersSeenOnlyOnce
|
||||
bScore *= 0.999 + (if b.team is 'ogres' then (teamCounts.ogres / teamCounts.humans) else (teamCounts.humans / teamCounts.ogres)) if b.name of playersSeenOnlyOnce
|
||||
return bScore - aScore
|
||||
|
||||
topPlayers = (JSON.stringify(p, null, 0) for p in topPlayers)
|
||||
|
||||
#console.log "Players seen only once:", playersSeenOnlyOnce
|
||||
|
||||
|
|
Loading…
Reference in a new issue