int Coins = 27;
int playersInput =0;
int counter = 0;
while (Coins >= 0) {
Console.WriteLine("There are " + (Coins - playersInput) + " in the bag" + "\n");
Console.WriteLine("Turn #" + (counter + 1));
playersInput += Convert.ToInt32(Console.ReadLine());
if (playersInput % 2 == 0) {
Console.WriteLine("Player 0 turn");
} else {
Console.WriteLine("Player 1 turn");
}
counter++;
}
Console.WriteLine("The last player lost this game");
代码必须在两个玩家之间交替,如果
coins
价值达到
0
它必须打印
console.writeline
那不在计划之内
while
循环,我不想使用
break
.