我正在为幻想制作一个草稿应用程序。正因为如此,每10支球队就会向后选择。是否有一种简单的方法来做到这一点,或者我是否需要编写一个长if/ ext、switch、ext语句?
示例:
发布于 2015-08-27 00:54:46
使一个布尔变量存储我们正在递增或递减的天气,然后是一个字节来存储您增加/减少了多少次,并创建一个循环。在布尔值中使用if/else。不要忘记每次翻转布尔值。
发布于 2015-08-27 01:01:45
像这样的应该能完成任务:
var total_picks = 100;
var current_pick = 1;
var current_team = 1;
var my_test = true;
for (var i = 0; i < total_picks; i++) {
// In this "if" statement, the team number will count up from 1 to 10
if (my_test) {
// Do whatever you want to with the current pick here
current_pick++;
// Do whatever you want to with the current team here
current_team++;
if (current_team == 10) {
my_test = false;
}
} else {
// In this "else" statement, the team number will count down from 10 to 1
// Do whatever you want to with the current pick here
current_pick++;
// Do whatever you want to with the current team here
current_team--;
if (current_team == 0) {
my_test = true;
}
}
}
https://stackoverflow.com/questions/32238958
复制相似问题