好的,在这个 codepen 中我已经找到了循环赛调度算法:https://codepen.io/Piconey/pen/mwPamw
var players = [
{
playerName: 'Person 1',
},
{
playerName: 'Person 2',
},
{
playerName: 'Person 3',
},
{
playerName: 'Person 4',
},
{
playerName: 'Person 5',
},
{
playerName: 'Person 6',
},
{
playerName: 'Person 7',
},
{
playerName: 'Person 8',
},
{
playerName: 'Person 9',
},
{
playerName: 'Person 10',
},
{
playerName: 'Person 11',
},
{
playerName: 'Person 12',
},
{
playerName: 'Person 13',
},
{
playerName: 'Person 14',
},
{
playerName: 'Person 15',
},
{
playerName: 'Person 16',
},
];
var numberOfRounds = players.length - 1;
function generateRounds() {
for(i = 0; i < numberOfRounds; i++) {
document.write('<h1 class="round">'+'Round ' + (i+1) + '</h1>');
for (var j = 0; j < players.length / 2; j++) {
document.write('<div class="match">' + players[j].playerName + " - " + players[players.length - 1 - j].playerName +'</div>');
}
players.splice(1, 0, players[15]);
players.pop();
}
}
generateRounds();
我用它来快速约会,即使你可以和每个人约会。
我的问题:每轮结束后,新人都可以加入活动或离开活动(如果他们感到无聊;)
注意:迟到者不需要和所有人约会,因为他们已经错过了 x 轮。 注 2:如果很多人离开,最好限制轮数,这样人们就不需要在轮次之间等待那么长时间日期
动漫人物
相关分类