So, in my constructor (where toWound and toHit are instance variables, declared beforehand):
only the values for where S = T are filled in, the rest stay as 0.0public Mathhammer() { toWound = new double[10][10]; toHit = new double[10][10]; for (int S=0;S<10;S++) { for (int T=0;T<10;T++) { if (S == T) toWound[S][T] = 0.5; if (S < (T-3)) toWound[S][T] = 0; if (S > (T+1)) toWound[S][T] = (5/6); if (S == (T+1)) toWound[S][T] = (2/3); if (S == (T-1)) toWound[S][T] = (1/3); if (S == (T-3) || S == (T-2)) toWound[S][T] = (1/6); } for (int A=0; A<10;A++) { for (int D=0;D<10;D++) { if (A == D || A == D-1) { toHit[A][D] = 0.5; } if (A > D) { toHit[A][D] = (2/3); } if (A < D-1){ toHit[A][D] = (1/3); } } } } }
Can anyone help me?