From 116965fcdc1d2e979f2bb2680b4a68528197f7ab Mon Sep 17 00:00:00 2001 From: Nick Winter <livelily@gmail.com> Date: Mon, 19 May 2014 19:13:16 -0700 Subject: [PATCH] Rules wording tweaks; highlighting new matches and end of ranking with sounds. --- app/locale/en.coffee | 1 + app/styles/play/ladder/ladder.sass | 8 ---- app/styles/play/ladder/my_matches_tab.sass | 11 ++++- .../play/common/ladder_submission.jade | 2 +- app/templates/play/ladder/ladder.jade | 42 +++++++++++++------ app/templates/play/ladder/my_matches_tab.jade | 2 +- app/views/play/ladder/ladder_view.coffee | 2 + app/views/play/ladder/my_matches_tab.coffee | 13 +++++- 8 files changed, 56 insertions(+), 25 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 04fcf24b6..c5e79f30d 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -680,6 +680,7 @@ fight: "Fight!" watch_victory: "Watch your victory" defeat_the: "Defeat the" + tournament_rules: "Tournament Rules" ladder_prizes: title: "Tournament Prizes" diff --git a/app/styles/play/ladder/ladder.sass b/app/styles/play/ladder/ladder.sass index 039bac4e7..cdd68a6d3 100644 --- a/app/styles/play/ladder/ladder.sass +++ b/app/styles/play/ladder/ladder.sass @@ -63,14 +63,6 @@ td padding: 1px 2px - tr.stale - opacity: 0.5 - - tr.win .state-cell - color: #172 - tr.loss .state-cell - color: #712 - #must-log-in button margin-right: 10px diff --git a/app/styles/play/ladder/my_matches_tab.sass b/app/styles/play/ladder/my_matches_tab.sass index a68f12225..66b03d72b 100644 --- a/app/styles/play/ladder/my_matches_tab.sass +++ b/app/styles/play/ladder/my_matches_tab.sass @@ -26,4 +26,13 @@ fill: #555555 shape-rendering: crispEdges - \ No newline at end of file + tr.fresh + background-color: #39F + tr.stale + opacity: 0.5 + tr.win .state-cell + color: #172 + tr.loss .state-cell + color: #712 + + diff --git a/app/templates/play/common/ladder_submission.jade b/app/templates/play/common/ladder_submission.jade index 0bb644b00..5ff0e82cb 100644 --- a/app/templates/play/common/ladder_submission.jade +++ b/app/templates/play/common/ladder_submission.jade @@ -1,4 +1,4 @@ -button.btn.btn-success.rank-button +button.btn.btn-lg.btn-success.rank-button span(data-i18n="ladder.rank_no_code").unavailable.secret No New Code to Rank span(data-i18n="ladder.rank_my_game").rank.secret Rank My Game! span(data-i18n="ladder.rank_submitting").submitting.secret Submitting... diff --git a/app/templates/play/ladder/ladder.jade b/app/templates/play/ladder/ladder.jade index f2b19c723..849a11c0d 100644 --- a/app/templates/play/ladder/ladder.jade +++ b/app/templates/play/ladder/ladder.jade @@ -611,46 +611,62 @@ block content td $50 .tab-pane.well#rules - h1(data-i18n="ladder.rules_remember_to_add_i18n_tags") Tournament Rules + h1(data-i18n="ladder.tournament_rules") Tournament Rules h2 General p You don't have to buy anything to participate in the tournament, and trying to pay us won't increase your odds of winning. h2 Dates and Times - p The tournament starts on Tuesday 5/20 at 8:30AM and ends on Tuesday 6/10 at 5:30PM PDT. After the tournament finishes, we will check the games manually to prevent duplicate entries and cheating. We will email all the winners within 2 weeks of the end date. + p The tournament starts on Tuesday, May 20 at 8:30AM and ends on Tuesday, June 10 at 5:00PM PDT. After the tournament finishes, we will check the games manually to prevent duplicate entries and cheating. We will email all the winners within two weeks of the end date. h2 Eligilibity p The tournament is open to anyone over the age of 13. Players are allowed to form teams to compete, but we will only be rewarding submissions, so if a team of 10 wins, they will need to split the prize. + p The tournament is NOT open to people who live in countries or states that prohibit participating or receiving a prize in a challenge (these include, but are not limited to Brazil, Quebec, Italy, Cuba, Sudan, Iran, North Korea, and Syria). Organizations involved in putting the tournament together (namely CodeCombat and all of our employees) are excluded from participating/winning prizes. h2 Submission Requirements - p To be eligible to win prizes, players must submit their code to the Greed ladder for ranking AND defeat our default AI. Every player that submits their code to the ladder and beats our default AI will receive $50 in AWS credits as described on the - a(href="#prizes", data-toggle="tab", data-i18n="ladder.prizes") prizes page. + p + | To be eligible to win prizes, players must submit their code to the Greed ladder for ranking AND defeat our default AI. Every player that submits their code to the ladder and beats our default AI will receive $50 in AWS credits as described on the + a(href="#prizes", data-i18n="ladder_prizes.tournament_prizes") Tournament Prizes + | page. - p There are some restrictions regarding who can use the AWS credits, please see the additional rules of use on + p + | There are some restrictions regarding who can use the AWS credits. Please see the additional rules of use on a(href="https://aws.amazon.com/awscredits") Amazon's AWS credits page. h2 Submission Rights p We reserve the right to use your submission and site identity (including username, avatar, and any information you mark as public) to promote the tournament. This is in keeping with our overall site terms of service. h2 Judging Criteria - p We will award prizes according to player's rank on the leaderboards. We will not be evaluating code in any manual way for common traits like adequate documentation, cleanliness, etc. Although we will run a final check of all submissions to rule out duplicates and cheating, the leaderboards are a good proxy for your final rank. Your rank will change as players submit more solutions. + p + | We will award prizes according to player's rank on the leaderboards. We will not be evaluating code in any manual way for common traits like adequate documentation, cleanliness, etc. We will run a final check of all submissions to rule out duplicates and cheating, so during the tournament, + strong the leaderboards are only a preliminary proxy for your final rank + | . + + p + | Your rank will change as players submit more solutions and more matches are played according to + a(href="https://github.com/codecombat/bayesian-battle") our open-source ranking library, Bayesian Battle + | , but our final ranking may use either the Bayesian Battle rankings or an exhaustive pairwise matching round amongst the top players, where the top n players play the top n players from the opposing leaderboard and rankings are determined by (wins - losses). h2 Prizes - p Prizes will be awarded to everyone that achieves a rank covered on the - a(href="#prizes", data-toggle="tab", data-i18n="ladder.prizes") prizes page. + p + | Prizes will be awarded to everyone that achieves a rank covered on the + a(href="#prizes", data-i18n="ladder.prizes") Tournament Prizes + | page. - p Please remember that the player ranks listed on the prize page refer to ranks WITHIN a leaderboard. So if you are #2 on the Ogre leaderboard, you will get the #2 prize. Similarly, if you are #3 on the Human leaderboard, you will receive the #3 prize. As mentioned above, if you had a submission in the top 10 for both boards, we will only count your highest submission for the purposes of distributing prizes. + p Please remember that the player ranks listed on the prize page refer to ranks WITHIN a leaderboard. So if you are the #2 Ogre player, you will win the #2 prize. Similarly, if you are the #3 Human player, you will receive the #3 prize. If you have submissions on both leaderboards, we will only count your highest submission for the purposes of distributing prizes. As a result, your final ranking may be higher than your preliminary ranking due to removing duplicate submissions above you. h2 Verifying Potential Winners - p We may ask players to identify themselves so that we can detect duplicate entries. This may be done in the form of a Facebook, Google+, or LinkedIn profile, but we may need more information. All players eligible for prizes agree that refusing to provide us with identifying information may lead to removal from the tournament. + p We may ask players to identify themselves so that we can detect duplicate entries. This may be done in the form of a Facebook, Google+, or LinkedIn profile, but we may need more information. All players eligible for prizes agree that refusing to provide us with identifying information may lead to ineligibility for prizes. p On a related note, if we have reason to believe that a player has intentionally submitted duplicate entries for the purpose of receiving more prizes or manipulating the leaderboards in any way, we will remove that player and all submissions we believe to be associated with them. We want this to be fair for everyone. h2 Prize Distribution - p Different sponsors require different ways of claiming their prizes, and we will work with winners to ensure they are able to redeem their prizes in a timely fashion. For cash prizes, we will deliver the money via Paypal. We will not ship checks, money orders, or cash through the mail. We will assume reasonable international money transfer costs to deliver cash prizes through Paypal. + p Different sponsors require different ways of claiming their prizes, and we will work with winners to ensure they are able to redeem their prizes in a timely fashion. For cash prizes, we will deliver the money via PayPal. We will not ship checks, money orders, or cash through the mail. We will assume reasonable international money transfer costs to deliver cash prizes through Paypal. p Winners are responsible for any taxes associated with claiming their prizes. CodeCombat is not responsible for filing paperwork on behalf of winners for tax claims. h2 Contact - p If you have any questions or would like to get in touch with us for any other reason, we can be reached at team@codecombat.com. You can also post to our public - a(href="http://discourse.codecombat.com/") Discourse forum. + p + | If you have any questions or would like to get in touch with us for any other reason, we can be reached at team@codecombat.com. You can also post to our public + a(href="http://discourse.codecombat.com/") Discourse forum + | . diff --git a/app/templates/play/ladder/my_matches_tab.jade b/app/templates/play/ladder/my_matches_tab.jade index c1bc58918..4d91d0757 100644 --- a/app/templates/play/ladder/my_matches_tab.jade +++ b/app/templates/play/ladder/my_matches_tab.jade @@ -30,7 +30,7 @@ div#columns.row th(data-i18n="general.when") When th for match in team.matches - tr(class=(match.stale ? "stale " : "") + match.state) + tr(class=(match.stale ? "stale " : "") + (match.fresh ? "fresh " : "") + match.state) td.state-cell if match.state === 'win' span(data-i18n="general.win").win Win diff --git a/app/views/play/ladder/ladder_view.coffee b/app/views/play/ladder/ladder_view.coffee index 369190d7e..461eb51a8 100644 --- a/app/views/play/ladder/ladder_view.coffee +++ b/app/views/play/ladder/ladder_view.coffee @@ -102,6 +102,8 @@ module.exports = class LadderView extends RootView @showApologeticSignupModal() if link and /#rules$/.test link @$el.find('a[href="#rules"]').tab('show') + if link and /#prizes/.test link + @$el.find('a[href="#prizes"]').tab('show') destroy: -> clearInterval @refreshInterval diff --git a/app/views/play/ladder/my_matches_tab.coffee b/app/views/play/ladder/my_matches_tab.coffee index 9b1a39970..4c76354ac 100644 --- a/app/views/play/ladder/my_matches_tab.coffee +++ b/app/views/play/ladder/my_matches_tab.coffee @@ -13,6 +13,7 @@ module.exports = class MyMatchesTabView extends CocoView constructor: (options, @level, @sessions) -> super(options) @nameMap = {} + @previouslyRankingTeams = {} @refreshMatches() refreshMatches: -> @@ -58,6 +59,9 @@ module.exports = class MyMatchesTabView extends CocoView state = 'win' state = 'loss' if match.metrics.rank > opponent.metrics.rank state = 'tie' if match.metrics.rank is opponent.metrics.rank + fresh = match.date > (new Date(new Date() - 20 * 1000)).toISOString() + if fresh + Backbone.Mediator.publish 'play-sound', trigger: 'chat_received' { state: state opponentName: @nameMap[opponent.userID] @@ -65,6 +69,7 @@ module.exports = class MyMatchesTabView extends CocoView when: moment(match.date).fromNow() sessionID: opponent.sessionID stale: match.date < submitDate + fresh: fresh } for team in @teams @@ -81,6 +86,10 @@ module.exports = class MyMatchesTabView extends CocoView if scoreHistory?.length > 1 team.scoreHistory = scoreHistory + if not team.isRanking and @previouslyRankingTeams[team.id] + Backbone.Mediator.publish 'play-sound', trigger: 'cast-end' + @previouslyRankingTeams[team.id] = team.isRanking + ctx afterRender: -> @@ -91,13 +100,15 @@ module.exports = class MyMatchesTabView extends CocoView session = _.find @sessions.models, {id: sessionID} ladderSubmissionView = new LadderSubmissionView session: session, level: @level @insertSubView ladderSubmissionView, placeholder - ladderSubmissionView.$el.find('.rank-button').addClass 'btn-block btn-lg' + ladderSubmissionView.$el.find('.rank-button').addClass 'btn-block' @$el.find('.score-chart-wrapper').each (i, el) => scoreWrapper = $(el) team = _.find @teams, name: scoreWrapper.data('team-name') @generateScoreLineChart(scoreWrapper.attr('id'), team.scoreHistory, team.name) + @$el.find('tr.fresh').removeClass('fresh', 5000) + generateScoreLineChart: (wrapperID, scoreHistory,teamName) => margin = top: 20