1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
| import java.util.Scanner;
public class PokerDAs{
public static boolean trouve_pocker =false;
public static boolean trouve_carre =false;
public static boolean trouve_full =false;
public static boolean trouve_grande_suite =false;
public static boolean trouve_brelan =false;
public static boolean trouve_petite_suite =false;
public static boolean trouve_double_paire =false;
public static boolean trouve_paire =false;
public static int [] tiRage = new int [5];
// programme principale
public static void main(String[] args){
boolean continuer = false;
do {
tiRage = tirage();
switch (tiRage()){
case poCker():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case caRre():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case fUll():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case grande_Suite():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case brElan():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case petite_Suite():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case double_Paire():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
case paIre():
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
break;
default:
System.out.println("vous avez pas obtenu de score");
}
for (int i=0; i<5; i++){
System.out.print(tiRage[i]+" ");
}
System.out.println();
}
System.out.print("voulez vous continuer o/n ");
Scanner sc = new Scanner(System.in);
String caractere = sc.nextLine();
if (caractere == "o" || caractere == "O" ) {
continuer =true;
}
}while(continuer == false);
}
// fin programme principale
// tirage / lancement des dé !
public static int [] tirage() {
int[] Tirage = new int[5];
for (int i=0; i<5; i++){
Tirage[i] = (int) (Math.random()*6+1);
}
java.util.Arrays.sort(Tirage);
return (Tirage);
}
// Pocker
public static int[] poCker() {
int [][] pocker = new int[5] [4];
int [][] poker ={{6,6,6,6,6},{5,5,5,5,5},{4,4,4,4,4},{3,3,3,3,3},{2,2,2,2,2},{1,1,1,1,1}};
int [] point = {100,99,98,97,96,95};
for (int i=0; i<5; i++){
for (int j=0; j<4; j++){
if (tiRage [i] == pocker [i][j]){
System.out.println("pocker" + "point : " + point[i]);
trouve_pocker=true;
}
else {
System.out.println("pas de pocker");
}
}
}
return (tiRage);
}
// carré
public static int[] caRre() {
//int [][] carre = new int[5] [4];
int [][]carre = {{6,6,6,6,1},{5,5,5,5,1},{4,4,4,4,1},{3,3,3,3,1},{2,2,2,2,1},{1,1,1,1,2}};
int [] point = {89,88,87,86,85,84};
for (int i=0; i<5; i++){
for (int j=0; j<3; j++){
if (tiRage [i] == carre [i][j]){
System.out.println("carre" + "point : " + point[i]);
trouve_carre=true;
}
else {
System.out.println("pas de carre");
}
}
}
return (tiRage);
}
// full
public static int[] fUll() {
//int [][] full = new int[5] [24];
int [][] full ={{6,6,6,5,5},{6,6,6,4,4},{6,6,6,3,3},{6,6,6,2,2},{6,6,6,1,1},{6,6,5,5,5},{5,5,5,4,4},{5,5,5,3,3},{5,5,5,2,2},{5,5,5,1,1},
{6,6,4,4,4},{5,5,4,4,4},{4,4,4,3,3},{4,4,4,2,2},{4,4,4,1,1},{6,6,3,3,3},{5,5,3,3,3},{4,4,3,3,3},{3,3,3,2,2},{3,3,3,1,1},{6,6,2,2,2},
{5,5,2,2,2},{4,4,2,2,2},{3,3,2,2,2,},{2,2,2,1,1}};
int [] point = {83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59};
for (int i=0; i<5; i++){
for (int j=0; j<24; j++){
if (tiRage [i] == full [i][j]){
System.out.println("full" + "point : " + point[i]);
trouve_full=true;
}
else {
System.out.println("pas de full");
}
}
}
return (tiRage);
}
public static int[] grande_Suite() {
//int [][] grande_suite = new int[5] [1];
int [][] grande_suite ={{6,5,4,3,2,1},{1,2,3,4,5,6}};
int [] point = {58,57};
for (int i=0; i<5; i++){
for (int j=0; j<2; j++){
if (tiRage [i] == grande_suite [i][j]){
System.out.println("grande_suite" + "point : " + point[i]);
trouve_grande_suite=true;
}
else {
System.out.println("pas de grande_suite");
}
}
}
return (tiRage);
} |
Partager