【发布时间】:2018-09-26 18:17:33
【问题描述】:
我正在创建一个二十一点程序。我需要检查if the dealer's hand is greater than the players handand also less then 21.
变量
dValue1 is the dealer's first card
dValue2 is the dealer's second card
pValue1 is the player's first card
pValue2 is the player's second card
我试过这样做:
if(dValue1 + dValue2 > pValue1 + pValue2 && < 21)
但我收到以下错误: 类型不匹配:无法从 int 转换为 boolean。 对于参数类型 boolean、int,运算符 && 未定义。
如果有人可以建议另一种方法来做到这一点,或者如果我只是犯了一个语法错误,我将不胜感激。
澄清:我想检查庄家的牌值是否大于玩家的牌,但也小于 21。
【问题讨论】:
-
可能是
... && dValue1 + dValue2 < 21),但如果您提供minimal reproducible example 包括您使用的语言会有所帮助。
标签: java if-statement blackjack gambling