Skip to content

Commit

Permalink
Re-add COIL
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Jul 20, 2024
1 parent 8f483ef commit aeb6815
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
8 changes: 7 additions & 1 deletion play.pokemonshowdown.com/js/client-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@
buffer += '</table></div>';
return self.add('|raw|' + buffer);
}
buffer += '<tr><th>Format</th><th><abbr title="Elo rating">Elo</abbr></th><th><abbr title="user\'s percentage chance of winning a random battle (aka GLIXARE)">GXE</abbr></th><th><abbr title="Glicko-1 rating: rating±deviation">Glicko-1</abbr></th><th>W</th><th>L</th><th>Total</th></tr>';
buffer += '<tr><th>Format</th><th><abbr title="Elo rating">Elo</abbr></th><th><abbr title="user\'s percentage chance of winning a random battle (aka GLIXARE)">GXE</abbr></th><th><abbr title="Glicko-1 rating: rating±deviation">Glicko-1</abbr></th><th>COIL</th><th>W</th><th>L</th><th>Total</th></tr>';

var hiddenFormats = [];
for (var i = 0; i < data.length; i++) {
Expand Down Expand Up @@ -969,6 +969,12 @@
buffer += '<td><em>' + Math.round(row.rpr) + '<small> &#177; ' + Math.round(row.rprd) + '</small></em></td>';
}
var N = parseInt(row.w, 10) + parseInt(row.l, 10) + parseInt(row.t, 10);
var COIL_B = LadderRoom.COIL_B[formatId];
if (COIL_B) {
buffer += '<td>' + Math.round(40.0 * parseFloat(row.gxe) * Math.pow(2.0, -COIL_B / N), 0) + '</td>';
} else {
buffer += '<td>--</td>';
}
buffer += '<td>' + row.w + '</td><td>' + row.l + '</td><td>' + N + '</td></tr>';
}
if (hiddenFormats.length) {
Expand Down
5 changes: 4 additions & 1 deletion play.pokemonshowdown.com/js/client-ladder.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@
showHelp: function () {
var buf = '<div class="ladder pad"><p><button name="selectFormat"><i class="fa fa-chevron-left"></i> Format List</button></p>';
buf += '<h3>How the ladder works</h3>';
buf += '<p>Our ladder displays three ratings: Elo, GXE, and Glicko-1.</p>';
buf += '<p>Our ladder displays four ratings: Elo, GXE, Glicko-1, and COIL.</p>';
buf += '<p><strong>Elo</strong> is the main ladder rating. It\'s a pretty normal ladder rating: goes up when you win and down when you lose.</p>';
buf += '<p><strong>GXE</strong> (Glicko X-Act Estimate) is an estimate of your win chance against an average ladder player.</p>';
buf += '<p><strong>Glicko-1</strong> is a different rating system. It has rating and deviation values.</p>';
buf += '<p><strong>COIL</strong> (Converging Order Invariant Ladder) is mainly used for suspect tests. It goes up as you play games, but not too many games.</p>';
buf += '<p>Note that win/loss should not be used to estimate skill, since who you play against is much more important than how many times you win or lose. Our other stats like Elo and GXE are much better for estimating skill.</p>';
buf += '</div>';
this.$el.html(buf);
Expand All @@ -194,6 +195,8 @@
this.$('button[name=refresh]').addClass('disabled').prop('disabled', true);
this.update();
}
}, {
COIL_B: {},
});

}).call(this, jQuery);
5 changes: 5 additions & 0 deletions play.pokemonshowdown.com/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ function toId() {
Object.assign(Config.customcolors, data);
});

// get coil values too
$.get('/config/coil.json', {}, function (data) {
Object.assign(LadderRoom.COIL_B, data);
});

this.initializeConnection();
},
/**
Expand Down
15 changes: 15 additions & 0 deletions play.pokemonshowdown.com/ladder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<table>
<tr>
<th></th><th>Name</th><th><abbr title="Elo rating">Elo</abbr></th><th><abbr title="user's percentage chance of winning a random battle (aka GLIXARE)">GXE</abbr></th><th><abbr title="Glicko-1 rating system: rating&#177;deviation (provisional if deviation>100)">Glicko-1</abbr></th>
<th>COIL</th>
</tr>
<?php

Expand All @@ -44,6 +45,20 @@
<tr<?php /* if (floatval($row['rprd']) > 100) echo ' style="color:#999"'; */ ?>>
<td><?php echo $i; ?></td><td><?php echo htmlspecialchars($row['username']); ?></td><td><strong><?php echo round($row['elo']); ?></strong></td><td><?php echo ($row['rprd'] < 100 ? number_format($row['gxe'],1) . '<small>%</small>' : '&ndash;'); ?></td>
<td><?php echo '<em>'.round($row['rpr']).'<small> &#177; '.round($row['rprd']).'</small></em>'; /* if (floatval($row['rprd']) > 100) echo ' <small>(provisional)</small>'; */ ?></td>
<td>
<?php if ($row['formatid'] == 'gen7oususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-17.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7uususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-20.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7rususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-9.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7nususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-9.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7pususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-9.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7lcsuspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-13.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7monotypesuspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-9.0/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7doublesoususpecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-14.5/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7balancedhackmonssuspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-11/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen71v1suspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-20/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7mixandmegasuspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-10.5/$N) : 0,1,'.','');
elseif ($row['formatid'] == 'gen7almostanyabilitysuspecttest') echo number_format($N ? 40*$row['gxe']*pow(2.0,-6.0/$N) : 0,1,'.','');
else echo '--'; ?></td>

This comment has been minimized.

Copy link
@Zarel

Zarel Jul 20, 2024

Member

This should probably just use coil.json instead of needing to reimplement all of this.

This comment has been minimized.

Copy link
@Zarel

Zarel Jul 20, 2024

Member

json_parse(file_get_contents(...))

</tr>
<?php
}
Expand Down

0 comments on commit aeb6815

Please sign in to comment.