Advertisement
Guest User

Untitled

a guest
May 19th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.73 KB | None | 0 0
  1. public class _04_FullHouseWithJoker {
  2.  
  3.     public static void main(String[] args) {
  4.        
  5.         String[] cards = new String[52];
  6.         String[] cardType = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
  7.         char[] cardSymbol = {'♠', '♥', '♣', '♦'};
  8.         int countFH = 0;
  9.        
  10.         for (int i = 0, indx = 0; i < 13; i++) {
  11.             for (int j = 0; j < 4; j++, indx++) {
  12.                    
  13.                 cards[indx] = cardType[i] + cardSymbol[j];
  14.             }
  15.         }
  16.  
  17.         for (int n = 0; n < 13; n++) {
  18.             for (int a = n * 4; a < (n * 4 + 4); a++) {
  19.                 for (int b = a + 1; b < (n * 4 + 4); b++) {
  20.                     for (int c = b + 1; c < (n * 4 + 4); c++) {
  21.  
  22.                         for (int m = 0; m < 13; m++) {
  23.                             if(n != m){
  24.                                 for (int d = m * 4; d < (m * 4 + 4); d++) {
  25.                                     for (int e = d + 1; e < (m * 4 + 4); e++) {
  26.                                         System.out.printf("%s %s %s %s %s \n",
  27.                                                         cards[a], cards[b], cards[c], cards[d], cards[e]);
  28.                                         countFH++;
  29.                                        
  30.                                         for (int j = 1; j < 32; j++) {
  31.                                            
  32.                                             for (int moveJ = 0; moveJ < 5; moveJ++) {
  33.                                                 if(((j >> moveJ) & 1) == 0){
  34.                                                     switch(moveJ){
  35.                                                     case 0: System.out.printf("%s ", cards[a]); break;
  36.                                                     case 1: System.out.printf("%s ", cards[b]); break;
  37.                                                     case 2: System.out.printf("%s ", cards[c]); break;
  38.                                                     case 3: System.out.printf("%s ", cards[d]); break;
  39.                                                     case 4: System.out.printf("%s ", cards[e]); break;
  40.                                                 }
  41.                                                 } else if(((j >> moveJ) & 1) != 0){
  42.                                                     System.out.print("* ");
  43.                                                 }
  44.                                             }
  45.                                             System.out.println();
  46.                                             countFH++;
  47.                                         }
  48.                                     }
  49.                                 }
  50.                             }
  51.                         }
  52.                        
  53.                     }              
  54.                 }
  55.             }
  56.         }
  57.         System.out.println(countFH);
  58.     }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement