}
}
public void initialiseRanking() {
FiveEval fiveEval = new FiveEval();
rankArray = new int[MAX_NONFLUSH_KEY_INT+1];
flushRankArray = new int[MAX_KEY_INT+1];
int[] face={ ACE, KING, QUEEN, JACK,
TEN, NINE, EIGHT, SEVEN,
SIX, FIVE, FOUR, THREE,
TWO};
int[] faceFlush={ ACE_FLUSH, KING_FLUSH, QUEEN_FLUSH, JACK_FLUSH,
TEN_FLUSH, NINE_FLUSH, EIGHT_FLUSH, SEVEN_FLUSH,
SIX_FLUSH, FIVE_FLUSH, FOUR_FLUSH, THREE_FLUSH,
TWO_FLUSH};
int i, j, k, l, m, n, p;
//Clean all ranks and flushranks
for(i=0; i<MAX_NONFLUSH_KEY_INT+1; i++){rankArray[i]=0;}
for(i=0; i<MAX_FLUSH_KEY_INT+1; i++){flushRankArray[i]=0;}
//Non-flush ranks
for(i=1; i<13; i++){for(j=1; j<=i; j++){for(k=1; k<=j; k++){for(l=0; l<=k; l++){
for(m=0; m<=l; m++){for(n=0; n<=m; n++){for(p=0; p<=n; p++){
if (i!=m && j!=n && k!=p)
{
int key=face[i]+face[j]+face[k]+face[l]+face[m]+face[n]+face[p];
//The 4*i+0 and 4*m+1 trick prevents flushes
int rank=fiveEval.getBestRankOf(4*i, 4*j, 4*k, 4*l, 4*m+1, 4*n+1, 4*p+1);
rankArray[key]=rank;}}}}}}}}
//Flush ranks
//All 7 same suit:
for(i=6; i<13; i++){for(j=5; j<i; j++){for(k=4; k<j; k++){for(l=3; l<k; l++){
for(m=2; m<l; m++){for(n=1; n<m; n++){for(p=0; p<n; p++){
int key=faceFlush[i]+faceFlush[j]+faceFlush[k]+faceFlush[l]+faceFlush[m]+
faceFlush[n]+faceFlush[p];
int rank=fiveEval.getBestRankOf(4*i, 4*j, 4*k, 4*l, 4*m, 4*n, 4*p);
flushRankArray[key]=rank;}}}}}}}
//Only 6 same suit:
for(i=5; i<13; i++){for(j=4; j<i; j++){for(k=3; k<j; k++){for(l=2; l<k; l++){
for(m=1; m<l; m++){for(n=0; n<m; n++){
int key=faceFlush[i]+faceFlush[j]+faceFlush[k]+faceFlush[l]+faceFlush[m]+faceFlush[n];
//The Two of clubs is the card at index 51, the
//other cards are all spades
int rank=fiveEval.getBestRankOf(4*i, 4*j, 4*k, 4*l, 4*m, 4*n, 51);
flushRankArray[key]=rank;}}}}}}
//Only 5 same suit:
for(i=4; i<13; i++){for(j=3; j<i; j++){for(k=2; k<j; k++){for(l=1; l<k; l++){
for(m=0; m<l; m++){
int key=faceFlush[i]+faceFlush[j]+faceFlush[k]+faceFlush[l]+faceFlush[m];
int rank=fiveEval.getRankOf(4*i, 4*j, 4*k, 4*l, 4*m);
flushRankArray[key]=rank;}}}}}
}