public static double tripleBet(Dice dice, double betAmount) {
double payout = 0.0;
double three_rolled = 3;
if (dice.getFirst() == dice.getSecond() && dice.getThird() == dice.getFirst()) {
payout = betAmount * three_rolled;
} else {
payout = -betAmount;
}
return payout;
}
在这里,我正在比较一款名为“幸运”的游戏中的死亡情况。如果玩家下注,所有骰子都相同,那么我只需要简单地返回一个支付金额。
我主要关注条件陈述中的表达。我想知道这样写是否有效或“好的做法”。
慕桂英546537
RISEBY
胡说叔叔
相关分类