Skip to content

Instantly share code, notes, and snippets.

@garbuchev
Created May 22, 2014 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garbuchev/6398544f42621649d7d3 to your computer and use it in GitHub Desktop.
Save garbuchev/6398544f42621649d7d3 to your computer and use it in GitHub Desktop.
P04 Full House with Jokers
public class P04FullHouseWithJokers {
public static void main(String[] args) {
int counterMain = 1;
System.out.println("* * * * *"); // fullHouse00
counterMain = fullHouse23(counterMain);
counterMain = fullHouse13(counterMain);
counterMain = fullHouse22(counterMain);
counterMain = fullHouse12(counterMain);
counterMain = fullHouse03(counterMain);
counterMain = fullHouse02(counterMain);
counterMain = fullHouse11(counterMain);
counterMain = fullHouse01(counterMain);
System.out.println(counterMain);
}
private static int fullHouse01(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int s11 = 0; s11 < suits.length; s11++) {
System.out.println(faces[f1] + (char) suits[s11] + " * * * *");
counter++;
}
}
return counter;
}
private static int fullHouse11(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int f2 = 0; f2 < faces.length; f2++) {
for (int s11 = 0; s11 < suits.length; s11++) {
for (int s21 = 0; s21 < suits.length; s21++) {
if (f1 != f2) {
System.out.println(faces[f1] + (char) suits[s11]
+ " " + faces[f2] + (char) suits[s21]
+ " * * *");
counter++;
}
}
}
}
}
return counter;
}
private static int fullHouse02(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int s11 = 0; s11 < suits.length - 1; s11++) {
for (int s12 = s11 + 1; s12 < suits.length; s12++) {
System.out.println(faces[f1] + (char) suits[s11] + " "
+ faces[f1] + (char) suits[s12] + " * * *");
counter++;
}
}
}
return counter;
}
private static int fullHouse03(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int s11 = 0; s11 < suits.length - 2; s11++) {
for (int s12 = s11 + 1; s12 < suits.length - 1; s12++) {
for (int s13 = s12 + 1; s13 < suits.length; s13++) {
System.out.println(faces[f1] + (char) suits[s11] + " "
+ faces[f1] + (char) suits[s12] + " "
+ faces[f1] + (char) suits[s13] + " * *");
counter++;
}
}
}
}
return counter;
}
private static int fullHouse12(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int f2 = 0; f2 < faces.length; f2++) {
for (int s11 = 0; s11 < suits.length; s11++) {
for (int s21 = 0; s21 < suits.length - 1; s21++) {
for (int s22 = s21 + 1; s22 < suits.length; s22++) {
if (f1 != f2) {
System.out.println(faces[f1]
+ (char) suits[s11] + " " + faces[f2]
+ (char) suits[s21] + " " + faces[f2]
+ (char) suits[s22] + " * *");
counter++;
}
}
}
}
}
}
return counter;
}
private static int fullHouse22(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int f2 = 0; f2 < faces.length; f2++) {
for (int s11 = 0; s11 < suits.length - 1; s11++) {
for (int s12 = s11 + 1; s12 < suits.length; s12++) {
for (int s21 = 0; s21 < suits.length - 1; s21++) {
for (int s22 = s21 + 1; s22 < suits.length; s22++) {
if (f1 != f2) {
System.out.println(faces[f1]
+ (char) suits[s11] + " "
+ faces[f1] + (char) suits[s12]
+ " " + faces[f2]
+ (char) suits[s21] + " "
+ faces[f2] + (char) suits[s22]
+ " *");
counter++;
}
}
}
}
}
}
}
return counter;
}
private static int fullHouse13(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int f2 = 0; f2 < faces.length; f2++) {
for (int s11 = 0; s11 < suits.length - 2; s11++) {
for (int s12 = s11 + 1; s12 < suits.length - 1; s12++) {
for (int s13 = s12 + 1; s13 < suits.length; s13++) {
for (int s21 = 0; s21 < suits.length; s21++) {
if (f1 != f2) {
System.out.println(faces[f1]
+ (char) suits[s11] + " "
+ faces[f1] + (char) suits[s12]
+ " " + faces[f1]
+ (char) suits[s13] + " "
+ faces[f2] + (char) suits[s21]
+ " " + "*");
counter++;
}
}
}
}
}
}
}
return counter;
}
private static int fullHouse23(int counter) {
//
String[] faces = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J",
"Q", "K", "A" };
char[] suits = { '\u2660', '\u2663', '\u2665', '\u2666' };
for (int f1 = 0; f1 < faces.length; f1++) {
for (int f2 = 0; f2 < faces.length; f2++) {
for (int s11 = 0; s11 < suits.length - 2; s11++) {
for (int s12 = s11 + 1; s12 < suits.length - 1; s12++) {
for (int s13 = s12 + 1; s13 < suits.length; s13++) {
for (int s21 = 0; s21 < suits.length - 1; s21++) {
for (int s22 = s21 + 1; s22 < suits.length; s22++) {
if (f1 != f2) {
System.out.println(faces[f1]
+ (char) suits[s11] + " "
+ faces[f1] + (char) suits[s12]
+ " " + faces[f1]
+ (char) suits[s13] + " "
+ faces[f2] + (char) suits[s21]
+ " " + faces[f2]
+ (char) suits[s22]);
counter++;
}
}
}
}
}
}
}
}
return counter;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment