/********************************************************************\ * poker.java * * by Daniel Wedul * * Last modified: 5/29/02 * \********************************************************************/ import mpi.*; public class poker { public static void main(String [] args) throws MPIException { int myid = 0; int numprocs = 0; Intracomm world; Status stat; MPI.Init(args); world = MPI.COMM_WORLD; myid = world.Rank(); numprocs = world.Size(); final int numberofplayers = 9; final int iter = 1000000; deck a = new deck(); card [][] pocket = new card[2][numberofplayers]; card [] board = new card[5]; card [] burn = new card[3]; float [][] winner = new float[13][13]; int [] count = new int[169]; for(int i=0;i<13;i++) for(int j=0;j<13;j++) winner[i][j] = 0; hand [] h = new hand[numberofplayers]; int myiter = iter/numprocs; if (myiter * numprocs != iter) { int left = iter - myiter * numprocs; if (myid < left) myiter++; } for(int i=0;i max) { max = wintot[13*i+j]; maxi1 = i; maxi2 = j; } if (count[13*i+j] > maxc) { maxc = count[13*i+j]; maxc1 = i; maxc2 = j; } } } System.out.println(" max: " + max + " at " + (++maxi1) + "," + (++maxi2)); System.out.println("max occurance: " + maxc + " at " + (++maxc1) + "," + (++maxc2)); //find the highest and lowest ratio of occurances to wins max = 0; float low = 100; int lowi1 = 0; int lowi2 = 0; for(int i=0;i<13;i++) { for(int j=0;j<13;j++) { wintot[13*i+j] = wintot[13*i+j]/(float)count[13*i+j]; if (wintot[13*i+j] > max) { max = wintot[13*i+j]; maxi1 = i; maxi2 = j; } if (wintot[13*i+j] < low) { low = wintot[13*i+j]; lowi1 = i; lowi2 = j; } } } System.out.println(" best bet: " + max + " at " + (++maxi1) + "," + (++maxi2)); System.out.println(" worst bet: " + low + " at " + (++lowi1) + "," + (++lowi2)); for(int i=0;i<13;i++) { for(int j=0;j<13;j++) { System.out.print (" " + wintot[13*i+j] + " "); } System.out.println(""); } } //if MPI.Finalize(); }//main }//poker // end file poker.java