diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-26 19:27:18 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-26 19:27:18 +0100 |
| commit | 7167b4341ef290d56fb96e2af10883a4b925d83b (patch) | |
| tree | 1eb1b9e5ab82ddd89540e68d6b22ae69514575c6 /JBriscola/all_versions/0.2/0.2.2/src/Main.java | |
| download | ancient-projects-master.tar.gz ancient-projects-master.zip | |
Diffstat (limited to 'JBriscola/all_versions/0.2/0.2.2/src/Main.java')
| -rwxr-xr-x | JBriscola/all_versions/0.2/0.2.2/src/Main.java | 1317 |
1 files changed, 1317 insertions, 0 deletions
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/Main.java b/JBriscola/all_versions/0.2/0.2.2/src/Main.java new file mode 100755 index 0000000..baf7968 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/Main.java | |||
| @@ -0,0 +1,1317 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org> | ||
| 3 | |||
| 4 | This file is part of JBriscola. | ||
| 5 | |||
| 6 | JBriscola is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | JBriscola is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with JBriscola; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | |||
| 20 | */ | ||
| 21 | |||
| 22 | import java.io.*; | ||
| 23 | import java.util.*; | ||
| 24 | import javax.swing.*; | ||
| 25 | import java.awt.*; | ||
| 26 | |||
| 27 | public class Main { | ||
| 28 | |||
| 29 | /* semeBriscola serve a determinare quale il seme di briscola (0 coppe, | ||
| 30 | * 1 bastoni, 2 denari, 3 spade). | ||
| 31 | * punteggio è il punteggio del giocatore, punteggioCPU quello della CPU | ||
| 32 | * mano tiene il conto della mano a cui si è arrivati. | ||
| 33 | * cartaDaPescare è la carta che la CPU deve raccogliere dal mazzo | ||
| 34 | * cartaDaGiocare (può assumere valore compraso tra 0 e 2) è la carta | ||
| 35 | * che la cpu deve giocare. */ | ||
| 36 | public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare; | ||
| 37 | |||
| 38 | /* toccaAllaCPU determina se è il turno del computer o del giocatore, | ||
| 39 | * CPUHaGiocato se il computer ha già giocato in questo turno e | ||
| 40 | * haGiocatoPrima se la prima mossa del turno è stata del giocatore | ||
| 41 | * (true) o della CPU (false). | ||
| 42 | * sound e keys riguardano le opzioni (souno si o no, tasti rapidi si | ||
| 43 | * o no) salvate nel file di configurazione. */ | ||
| 44 | public static boolean toccaAllaCPU = false; | ||
| 45 | public static boolean CPUHaGiocato = false; | ||
| 46 | public static boolean haGiocatoPrima = true; | ||
| 47 | public static boolean sound = true; | ||
| 48 | public static boolean keys = true; | ||
| 49 | |||
| 50 | /* frame è la finestra principale del gioco, color il colore dello sfondo. | ||
| 51 | * lang, soundString e keysString servono a leggere le opzioni dal file | ||
| 52 | * di configurazione. */ | ||
| 53 | public static Frame frame; | ||
| 54 | public static Color color = new Color( 0, 150, 0 ); | ||
| 55 | public static String lang, soundString, keysString; | ||
| 56 | |||
| 57 | /* Tutte le stringhe che vengono utilizzate durante il gioco sono | ||
| 58 | * inizializzate qui, per poter essere tradotte in altre lingue. */ | ||
| 59 | public static String version = "0.2.2"; | ||
| 60 | public static String stringaBottonePrendi = "Prendi/Lascia carte"; | ||
| 61 | public static String stringaPrimaGioca = "Prima Gioca!"; | ||
| 62 | public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!"; | ||
| 63 | public static String stringaVinto = "Hai Vinto!"; | ||
| 64 | public static String stringaPerso = "Hai Perso"; | ||
| 65 | public static String stringaPareggio = "Pareggio"; | ||
| 66 | public static String stringaGiocatore = "Giocatore: "; | ||
| 67 | public static String stringaComputer = "\nComputer: "; | ||
| 68 | public static String stringaNuovaPartita = "Nuova Partita"; | ||
| 69 | public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?"; | ||
| 70 | public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?"; | ||
| 71 | public static String stringaSi = "Si"; | ||
| 72 | public static String stringaNo = "No"; | ||
| 73 | public static String stringaOpzioni = "Opzioni..."; | ||
| 74 | public static String stringaEsci = "Esci"; | ||
| 75 | public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n"; | ||
| 76 | public static String stringaLingua = "Lingua"; | ||
| 77 | public static String stringaAnnulla = "Annulla"; | ||
| 78 | public static String stringaIt = "Italiano"; | ||
| 79 | public static String stringaLa = "Latino"; | ||
| 80 | public static String stringaBL = "Dialetto Bellunese"; | ||
| 81 | public static String stringaBV = "Dialetto Basso Veneto"; | ||
| 82 | public static String stringaEN = "Inglese"; | ||
| 83 | public static String stringaModificaOpzioni = "Modifica Opzioni"; | ||
| 84 | public static String stringaInformazioni = "Informazioni"; | ||
| 85 | public static String stringaInformazioni2 = "JBriscola e' un gioco di briscola per pc scritto in java ideato\ne realizzato da Sebastiano Tronto. Il gioco viene rilasciato sotto licenza GNU/Gpl versione 2 o successive; questo permette\npotenzialmente a chiunque di modificare il gioco partendo dal codice sorgente del programma. Se non avete ricevuto i sorgenti\nassieme al gioco, potete richiedermeli con un'e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 86 | public static String stringaSuono = "Effetti Sonori"; | ||
| 87 | public static String stringaPunteggio = "Punteggio"; | ||
| 88 | public static String stringaSfondo = "Sfondo"; | ||
| 89 | public static String stringaTasti = "Tasti rapidi"; | ||
| 90 | public static String stringaAggiornamenti = "Cerca aggiornamenti"; | ||
| 91 | public static String stringaAggiornamentiSi = "Aggiornamento disponibile: "; | ||
| 92 | public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile"; | ||
| 93 | public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html"; | ||
| 94 | public static String stringaNoInternet = "Errore: nessuna connessione internet"; | ||
| 95 | public static String stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 96 | |||
| 97 | public static void main( String args[] ) { | ||
| 98 | |||
| 99 | /* Chiama il metodo settaOpzioni per leggere le impostazioni | ||
| 100 | * dell'utente da un eventuale file di configurazione */ | ||
| 101 | settaOpzioni(); | ||
| 102 | |||
| 103 | /* Crea la finestra principale del gioco e la posiziona al centro | ||
| 104 | * dello schermo. */ | ||
| 105 | frame = new Frame(); | ||
| 106 | frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); | ||
| 107 | frame.setResizable( false ); | ||
| 108 | frame.setSize( 600, 600 ); | ||
| 109 | frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2); | ||
| 110 | frame.setVisible( true ); | ||
| 111 | } | ||
| 112 | |||
| 113 | /* Algoritmo per mischiare il mazzo: prende due carte a caso e le | ||
| 114 | * inverte di posto, utilizzando una variabile aux. Ripete il procedimento | ||
| 115 | * per 391 volte. */ | ||
| 116 | public void mischia() { | ||
| 117 | |||
| 118 | mano = 0; | ||
| 119 | punteggio = 0; | ||
| 120 | punteggioCPU = 0; | ||
| 121 | cartaDaPescare = 6; | ||
| 122 | ImageIcon aux; | ||
| 123 | frame.mazzo = true; | ||
| 124 | toccaAllaCPU = false; | ||
| 125 | CPUHaGiocato = false; | ||
| 126 | haGiocatoPrima = true; | ||
| 127 | |||
| 128 | /* Inizializza l'array di carte mescolate ordinato */ | ||
| 129 | for ( int i = 0, k = 0; i < 10; i++ ) | ||
| 130 | for ( int j = 0; j < 4; j++, k++ ) | ||
| 131 | frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j]; | ||
| 132 | |||
| 133 | /* Mescola le carte utilizzando il metodo sopra citato */ | ||
| 134 | for ( int i = 0; i < 391; i++ ) { | ||
| 135 | double a = Math.random() * 40; | ||
| 136 | int x = (int) a; | ||
| 137 | double b = Math.random() * 40; | ||
| 138 | int y = (int) b; | ||
| 139 | aux = frame.arrayCarteMescolate[x]; | ||
| 140 | frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y]; | ||
| 141 | frame.arrayCarteMescolate[y] = aux; | ||
| 142 | } | ||
| 143 | |||
| 144 | /* Imposta il seme della briscola leggendo il nome dell'ultima carta | ||
| 145 | * utilizzando un array ausiliare */ | ||
| 146 | char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray(); | ||
| 147 | semeBriscola = auxChar[auxChar.length-5] - 49; | ||
| 148 | |||
| 149 | /* Distribuisce le carte */ | ||
| 150 | frame.carteInMano[0] = frame.arrayCarteMescolate[0]; | ||
| 151 | frame.carteInMano[1] = frame.arrayCarteMescolate[1]; | ||
| 152 | frame.carteInMano[2] = frame.arrayCarteMescolate[2]; | ||
| 153 | frame.carteCPU[0] = frame.arrayCarteMescolate[3]; | ||
| 154 | frame.carteCPU[1] = frame.arrayCarteMescolate[4]; | ||
| 155 | frame.carteCPU[2] = frame.arrayCarteMescolate[5]; | ||
| 156 | frame.ultimaCarta = frame.arrayCarteMescolate[39]; | ||
| 157 | frame.giocata[0] = null; | ||
| 158 | frame.giocata[1] = null; | ||
| 159 | } | ||
| 160 | |||
| 161 | /* Fa giocare la CPU. Questo metodo contiene l'iuntelligenza artificiale | ||
| 162 | * del gioco. Ho preferito non commentare il corpo del metodo per due | ||
| 163 | * motivi; il primo è che abbastanza intuitivo: basta sapere che i vari | ||
| 164 | * metodi vaiLiscio(), vaiTaglio() ecc... tentano di fare ciò che | ||
| 165 | * ovviamente dice il loro nome, se ci riescono restituiscono true, | ||
| 166 | * in caso contrario false.*/ | ||
| 167 | public void giocaCPU() { | ||
| 168 | |||
| 169 | if ( mano < 16 ) { | ||
| 170 | |||
| 171 | /* Valuta cosa fare se il giocatore non ha ancora giocato. */ | ||
| 172 | if ( frame.giocata[0] == null ) { | ||
| 173 | if ( vaiPunti() ); | ||
| 174 | else if ( vaiLiscio() ); | ||
| 175 | else if ( vaiTaglio() ); | ||
| 176 | else if ( vaiBriscolaAlta() ); | ||
| 177 | else if ( vaiCarico() ); | ||
| 178 | else if ( vaiTre() ); | ||
| 179 | else if ( vaiAsso() ); | ||
| 180 | else; | ||
| 181 | } | ||
| 182 | |||
| 183 | /* Valuta cosa fare quando invece il giocatore ha giocato */ | ||
| 184 | else { | ||
| 185 | if ( haLisciato() ) { | ||
| 186 | if ( vaiSopra() ); | ||
| 187 | else if ( vaiLiscio() ); | ||
| 188 | else if ( vaiPunti() ); | ||
| 189 | else if ( vaiTaglio() ); | ||
| 190 | else if ( vaiTre() ); | ||
| 191 | else if ( vaiBriscolaAlta() ); | ||
| 192 | else if ( vaiCarico() ); | ||
| 193 | else if ( vaiAsso() ); | ||
| 194 | } else if ( haMessoPunti() ) { | ||
| 195 | if ( vaiSopra() ); | ||
| 196 | else if ( vaiLiscio() ); | ||
| 197 | else if ( vaiTaglio() ); | ||
| 198 | else if ( vaiPunti() ); | ||
| 199 | else if ( vaiTre() ); | ||
| 200 | else if ( vaiBriscolaAlta() ); | ||
| 201 | else if ( vaiCarico() ); | ||
| 202 | else if ( vaiAsso() ); | ||
| 203 | } else if ( haTagliato() ) { | ||
| 204 | if ( vaiLiscio() ); | ||
| 205 | else if ( vaiPunti() ); | ||
| 206 | else if ( vaiTaglio() ); | ||
| 207 | else if ( vaiTre() ); | ||
| 208 | else if ( vaiBriscolaAlta() ); | ||
| 209 | else if ( vaiCarico() ); | ||
| 210 | else if ( vaiAsso() ); | ||
| 211 | } else if ( haMessoBriscolaAlta() ) { | ||
| 212 | if ( vaiLiscio() ); | ||
| 213 | else if ( vaiPunti() ); | ||
| 214 | else if ( vaiTre() ); | ||
| 215 | else if ( vaiTaglio() ); | ||
| 216 | else if ( vaiBriscolaAlta() ); | ||
| 217 | else if ( vaiCarico() ); | ||
| 218 | else if ( vaiAsso() ); | ||
| 219 | } else if ( haMessoTre() ) { | ||
| 220 | if ( vaiAsso() ); | ||
| 221 | else if ( vaiLiscio() ); | ||
| 222 | else if ( vaiPunti() ); | ||
| 223 | else if ( vaiTaglio() ); | ||
| 224 | else if ( vaiBriscolaAlta() ); | ||
| 225 | else if ( vaiCarico() ); | ||
| 226 | } else if ( haMessoAsso() ) { | ||
| 227 | if ( vaiLiscio() ); | ||
| 228 | else if ( vaiPunti() ); | ||
| 229 | else if ( vaiTaglio() ); | ||
| 230 | else if ( vaiBriscolaAlta() ); | ||
| 231 | else if ( vaiCarico() ); | ||
| 232 | else if ( vaiTre() ); | ||
| 233 | } else if ( haCaricato() ) { | ||
| 234 | if ( vaiSopra() ); | ||
| 235 | else if ( vaiTre() ); | ||
| 236 | else if ( vaiBriscolaAlta() ); | ||
| 237 | else if ( vaiAsso() ); | ||
| 238 | else if ( vaiTaglio() ); | ||
| 239 | else if ( vaiLiscio() ); | ||
| 240 | else if ( vaiPunti() ); | ||
| 241 | else if ( vaiCarico() ); | ||
| 242 | } | ||
| 243 | } | ||
| 244 | } | ||
| 245 | else if ( mano == 16 ) { | ||
| 246 | if ( frame.giocata[0] == null ) { | ||
| 247 | char aux[]; | ||
| 248 | aux = frame.ultimaCarta.toString().toCharArray(); | ||
| 249 | if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) { | ||
| 250 | if ( vaiCarico() ); | ||
| 251 | else if ( vaiPunti() ); | ||
| 252 | else if ( vaiLiscio() ); | ||
| 253 | else if ( vaiTaglio() ); | ||
| 254 | else if ( vaiBriscolaAlta() ); | ||
| 255 | else if ( vaiTre() ); | ||
| 256 | else if ( vaiAsso() ); | ||
| 257 | else; | ||
| 258 | } else { | ||
| 259 | if ( vaiPunti() ); | ||
| 260 | else if ( vaiLiscio() ); | ||
| 261 | else if ( vaiTaglio() ); | ||
| 262 | else if ( vaiBriscolaAlta() ); | ||
| 263 | else if ( vaiCarico() ); | ||
| 264 | else if ( vaiTre() ); | ||
| 265 | else if ( vaiAsso() ); | ||
| 266 | else; | ||
| 267 | } | ||
| 268 | } | ||
| 269 | else { | ||
| 270 | char aux[]; | ||
| 271 | aux = frame.ultimaCarta.toString().toCharArray(); | ||
| 272 | if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) { | ||
| 273 | if ( haCaricato() ) { | ||
| 274 | if ( vaiSopra() ); | ||
| 275 | else if ( vaiLiscio() ); | ||
| 276 | else if ( vaiPunti() ); | ||
| 277 | else if ( vaiTre() ); | ||
| 278 | else if ( vaiTaglio() ); | ||
| 279 | else if ( vaiBriscolaAlta() ); | ||
| 280 | else if ( vaiAsso() ); | ||
| 281 | else if ( vaiCarico() ); | ||
| 282 | } | ||
| 283 | } else { | ||
| 284 | if ( haLisciato() ) { | ||
| 285 | if ( vaiSopra() ); | ||
| 286 | else if ( vaiLiscio() ); | ||
| 287 | else if ( vaiPunti() ); | ||
| 288 | else if ( vaiTaglio() ); | ||
| 289 | else if ( vaiTre() ); | ||
| 290 | else if ( vaiBriscolaAlta() ); | ||
| 291 | else if ( vaiCarico() ); | ||
| 292 | else if ( vaiAsso() ); | ||
| 293 | } else if ( haMessoPunti() ) { | ||
| 294 | if ( vaiSopra() ); | ||
| 295 | else if ( vaiLiscio() ); | ||
| 296 | else if ( vaiTaglio() ); | ||
| 297 | else if ( vaiPunti() ); | ||
| 298 | else if ( vaiTre() ); | ||
| 299 | else if ( vaiBriscolaAlta() ); | ||
| 300 | else if ( vaiCarico() ); | ||
| 301 | else if ( vaiAsso() ); | ||
| 302 | } else if ( haTagliato() ) { | ||
| 303 | if ( vaiLiscio() ); | ||
| 304 | else if ( vaiPunti() ); | ||
| 305 | else if ( vaiTaglio() ); | ||
| 306 | else if ( vaiTre() ); | ||
| 307 | else if ( vaiBriscolaAlta() ); | ||
| 308 | else if ( vaiCarico() ); | ||
| 309 | else if ( vaiAsso() ); | ||
| 310 | } else if ( haMessoBriscolaAlta() ) { | ||
| 311 | if ( vaiLiscio() ); | ||
| 312 | else if ( vaiPunti() ); | ||
| 313 | else if ( vaiTre() ); | ||
| 314 | else if ( vaiTaglio() ); | ||
| 315 | else if ( vaiBriscolaAlta() ); | ||
| 316 | else if ( vaiCarico() ); | ||
| 317 | else if ( vaiAsso() ); | ||
| 318 | } else if ( haMessoTre() ) { | ||
| 319 | if ( vaiAsso() ); | ||
| 320 | else if ( vaiLiscio() ); | ||
| 321 | else if ( vaiPunti() ); | ||
| 322 | else if ( vaiTaglio() ); | ||
| 323 | else if ( vaiBriscolaAlta() ); | ||
| 324 | else if ( vaiCarico() ); | ||
| 325 | } else if ( haMessoAsso() ) { | ||
| 326 | if ( vaiLiscio() ); | ||
| 327 | else if ( vaiPunti() ); | ||
| 328 | else if ( vaiTaglio() ); | ||
| 329 | else if ( vaiBriscolaAlta() ); | ||
| 330 | else if ( vaiCarico() ); | ||
| 331 | else if ( vaiTre() ); | ||
| 332 | } else if ( haCaricato() ) { | ||
| 333 | if ( vaiSopra() ); | ||
| 334 | else if ( vaiTre() ); | ||
| 335 | else if ( vaiBriscolaAlta() ); | ||
| 336 | else if ( vaiAsso() ); | ||
| 337 | else if ( vaiTaglio() ); | ||
| 338 | else if ( vaiLiscio() ); | ||
| 339 | else if ( vaiPunti() ); | ||
| 340 | else if ( vaiCarico() ); | ||
| 341 | } | ||
| 342 | } | ||
| 343 | } | ||
| 344 | } else if ( mano == 17 ) { | ||
| 345 | if ( frame.giocata[0] == null ) { | ||
| 346 | if ( hoAsso() ) { | ||
| 347 | if ( vaiTre() ); | ||
| 348 | else if ( vaiBriscolaAlta() ); | ||
| 349 | else if ( vaiTaglio() ); | ||
| 350 | else if ( vaiLiscio() ); | ||
| 351 | else if ( vaiPunti() ); | ||
| 352 | else if ( vaiAsso() ); | ||
| 353 | else if ( vaiCarico() ); | ||
| 354 | } else { | ||
| 355 | if ( vaiLiscio() ); | ||
| 356 | else if ( vaiPunti() ); | ||
| 357 | else if ( vaiTaglio() ); | ||
| 358 | else if ( vaiBriscolaAlta() ); | ||
| 359 | else if ( vaiCarico() ); | ||
| 360 | else if ( vaiTre() ); | ||
| 361 | } | ||
| 362 | } | ||
| 363 | else { | ||
| 364 | if ( haLisciato() ) { | ||
| 365 | if ( vaiSopra() ); | ||
| 366 | else if ( vaiLiscio() ); | ||
| 367 | else if ( vaiPunti() ); | ||
| 368 | else if ( vaiTaglio() ); | ||
| 369 | else if ( vaiTre() ); | ||
| 370 | else if ( vaiBriscolaAlta() ); | ||
| 371 | else if ( vaiCarico() ); | ||
| 372 | else if ( vaiAsso() ); | ||
| 373 | } else if ( haMessoPunti() ) { | ||
| 374 | if ( vaiSopra() ); | ||
| 375 | else if ( vaiLiscio() ); | ||
| 376 | else if ( vaiTaglio() ); | ||
| 377 | else if ( vaiPunti() ); | ||
| 378 | else if ( vaiTre() ); | ||
| 379 | else if ( vaiBriscolaAlta() ); | ||
| 380 | else if ( vaiCarico() ); | ||
| 381 | else if ( vaiAsso() ); | ||
| 382 | } else if ( haTagliato() ) { | ||
| 383 | if ( vaiLiscio() ); | ||
| 384 | else if ( vaiPunti() ); | ||
| 385 | else if ( vaiTaglio() ); | ||
| 386 | else if ( vaiTre() ); | ||
| 387 | else if ( vaiBriscolaAlta() ); | ||
| 388 | else if ( vaiCarico() ); | ||
| 389 | else if ( vaiAsso() ); | ||
| 390 | } else if ( haMessoBriscolaAlta() ) { | ||
| 391 | if ( vaiLiscio() ); | ||
| 392 | else if ( vaiPunti() ); | ||
| 393 | else if ( vaiTre() ); | ||
| 394 | else if ( vaiTaglio() ); | ||
| 395 | else if ( vaiBriscolaAlta() ); | ||
| 396 | else if ( vaiCarico() ); | ||
| 397 | else if ( vaiAsso() ); | ||
| 398 | } else if ( haMessoTre() ) { | ||
| 399 | if ( vaiAsso() ); | ||
| 400 | else if ( vaiLiscio() ); | ||
| 401 | else if ( vaiPunti() ); | ||
| 402 | else if ( vaiTaglio() ); | ||
| 403 | else if ( vaiBriscolaAlta() ); | ||
| 404 | else if ( vaiCarico() ); | ||
| 405 | } else if ( haMessoAsso() ) { | ||
| 406 | if ( vaiLiscio() ); | ||
| 407 | else if ( vaiPunti() ); | ||
| 408 | else if ( vaiTaglio() ); | ||
| 409 | else if ( vaiBriscolaAlta() ); | ||
| 410 | else if ( vaiCarico() ); | ||
| 411 | else if ( vaiTre() ); | ||
| 412 | } else if ( haCaricato() ) { | ||
| 413 | if ( vaiSopra() ); | ||
| 414 | else if ( vaiTre() ); | ||
| 415 | else if ( vaiBriscolaAlta() ); | ||
| 416 | else if ( vaiAsso() ); | ||
| 417 | else if ( vaiTaglio() ); | ||
| 418 | else if ( vaiLiscio() ); | ||
| 419 | else if ( vaiPunti() ); | ||
| 420 | else if ( vaiCarico() ); | ||
| 421 | } | ||
| 422 | } | ||
| 423 | } else if ( mano == 18 ) { | ||
| 424 | if ( frame.giocata[0] == null ) { | ||
| 425 | if ( vaiAsso() ); | ||
| 426 | else if ( vaiCarico() ); | ||
| 427 | else if ( vaiBriscolaAlta() ); | ||
| 428 | else if ( vaiTaglio() ); | ||
| 429 | else if ( vaiPunti() ); | ||
| 430 | else if ( vaiLiscio() ); | ||
| 431 | else if ( vaiTre() ); | ||
| 432 | } | ||
| 433 | else { | ||
| 434 | if ( haLisciato() ) { | ||
| 435 | if ( vaiSopra() ); | ||
| 436 | else if ( vaiLiscio() ); | ||
| 437 | else if ( vaiPunti() ); | ||
| 438 | else if ( vaiTaglio() ); | ||
| 439 | else if ( vaiTre() ); | ||
| 440 | else if ( vaiBriscolaAlta() ); | ||
| 441 | else if ( vaiCarico() ); | ||
| 442 | else if ( vaiAsso() ); | ||
| 443 | } else if ( haMessoPunti() ) { | ||
| 444 | if ( vaiSopra() ); | ||
| 445 | else if ( vaiLiscio() ); | ||
| 446 | else if ( vaiTaglio() ); | ||
| 447 | else if ( vaiPunti() ); | ||
| 448 | else if ( vaiTre() ); | ||
| 449 | else if ( vaiBriscolaAlta() ); | ||
| 450 | else if ( vaiCarico() ); | ||
| 451 | else if ( vaiAsso() ); | ||
| 452 | } else if ( haTagliato() ) { | ||
| 453 | if ( vaiLiscio() ); | ||
| 454 | else if ( vaiPunti() ); | ||
| 455 | else if ( vaiTaglio() ); | ||
| 456 | else if ( vaiTre() ); | ||
| 457 | else if ( vaiBriscolaAlta() ); | ||
| 458 | else if ( vaiCarico() ); | ||
| 459 | else if ( vaiAsso() ); | ||
| 460 | } else if ( haMessoBriscolaAlta() ) { | ||
| 461 | if ( vaiLiscio() ); | ||
| 462 | else if ( vaiPunti() ); | ||
| 463 | else if ( vaiTre() ); | ||
| 464 | else if ( vaiTaglio() ); | ||
| 465 | else if ( vaiBriscolaAlta() ); | ||
| 466 | else if ( vaiCarico() ); | ||
| 467 | else if ( vaiAsso() ); | ||
| 468 | } else if ( haMessoTre() ) { | ||
| 469 | if ( vaiAsso() ); | ||
| 470 | else if ( vaiLiscio() ); | ||
| 471 | else if ( vaiPunti() ); | ||
| 472 | else if ( vaiTaglio() ); | ||
| 473 | else if ( vaiBriscolaAlta() ); | ||
| 474 | else if ( vaiCarico() ); | ||
| 475 | } else if ( haMessoAsso() ) { | ||
| 476 | if ( vaiLiscio() ); | ||
| 477 | else if ( vaiPunti() ); | ||
| 478 | else if ( vaiTaglio() ); | ||
| 479 | else if ( vaiBriscolaAlta() ); | ||
| 480 | else if ( vaiCarico() ); | ||
| 481 | else if ( vaiTre() ); | ||
| 482 | } else if ( haCaricato() ) { | ||
| 483 | if ( vaiSopra() ); | ||
| 484 | else if ( vaiTre() ); | ||
| 485 | else if ( vaiBriscolaAlta() ); | ||
| 486 | else if ( vaiAsso() ); | ||
| 487 | else if ( vaiTaglio() ); | ||
| 488 | else if ( vaiLiscio() ); | ||
| 489 | else if ( vaiPunti() ); | ||
| 490 | else if ( vaiCarico() ); | ||
| 491 | } | ||
| 492 | } | ||
| 493 | } else { | ||
| 494 | if ( vaiTre() ); | ||
| 495 | else if ( vaiBriscolaAlta() ); | ||
| 496 | else if ( vaiAsso() ); | ||
| 497 | else if ( vaiTaglio() ); | ||
| 498 | else if ( vaiLiscio() ); | ||
| 499 | else if ( vaiPunti() ); | ||
| 500 | else if ( vaiCarico() ); | ||
| 501 | } | ||
| 502 | |||
| 503 | /* Gioca la carta e aggiorna la finestra con il metodo repaint() */ | ||
| 504 | frame.giocata[1] = frame.carteCPU[cartaDaGiocare]; | ||
| 505 | frame.carteCPU[cartaDaGiocare] = null; | ||
| 506 | frame.pannello.repaint(); | ||
| 507 | |||
| 508 | CPUHaGiocato = true; | ||
| 509 | |||
| 510 | if ( frame.giocata[0] == null ) | ||
| 511 | toccaAllaCPU = false; | ||
| 512 | } | ||
| 513 | |||
| 514 | /* Determina se ha preso la CPU o il giocatore */ | ||
| 515 | public void chiPrende() { | ||
| 516 | char aux[], auxCPU[]; | ||
| 517 | aux = frame.giocata[0].toString().toCharArray(); | ||
| 518 | auxCPU = frame.giocata[1].toString().toCharArray(); | ||
| 519 | |||
| 520 | /* Chiama il metodo giocatorePrende( boolean giocatore ) con parametro | ||
| 521 | * true se ha preso il giocatore, false se ha preso la CPU */ | ||
| 522 | giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) ) | ||
| 523 | || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) ) | ||
| 524 | || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) ); | ||
| 525 | } | ||
| 526 | |||
| 527 | /* Confronta due carte per decidere quale ha più valore di presa. | ||
| 528 | * Restituisce true se è la prima, false se è la seconda */ | ||
| 529 | public boolean laPrimaEPiuAlta( int prima, int seconda ) { | ||
| 530 | int a, b; | ||
| 531 | switch ( prima ) { | ||
| 532 | case 0: | ||
| 533 | a = 10; | ||
| 534 | break; | ||
| 535 | case 1: | ||
| 536 | a = 12; | ||
| 537 | break; | ||
| 538 | case 3: | ||
| 539 | a = 11; | ||
| 540 | break; | ||
| 541 | default: | ||
| 542 | a = prima; | ||
| 543 | break; | ||
| 544 | } | ||
| 545 | switch ( seconda ) { | ||
| 546 | case 0: | ||
| 547 | b = 10; | ||
| 548 | break; | ||
| 549 | case 1: | ||
| 550 | b = 12; | ||
| 551 | break; | ||
| 552 | case 3: | ||
| 553 | b = 11; | ||
| 554 | break; | ||
| 555 | default: | ||
| 556 | b = seconda; | ||
| 557 | break; | ||
| 558 | } | ||
| 559 | return a > b; | ||
| 560 | } | ||
| 561 | |||
| 562 | /* Viene chiamato con parametro true se ha preso il giocatore, false se | ||
| 563 | * ha preso la CPU */ | ||
| 564 | public void giocatorePrende( boolean giocatore ) { | ||
| 565 | if ( giocatore ) { | ||
| 566 | toccaAllaCPU = CPUHaGiocato = false; | ||
| 567 | haGiocatoPrima = true; | ||
| 568 | } | ||
| 569 | else { | ||
| 570 | toccaAllaCPU = true; | ||
| 571 | CPUHaGiocato = haGiocatoPrima = false; | ||
| 572 | } | ||
| 573 | daiPunti( giocatore ); | ||
| 574 | if ( toccaAllaCPU ) | ||
| 575 | giocaCPU(); | ||
| 576 | } | ||
| 577 | |||
| 578 | /* Da i punti (true al giocatore, false alla CPU) e fa pescare le carte*/ | ||
| 579 | public void daiPunti( boolean giocatore ) { | ||
| 580 | |||
| 581 | char aux[], auxCPU[]; | ||
| 582 | aux = frame.giocata[0].toString().toCharArray(); | ||
| 583 | auxCPU = frame.giocata[1].toString().toCharArray(); | ||
| 584 | int punti = 0; | ||
| 585 | |||
| 586 | switch( aux[aux.length-7] - 48 ) { | ||
| 587 | case 0: | ||
| 588 | punti += 4; | ||
| 589 | break; | ||
| 590 | case 1: | ||
| 591 | punti += 11; | ||
| 592 | break; | ||
| 593 | case 3: | ||
| 594 | punti += 10; | ||
| 595 | break; | ||
| 596 | case 8: | ||
| 597 | punti += 2; | ||
| 598 | break; | ||
| 599 | case 9: | ||
| 600 | punti += 3; | ||
| 601 | break; | ||
| 602 | default: | ||
| 603 | break; | ||
| 604 | } | ||
| 605 | switch( auxCPU[auxCPU.length-7] - 48 ) { | ||
| 606 | case 0: | ||
| 607 | punti += 4; | ||
| 608 | break; | ||
| 609 | case 1: | ||
| 610 | punti += 11; | ||
| 611 | break; | ||
| 612 | case 3: | ||
| 613 | punti += 10; | ||
| 614 | break; | ||
| 615 | case 8: | ||
| 616 | punti += 2; | ||
| 617 | break; | ||
| 618 | case 9: | ||
| 619 | punti += 3; | ||
| 620 | break; | ||
| 621 | default: | ||
| 622 | break; | ||
| 623 | } | ||
| 624 | |||
| 625 | frame.giocata[0] = frame.giocata[1] = null; | ||
| 626 | |||
| 627 | if ( giocatore ) { | ||
| 628 | punteggio += punti; | ||
| 629 | if ( mano < 18 ) { | ||
| 630 | if ( frame.carteInMano[0] == null ) | ||
| 631 | frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 632 | if ( frame.carteInMano[1] == null ) | ||
| 633 | frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 634 | if ( frame.carteInMano[2] == null ) | ||
| 635 | frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 636 | cartaDaPescare++; | ||
| 637 | if ( frame.carteCPU[0] == null ) | ||
| 638 | frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 639 | if ( frame.carteCPU[1] == null ) | ||
| 640 | frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 641 | if ( frame.carteCPU[2] == null ) | ||
| 642 | frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 643 | cartaDaPescare++; | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 647 | else { | ||
| 648 | punteggioCPU += punti; | ||
| 649 | if ( mano < 18 ) { | ||
| 650 | if ( frame.carteCPU[0] == null ) | ||
| 651 | frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 652 | if ( frame.carteCPU[1] == null ) | ||
| 653 | frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 654 | if ( frame.carteCPU[2] == null ) | ||
| 655 | frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 656 | cartaDaPescare++; | ||
| 657 | if ( frame.carteInMano[0] == null ) | ||
| 658 | frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 659 | if ( frame.carteInMano[1] == null ) | ||
| 660 | frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 661 | if ( frame.carteInMano[2] == null ) | ||
| 662 | frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare]; | ||
| 663 | cartaDaPescare++; | ||
| 664 | } | ||
| 665 | } | ||
| 666 | |||
| 667 | /* Aggiorna la finestra */ | ||
| 668 | frame.pannello.repaint(); | ||
| 669 | frame.repaint(); | ||
| 670 | } | ||
| 671 | |||
| 672 | /* Vari metodi che determinano che tipo di carta ha giocato il giocatore. | ||
| 673 | * Per farlo leggono il nome dell'immagine dal file. Dato che ogni carta | ||
| 674 | * a un nome del tipo 1-1.jpg (asso di coppe) o 10-3 (re di denari) e | ||
| 675 | * così via, è facile riconoscerle. */ | ||
| 676 | public boolean haLisciato() { | ||
| 677 | char auxCPU[]; | ||
| 678 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 679 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && | ||
| 680 | (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) && | ||
| 681 | (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ); | ||
| 682 | } | ||
| 683 | |||
| 684 | public boolean haMessoPunti() { | ||
| 685 | char auxCPU[]; | ||
| 686 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 687 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && | ||
| 688 | ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || | ||
| 689 | (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ); | ||
| 690 | } | ||
| 691 | |||
| 692 | public boolean haTagliato() { | ||
| 693 | char auxCPU[]; | ||
| 694 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 695 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 696 | (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) && | ||
| 697 | (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ); | ||
| 698 | } | ||
| 699 | |||
| 700 | public boolean haMessoBriscolaAlta() { | ||
| 701 | char auxCPU[]; | ||
| 702 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 703 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 704 | ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) || | ||
| 705 | (auxCPU[auxCPU.length-7] - 48 == 9) ) ); | ||
| 706 | } | ||
| 707 | |||
| 708 | public boolean haMessoTre() { | ||
| 709 | char auxCPU[]; | ||
| 710 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 711 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 712 | (auxCPU[auxCPU.length-7] - 48 == 3) ); | ||
| 713 | } | ||
| 714 | |||
| 715 | public boolean haMessoAsso() { | ||
| 716 | char auxCPU[]; | ||
| 717 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 718 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 719 | (auxCPU[auxCPU.length-7] - 48 == 1) ); | ||
| 720 | } | ||
| 721 | |||
| 722 | public boolean haCaricato() { | ||
| 723 | char auxCPU[]; | ||
| 724 | auxCPU = frame.giocata[0].toString().toCharArray(); | ||
| 725 | return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && | ||
| 726 | ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ); | ||
| 727 | } | ||
| 728 | |||
| 729 | /* I metodi seguenti cercano di andare liscio - dare punti - mettere | ||
| 730 | * un taglio - ecc... e restituiscono true se hanno avuto successo, | ||
| 731 | * false altrimenti. */ | ||
| 732 | public boolean vaiLiscio() { | ||
| 733 | |||
| 734 | char auxCPU[]; | ||
| 735 | |||
| 736 | for ( int i = 0; i < 3; i++ ) { | ||
| 737 | if ( frame.carteCPU[i] != null ) { | ||
| 738 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 739 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && | ||
| 740 | (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) && | ||
| 741 | (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) { | ||
| 742 | cartaDaGiocare = i; | ||
| 743 | return true; | ||
| 744 | } | ||
| 745 | } | ||
| 746 | } | ||
| 747 | |||
| 748 | return false; | ||
| 749 | } | ||
| 750 | |||
| 751 | public boolean vaiPunti() { | ||
| 752 | /* Cerca di dare punti, cercando di darne il meno possibile (meglio | ||
| 753 | * un fante di re). */ | ||
| 754 | |||
| 755 | char[] auxCPU; | ||
| 756 | |||
| 757 | for ( int i = 0; i < 3; i++ ) { | ||
| 758 | if ( frame.carteCPU[i] != null ) { | ||
| 759 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 760 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) { | ||
| 761 | cartaDaGiocare = i; | ||
| 762 | return true; | ||
| 763 | } | ||
| 764 | } | ||
| 765 | } | ||
| 766 | |||
| 767 | for ( int i = 0; i < 3; i++ ) { | ||
| 768 | if ( frame.carteCPU[i] != null ) { | ||
| 769 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 770 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) { | ||
| 771 | cartaDaGiocare = i; | ||
| 772 | return true; | ||
| 773 | } | ||
| 774 | } | ||
| 775 | } | ||
| 776 | |||
| 777 | for ( int i = 0; i < 3; i++ ) { | ||
| 778 | if ( frame.carteCPU[i] != null ) { | ||
| 779 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 780 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) { | ||
| 781 | cartaDaGiocare = i; | ||
| 782 | return true; | ||
| 783 | } | ||
| 784 | } | ||
| 785 | } | ||
| 786 | |||
| 787 | return false; | ||
| 788 | } | ||
| 789 | public boolean vaiTaglio() { | ||
| 790 | |||
| 791 | char auxCPU[]; | ||
| 792 | |||
| 793 | for ( int i = 0; i < 3; i++ ) { | ||
| 794 | if ( frame.carteCPU[i] != null ) { | ||
| 795 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 796 | if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && | ||
| 797 | (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) && | ||
| 798 | (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) { | ||
| 799 | cartaDaGiocare = i; | ||
| 800 | return true; | ||
| 801 | } | ||
| 802 | } | ||
| 803 | } | ||
| 804 | |||
| 805 | return false; | ||
| 806 | } | ||
| 807 | public boolean vaiBriscolaAlta() { | ||
| 808 | |||
| 809 | char[] auxCPU; | ||
| 810 | |||
| 811 | for ( int i = 0; i < 3; i++ ) { | ||
| 812 | if ( frame.carteCPU[i] != null ) { | ||
| 813 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 814 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) { | ||
| 815 | cartaDaGiocare = i; | ||
| 816 | return true; | ||
| 817 | } | ||
| 818 | } | ||
| 819 | } | ||
| 820 | |||
| 821 | for ( int i = 0; i < 3; i++ ) { | ||
| 822 | if ( frame.carteCPU[i] != null ) { | ||
| 823 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 824 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) { | ||
| 825 | cartaDaGiocare = i; | ||
| 826 | return true; | ||
| 827 | } | ||
| 828 | } | ||
| 829 | } | ||
| 830 | |||
| 831 | for ( int i = 0; i < 3; i++ ) { | ||
| 832 | if ( frame.carteCPU[i] != null ) { | ||
| 833 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 834 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) { | ||
| 835 | cartaDaGiocare = i; | ||
| 836 | return true; | ||
| 837 | } | ||
| 838 | } | ||
| 839 | } | ||
| 840 | |||
| 841 | return false; | ||
| 842 | } | ||
| 843 | public boolean vaiTre() { | ||
| 844 | |||
| 845 | char auxCPU[]; | ||
| 846 | |||
| 847 | for ( int i = 0; i < 3; i++ ) { | ||
| 848 | if ( frame.carteCPU[i] != null ) { | ||
| 849 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 850 | if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) { | ||
| 851 | cartaDaGiocare = i; | ||
| 852 | return true; | ||
| 853 | } | ||
| 854 | } | ||
| 855 | } | ||
| 856 | |||
| 857 | return false; | ||
| 858 | } | ||
| 859 | public boolean vaiAsso() { | ||
| 860 | |||
| 861 | char auxCPU[]; | ||
| 862 | |||
| 863 | for ( int i = 0; i < 3; i++ ) { | ||
| 864 | if ( frame.carteCPU[i] != null ) { | ||
| 865 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 866 | if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) { | ||
| 867 | cartaDaGiocare = i; | ||
| 868 | return true; | ||
| 869 | } | ||
| 870 | } | ||
| 871 | } | ||
| 872 | |||
| 873 | return false; | ||
| 874 | } | ||
| 875 | public boolean vaiCarico() { | ||
| 876 | |||
| 877 | char[] auxCPU; | ||
| 878 | |||
| 879 | for ( int i = 0; i < 3; i++ ) { | ||
| 880 | if ( frame.carteCPU[i] != null ) { | ||
| 881 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 882 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) { | ||
| 883 | cartaDaGiocare = i; | ||
| 884 | return true; | ||
| 885 | } | ||
| 886 | } | ||
| 887 | } | ||
| 888 | |||
| 889 | for ( int i = 0; i < 3; i++ ) { | ||
| 890 | if ( frame.carteCPU[i] != null ) { | ||
| 891 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 892 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) { | ||
| 893 | cartaDaGiocare = i; | ||
| 894 | return true; | ||
| 895 | } | ||
| 896 | } | ||
| 897 | } | ||
| 898 | |||
| 899 | return false; | ||
| 900 | } | ||
| 901 | public boolean vaiSopra() { | ||
| 902 | /* Innanzitutto controlla se il giocatore ha giocato (non dovrebbe | ||
| 903 | * essere possibile, in quanto quando questo metodo viene chiamato | ||
| 904 | * tale condizione è già stata verificata, ma è sempre meglio un | ||
| 905 | * controllo in più che uno in meno) e restituisce false in caso | ||
| 906 | * contrario */ | ||
| 907 | if ( frame.giocata[0] == null ) | ||
| 908 | return false; | ||
| 909 | |||
| 910 | /* Tre variabili intere che serviranno a valutare quali delle tre | ||
| 911 | * carte è meglio giocare, se più di una può andare sopra. */ | ||
| 912 | int a = -1; | ||
| 913 | int b = -1; | ||
| 914 | int c = -1; | ||
| 915 | |||
| 916 | /* Tre booleane che verificano quali delle tre carte possono | ||
| 917 | * andare sopra. */ | ||
| 918 | boolean laPrimaPuoAndareSopra = false; | ||
| 919 | boolean laSecondaPuoAndareSopra = false; | ||
| 920 | boolean laTerzaPuoAndareSopra = false; | ||
| 921 | |||
| 922 | /* E tre array di caratteri ausiliari per leggere il nome delle | ||
| 923 | * carte, più quello per la carta giocata dal giocatore.*/ | ||
| 924 | char[] auxCPU1 = new char[1024]; | ||
| 925 | char[] auxCPU2 = new char[1024]; | ||
| 926 | char[] auxCPU3 = new char[1024]; | ||
| 927 | char[] aux = frame.giocata[0].toString().toCharArray(); | ||
| 928 | |||
| 929 | /* Se il giocatore ha giocato un asso, restituisce direttamente false. */ | ||
| 930 | if ( aux[aux.length-7] - 48 == 1 ) | ||
| 931 | return false; | ||
| 932 | |||
| 933 | /* Valuta quali delle tre carte possono andare sopra, dopo essersi | ||
| 934 | * accertato di averle: nelle ultime mani non si hanno tutte le carte | ||
| 935 | * in mano, e noi non vogliamo una NullPointerException sul più bello | ||
| 936 | * di una partita, vero?! */ | ||
| 937 | if ( frame.carteCPU[0] != null ) { | ||
| 938 | auxCPU1 = frame.carteCPU[0].toString().toCharArray(); | ||
| 939 | a = auxCPU1[auxCPU1.length-7] - 48; | ||
| 940 | if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) ) | ||
| 941 | laPrimaPuoAndareSopra = true; | ||
| 942 | } | ||
| 943 | |||
| 944 | if ( frame.carteCPU[1] != null ) { | ||
| 945 | auxCPU2 = frame.carteCPU[1].toString().toCharArray(); | ||
| 946 | b = auxCPU2[auxCPU2.length-7] - 48; | ||
| 947 | if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) ) | ||
| 948 | laSecondaPuoAndareSopra = true; | ||
| 949 | } | ||
| 950 | |||
| 951 | if ( frame.carteCPU[2] != null ) { | ||
| 952 | auxCPU3 = frame.carteCPU[2].toString().toCharArray(); | ||
| 953 | c = auxCPU3[auxCPU3.length-7] - 48; | ||
| 954 | if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) ) | ||
| 955 | laTerzaPuoAndareSopra = true; | ||
| 956 | } | ||
| 957 | |||
| 958 | /* Se nessuna carta può andare sopra, restituisce false. Se una | ||
| 959 | * sola delle tre può andare sopra la imposta come carta da giocare. */ | ||
| 960 | if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra ) | ||
| 961 | return false; | ||
| 962 | else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra ) | ||
| 963 | cartaDaGiocare = 0; | ||
| 964 | else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra ) | ||
| 965 | cartaDaGiocare = 1; | ||
| 966 | else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra ) | ||
| 967 | cartaDaGiocare = 2; | ||
| 968 | |||
| 969 | /* Se più di una carta può andare sopra, valuta quale è più alta. */ | ||
| 970 | else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra ) | ||
| 971 | if ( laPrimaEPiuAlta( a, b ) ) | ||
| 972 | cartaDaGiocare = 0; | ||
| 973 | else | ||
| 974 | cartaDaGiocare = 1; | ||
| 975 | else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra ) | ||
| 976 | if ( laPrimaEPiuAlta( b, c ) ) | ||
| 977 | cartaDaGiocare = 1; | ||
| 978 | else | ||
| 979 | cartaDaGiocare = 2; | ||
| 980 | else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra ) | ||
| 981 | if ( laPrimaEPiuAlta( a, c ) ) | ||
| 982 | cartaDaGiocare = 0; | ||
| 983 | else | ||
| 984 | cartaDaGiocare = 2; | ||
| 985 | else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra ) | ||
| 986 | if ( laPrimaEPiuAlta( a, b ) ) | ||
| 987 | if ( laPrimaEPiuAlta( a, c ) ) | ||
| 988 | cartaDaGiocare = 0; | ||
| 989 | else | ||
| 990 | cartaDaGiocare = 2; | ||
| 991 | else | ||
| 992 | if ( laPrimaEPiuAlta( b, c ) ) | ||
| 993 | cartaDaGiocare = 1; | ||
| 994 | else | ||
| 995 | cartaDaGiocare = 2; | ||
| 996 | |||
| 997 | /* Controlla che la carta con cui sta cercando di andare sopra | ||
| 998 | * sia una figura o un carico. Non vogliamo mica prendere delle | ||
| 999 | * scartelle con delle scartelle, giusto?! */ | ||
| 1000 | aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray(); | ||
| 1001 | if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) && | ||
| 1002 | (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) ) | ||
| 1003 | return false; | ||
| 1004 | |||
| 1005 | return true; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | /* I metodi seguenti valutano le carte che la CPU ha in mano. */ | ||
| 1009 | public boolean hoCarico() { | ||
| 1010 | |||
| 1011 | char auxCPU[]; | ||
| 1012 | |||
| 1013 | for ( int i = 0; i < 3; i++ ) { | ||
| 1014 | if ( frame.carteCPU[i] != null ) { | ||
| 1015 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 1016 | if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && | ||
| 1017 | ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) { | ||
| 1018 | return true; | ||
| 1019 | } | ||
| 1020 | } | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | return false; | ||
| 1024 | } | ||
| 1025 | public boolean hoAsso() { | ||
| 1026 | |||
| 1027 | char auxCPU[]; | ||
| 1028 | |||
| 1029 | for ( int i = 0; i < 3; i++ ) { | ||
| 1030 | if ( frame.carteCPU[i] != null ) { | ||
| 1031 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 1032 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) { | ||
| 1033 | return true; | ||
| 1034 | } | ||
| 1035 | } | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | return false; | ||
| 1039 | } | ||
| 1040 | public boolean hoTre() { | ||
| 1041 | |||
| 1042 | char auxCPU[]; | ||
| 1043 | |||
| 1044 | for ( int i = 0; i < 3; i++ ) { | ||
| 1045 | if ( frame.carteCPU[i] != null ) { | ||
| 1046 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 1047 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) { | ||
| 1048 | return true; | ||
| 1049 | } | ||
| 1050 | } | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | return false; | ||
| 1054 | } | ||
| 1055 | public boolean hoBriscolaAlta() { | ||
| 1056 | |||
| 1057 | char auxCPU[]; | ||
| 1058 | |||
| 1059 | for ( int i = 0; i < 3; i++ ) { | ||
| 1060 | if ( frame.carteCPU[i] != null ) { | ||
| 1061 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 1062 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 1063 | ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) { | ||
| 1064 | return true; | ||
| 1065 | } | ||
| 1066 | } | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | return false; | ||
| 1070 | } | ||
| 1071 | public boolean hoTaglio() { | ||
| 1072 | |||
| 1073 | char auxCPU[]; | ||
| 1074 | |||
| 1075 | for ( int i = 0; i < 3; i++ ) { | ||
| 1076 | if ( frame.carteCPU[i] != null ) { | ||
| 1077 | auxCPU = frame.carteCPU[i].toString().toCharArray(); | ||
| 1078 | if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && | ||
| 1079 | (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 ) | ||
| 1080 | && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) { | ||
| 1081 | return true; | ||
| 1082 | } | ||
| 1083 | } | ||
| 1084 | } | ||
| 1085 | |||
| 1086 | return false; | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | /* Imposta le opzioni dell'utente cercando di leggerle dal file di configurazione. */ | ||
| 1090 | public static void settaOpzioni() { | ||
| 1091 | |||
| 1092 | /* Impostazioni predefinite. */ | ||
| 1093 | lang = "it"; | ||
| 1094 | soundString = "suono=si"; | ||
| 1095 | keysString = "tasti=si"; | ||
| 1096 | int r = 0; | ||
| 1097 | int g = 150; | ||
| 1098 | int b = 0; | ||
| 1099 | |||
| 1100 | /* Cerca di leggere il file per impostare le opzioni. */ | ||
| 1101 | Scanner scanner = null; | ||
| 1102 | File file = new File( "JBriscolaConfig.txt" ); | ||
| 1103 | if ( file.exists() ) { | ||
| 1104 | try { | ||
| 1105 | scanner = new Scanner( file ); | ||
| 1106 | } catch ( FileNotFoundException e ) { } | ||
| 1107 | try { | ||
| 1108 | lang = scanner.next(); | ||
| 1109 | soundString = scanner.next(); | ||
| 1110 | keysString = scanner.next(); | ||
| 1111 | r = scanner.nextInt(); | ||
| 1112 | g = scanner.nextInt(); | ||
| 1113 | b = scanner.nextInt(); | ||
| 1114 | } catch ( NoSuchElementException e ) { } | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | /* Modifica le opzioni. */ | ||
| 1118 | if ( lang.equals( "it" ) ) { | ||
| 1119 | stringaBottonePrendi = "Prendi/Lascia carte"; | ||
| 1120 | stringaPrimaGioca = "Prima Gioca!"; | ||
| 1121 | stringaUltime4 = "Ultima carta - Occhio alla briscola!"; | ||
| 1122 | stringaVinto = "Hai Vinto!"; | ||
| 1123 | stringaPerso = "Hai Perso"; | ||
| 1124 | stringaPareggio = "Pareggio"; | ||
| 1125 | stringaGiocatore = "Giocatore: "; | ||
| 1126 | stringaComputer = "\nComputer: "; | ||
| 1127 | stringaNuovaPartita = "Nuova Partita"; | ||
| 1128 | stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?"; | ||
| 1129 | stringaVuoiDavveroUscire = "Vuoi davvero uscire?"; | ||
| 1130 | stringaSi = "Si"; | ||
| 1131 | stringaNo = "No"; | ||
| 1132 | stringaOpzioni = "Opzioni..."; | ||
| 1133 | stringaEsci = "Esci"; | ||
| 1134 | stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n"; | ||
| 1135 | stringaLingua = "Lingua"; | ||
| 1136 | stringaAnnulla = "Annulla"; | ||
| 1137 | stringaIt = "Italiano"; | ||
| 1138 | stringaLa = "Latino"; | ||
| 1139 | stringaBL = "Dialetto Bellunese"; | ||
| 1140 | stringaBV = "Dialetto Basso Veneto"; | ||
| 1141 | stringaEN = "Inglese"; | ||
| 1142 | stringaModificaOpzioni = "Modifica Opzioni"; | ||
| 1143 | stringaInformazioni = "Informazioni"; | ||
| 1144 | stringaInformazioni2 = "JBriscola e' un gioco di briscola per pc scritto in java ideato\ne realizzato da Sebastiano Tronto. Il gioco viene rilasciato sotto licenza GNU/Gpl versione 2 o successive; questo permette\npotenzialmente a chiunque di modificare il gioco partendo dal codice sorgente del programma. Se non avete ricevuto i sorgenti\nassieme al gioco, potete richiedermeli con un'e-mail a sebastiano@luganega.org.\n\nJBriscola version" + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 1145 | stringaSuono = "Effetti sonori"; | ||
| 1146 | stringaPunteggio = "Punteggio"; | ||
| 1147 | stringaSfondo = "Sfondo"; | ||
| 1148 | stringaTasti = "Tasti rapidi"; | ||
| 1149 | stringaAggiornamenti = "Cerca aggiornamenti"; | ||
| 1150 | stringaAggiornamentiSi = "Aggiornamento disponibile: "; | ||
| 1151 | stringaAggiornamentiNo = "Nessun aggiornamento disponibile"; | ||
| 1152 | stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html"; | ||
| 1153 | stringaNoInternet = "Errore: nessuna connessione internet"; | ||
| 1154 | stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 1155 | } | ||
| 1156 | else if ( lang.equals( "la" ) ) { | ||
| 1157 | stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS"; | ||
| 1158 | stringaPrimaGioca = "ANTE CHARTAM PONE!"; | ||
| 1159 | stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!"; | ||
| 1160 | stringaVinto = "VICISTI!"; | ||
| 1161 | stringaPerso = "PERDIDISTI"; | ||
| 1162 | stringaPareggio = "AEQVATIO!"; | ||
| 1163 | stringaGiocatore = "LVSOR: "; | ||
| 1164 | stringaComputer = "\nCOMPVTER: "; | ||
| 1165 | stringaNuovaPartita = "NOVA LVSO"; | ||
| 1166 | stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?"; | ||
| 1167 | stringaVuoiDavveroUscire = "EXIRE?"; | ||
| 1168 | stringaSi = "ID VOLO"; | ||
| 1169 | stringaNo = "NOLO"; | ||
| 1170 | stringaOpzioni = "OPTIONES..."; | ||
| 1171 | stringaEsci = "EXIRE"; | ||
| 1172 | stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n"; | ||
| 1173 | stringaLingua = "LINGVA"; | ||
| 1174 | stringaAnnulla = "ABROGA"; | ||
| 1175 | stringaIt = "ITALICA"; | ||
| 1176 | stringaLa = "LATINA"; | ||
| 1177 | stringaBL = "BELLUNI"; | ||
| 1178 | stringaBV = "VENETIAE"; | ||
| 1179 | stringaEN = "ANGLICVS"; | ||
| 1180 | stringaModificaOpzioni = "OPTIONES NOVARE"; | ||
| 1181 | stringaInformazioni = "INFORMATIONES"; | ||
| 1182 | stringaInformazioni2 = "JBriscola EST LVDVM BRISCOLAE COMPVTERI, JAVA SCRIPTVM, EXCOGITATVM\nFACTVMQUE A SEBASTIANO TRONTO. IPSVM LUDVM REICITUR LICENTIA GNU/Gpl VERSIONE 2 AVT POSTERIORIBUS; ID\nOMNIBVS LVDVM MUTARE CODICE IPSIVS INCIPIENDO LICET. SI CODICES CUM\nLVDO NON PERVENIT, EOS POSCERE POTESTIS E-MAILE sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 1183 | stringaSuono = "SONVS"; | ||
| 1184 | stringaPunteggio = "NVMERI"; | ||
| 1185 | stringaSfondo = "COLOR"; | ||
| 1186 | stringaTasti = "TASTI RAPIDI"; | ||
| 1187 | stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE"; | ||
| 1188 | stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST"; | ||
| 1189 | stringaAggiornamentiSi = "VERSIO RECENTIOR EST: "; | ||
| 1190 | stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST"; | ||
| 1191 | stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html"; | ||
| 1192 | stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 1193 | } | ||
| 1194 | if ( lang.equals( "bl" ) ) { | ||
| 1195 | stringaBottonePrendi = "Cio' su/lasa le carte"; | ||
| 1196 | stringaPrimaGioca = "Prima Duga!"; | ||
| 1197 | stringaUltime4 = "Ultima carta - Ocio a la briscola!"; | ||
| 1198 | stringaVinto = "Te ha vint!"; | ||
| 1199 | stringaPerso = "Te ha pers"; | ||
| 1200 | stringaPareggio = "Pari"; | ||
| 1201 | stringaGiocatore = "Dugador: "; | ||
| 1202 | stringaComputer = "\nComputer: "; | ||
| 1203 | stringaNuovaPartita = "Taca n'altra partida"; | ||
| 1204 | stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?"; | ||
| 1205 | stringaVuoiDavveroUscire = "Utu sul serio stusar su?"; | ||
| 1206 | stringaSi = "Si"; | ||
| 1207 | stringaNo = "No"; | ||
| 1208 | stringaOpzioni = "Opzioni..."; | ||
| 1209 | stringaEsci = "Stusa su"; | ||
| 1210 | stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n"; | ||
| 1211 | stringaLingua = "Lengua"; | ||
| 1212 | stringaAnnulla = "Annulla"; | ||
| 1213 | stringaIt = "Italian"; | ||
| 1214 | stringaLa = "Latin"; | ||
| 1215 | stringaBL = "Dialeto de Belun"; | ||
| 1216 | stringaBV = "Dialeto de la basa"; | ||
| 1217 | stringaEN = "Inglese"; | ||
| 1218 | stringaModificaOpzioni = "Modifica Opzioni"; | ||
| 1219 | stringaInformazioni = "Informazioni"; | ||
| 1220 | stringaInformazioni2 = "JBriscola le' an dugo de briscola par computer scrit in java, pensa' e realiza'\n da Sebastiano Tronto. Al dugo l'e' sotto licenza GNU/Gpl versione 2 o sucesive; questo ol dir che chi che ol\n(se l'e' bon) al pol modificar al dugo coi codici sorgenti del programa. Se no i ve ha dat i sorgenti\nasieme al dugo, pote' domandarmeli co na e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 1221 | stringaSuono = "Efeti sonori"; | ||
| 1222 | stringaPunteggio = "Varda i punti"; | ||
| 1223 | stringaSfondo = "Sfondo"; | ||
| 1224 | stringaTasti = "Tasti rapidi"; | ||
| 1225 | stringaAggiornamenti = "Varda se ghe ne' na version pi nova"; | ||
| 1226 | stringaAggiornamentiSi = "Ghe ne' na version pi nova: "; | ||
| 1227 | stringaAggiornamentiNo = "No ghe ne na version pi nova"; | ||
| 1228 | stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html"; | ||
| 1229 | stringaNoInternet = "Erore: no te se su internet"; | ||
| 1230 | stringaTasti2 = "1 Duga la prima carta\n2 Duga la seconda carta\n3 Duga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 1231 | } | ||
| 1232 | if ( lang.equals( "bv" ) ) { | ||
| 1233 | stringaBottonePrendi = "Ciapa su/lasa e carte"; | ||
| 1234 | stringaPrimaGioca = "Prima Zuga!"; | ||
| 1235 | stringaUltime4 = "Ultima carta - Ocio a la briscola!"; | ||
| 1236 | stringaVinto = "Ti ga vinto!"; | ||
| 1237 | stringaPerso = "Ti ga perso"; | ||
| 1238 | stringaPareggio = "Pari"; | ||
| 1239 | stringaGiocatore = "Zugador: "; | ||
| 1240 | stringaComputer = "\nComputer: "; | ||
| 1241 | stringaNuovaPartita = "N'altra Partida"; | ||
| 1242 | stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?"; | ||
| 1243 | stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?"; | ||
| 1244 | stringaSi = "Si"; | ||
| 1245 | stringaNo = "No"; | ||
| 1246 | stringaOpzioni = "Opzioni..."; | ||
| 1247 | stringaEsci = "Stusa su"; | ||
| 1248 | stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n"; | ||
| 1249 | stringaLingua = "Lengua"; | ||
| 1250 | stringaAnnulla = "Annulla"; | ||
| 1251 | stringaIt = "Italian"; | ||
| 1252 | stringaLa = "Latin"; | ||
| 1253 | stringaBL = "Dialeto Belumat"; | ||
| 1254 | stringaBV = "Dialeto Veneto"; | ||
| 1255 | stringaEN = "Inglese"; | ||
| 1256 | stringaModificaOpzioni = "Modifica Opzioni"; | ||
| 1257 | stringaInformazioni = "Informasioni"; | ||
| 1258 | stringaInformazioni2 = "JBriscola xe an zugo de briscola par computer scrito in java, pensato e realisato\n da Sebastiano Tronto. Al zugo xe sotto licenza GNU/Gpl versione 2 o sucesive; questo vol dire che chi che\nvol (se xe bono) al pol modificare al zugo coi codici sorgenti del programa. Se no i ve ha dato i sorgenti\nasieme al zugo, pote' domandarmeli co na e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 1259 | stringaSuono = "Efeti sonori"; | ||
| 1260 | stringaPunteggio = "Varda i punti"; | ||
| 1261 | stringaSfondo = "Sfondo"; | ||
| 1262 | stringaTasti = "Tasti rapidi"; | ||
| 1263 | stringaAggiornamenti = "Varda se xe ne' na versione pi nova"; | ||
| 1264 | stringaAggiornamentiSi = "Ghe xe na versione pi nova: "; | ||
| 1265 | stringaAggiornamentiNo = "No ghe xe na versione pi nova"; | ||
| 1266 | stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html"; | ||
| 1267 | stringaNoInternet = "Erore: no ti xe su internet"; | ||
| 1268 | stringaTasti2 = "1 Zuga la prima carta\n2 Zuga la seconda carta\n3 Zuga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 1269 | } | ||
| 1270 | if ( lang.equals( "en" ) ) { | ||
| 1271 | stringaBottonePrendi = "Take/leave cards"; | ||
| 1272 | stringaPrimaGioca = "Play your card before!"; | ||
| 1273 | stringaUltime4 = "Last card - keep your eye on the briscola!"; | ||
| 1274 | stringaVinto = "You won!"; | ||
| 1275 | stringaPerso = "You lost"; | ||
| 1276 | stringaPareggio = "Sixty - sixty!"; | ||
| 1277 | stringaGiocatore = "Palyer: "; | ||
| 1278 | stringaComputer = "\nComputer: "; | ||
| 1279 | stringaNuovaPartita = "New Game"; | ||
| 1280 | stringaVuoiDavveroIniziare = "Do you really want to start a new game?"; | ||
| 1281 | stringaVuoiDavveroUscire = "Do you really want to exit?"; | ||
| 1282 | stringaSi = "Yes"; | ||
| 1283 | stringaNo = "No"; | ||
| 1284 | stringaOpzioni = "Options..."; | ||
| 1285 | stringaEsci = "Exit"; | ||
| 1286 | stringaImpossibileConfigurare = "Couldn't write to the configuration file.\nPlease report the bug to: sebastiano@luganega.org\n\nException:\n"; | ||
| 1287 | stringaLingua = "Lang"; | ||
| 1288 | stringaAnnulla = "Cancel"; | ||
| 1289 | stringaIt = "Italian"; | ||
| 1290 | stringaLa = "Latin"; | ||
| 1291 | stringaBL = "Belluno dialect"; | ||
| 1292 | stringaBV = "Venice dialect"; | ||
| 1293 | stringaEN = "English"; | ||
| 1294 | stringaModificaOpzioni = "Change options"; | ||
| 1295 | stringaInformazioni = "Information"; | ||
| 1296 | stringaInformazioni2 = "JBriscola is a briscola pc game written in java, meant\nand made by Sebastiano Tronto. The game is protected by the GNU/General public licence version 2 or later.\n\nJBriscola version" + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org"; | ||
| 1297 | stringaSuono = "Sound"; | ||
| 1298 | stringaPunteggio = "Score"; | ||
| 1299 | stringaSfondo = "Background"; | ||
| 1300 | stringaTasti = "Hot keys"; | ||
| 1301 | stringaAggiornamenti = "Check updates"; | ||
| 1302 | stringaAggiornamentiSi = "Update available: "; | ||
| 1303 | stringaAggiornamentiNo = "No updates available"; | ||
| 1304 | stringaScarica = "You can get the latest version from the site\nhttp://porkynator.altervista.org/programmi.html"; | ||
| 1305 | stringaNoInternet = "Error: no internet connection"; | ||
| 1306 | stringaTasti2 = "1 Play the first card\n2 Play the second card\n3 Play the third card\nF1 Get this message\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nq " + stringaEsci; | ||
| 1307 | } | ||
| 1308 | sound = ( soundString.equals( "suono=si" ) ); | ||
| 1309 | keys = ( keysString.equals( "tasti=si" ) ); | ||
| 1310 | color = new Color( r, g, b ); | ||
| 1311 | if ( frame != null ) { | ||
| 1312 | frame.pannello.repaint(); | ||
| 1313 | frame.pannello2.repaint(); | ||
| 1314 | frame.repaint(); | ||
| 1315 | } | ||
| 1316 | } | ||
| 1317 | } | ||
