Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added 1v1 and 5v5 to tests

  • Loading branch information...
commit 45141eeb299bdc05a8c718c44a2bd181a3861e75 1 parent 035d314
@RobKohr authored
Showing with 15 additions and 3 deletions.
  1. +2 −0  index.html
  2. +13 −3 tests.js
View
2  index.html
@@ -18,6 +18,8 @@
<input type="button" value="basic test (from paper example)" onclick="basicTest();">
<input type="button" value="team match" onclick="teamTest();">
<input type="button" value="team simulate" onclick="teamSimulate();">
+<input type="button" value="1v1 simulate" onclick="oneVSOneSimulate();">
+<input type="button" value="5v5 simulate" onclick="fiveVSFiveSimulate();">
</div>
<h4>Output</h4>
View
16 tests.js
@@ -48,12 +48,22 @@ var teamTest = function(){
out(filterObjectArray(result.players, ['last_result', 'name']));
}
-var teamSimulate = function(){
+var oneVSOneSimulate = function(){
+ teamSimulate(1);
+}
+
+var fiveVSFiveSimulate = function(){
+ teamSimulate(5);
+}
+
+var teamSimulate = function(team_size){
+ if(!team_size)
+ team_size = 2;
outClear();
out("Description");
out("Creates 10 players with skills 1-10. The sum of two players on the team is the team's skill");
out("This will run until the ratings of all of the players are ordered the same as their skill");
- out("Matches are random pairings of 2 vs 2");
+ out("Matches are random pairings of "+team_size+" vs "+team_size);
var players = [];
for(var i = 1; i<=10; i++){
var player = {name:i+'', expected_rank:i};
@@ -75,7 +85,7 @@ var teamSimulate = function(){
var team = {rank:0};
team.players = [];
- for(var p = 0; p<=1; p++){
+ for(var p = 0; p<team_size; p++){
var player = shuffledPlayers[i];
i++;
team.rank+=player.expected_rank;
Please sign in to comment.
Something went wrong with that request. Please try again.