Здесь я пытаюсь сделать что-то действительно базовое, но мое отсутствие понимания Java вызывает у меня некоторые проблемы.
<code>
double[][] handProbability = new double[][] {{0,0,0},{0,0,0},{0,0,0}};
double[] handProbabilityTotal = new double[] {0,0,0};
double positivePot = 0;
double negativePot = 0;
int localAhead = 0;
int localTied = 1;
int localBehind = 2;
//do some stuff that adds values to handProbability and handProbabilityTotal</p>
<p>positivePot =
(handProbability[localBehind][localAhead] +
(handProbability[localBehind][localTied] / 2.0) +
(handProbability[localTied][localAhead] / 2.0) ) /
(handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0));</p>
<p>negativePot =
(handProbability[localAhead][localBehind] +
(handProbability[localAhead][localTied] / 2.0) +
(handProbability[localTied][localBehind] / 2.0) ) /
(handProbabilityTotal[localAhead] + (handProbabilityTotal[localTied] / 2.0));
Последние две строки вызывают у меня проблемы (извините за их длительность).
Ошибки компилятора:
<code>
src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double[],double
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
^
src/MyPokerClient/MyPokerClient.java:180: operator + cannot be applied to double,
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
^
src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double,
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
Не совсем уверен, в чем проблема. Вам не нужно ничего особенного для базовой математики, верно?