ancient-projects

My earliest programs (2006-2010)
git clone https://git.tronto.net/ancient-projects
Download | Log | Files | Refs | README

Main.java (57737B)


      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 	/*Costanti per i semi e i valori delle carte*/
     30 	public static final int COPPE = 0;
     31 	public static final int BASTONI = 1;
     32 	public static final int DENARI = 2;
     33 	public static final int SPADE = 3;
     34 	public static final int RE = 0;	
     35 	public static final int ASSO = 1;
     36 	public static final int DUE = 2;
     37 	public static final int TRE = 3;
     38 	public static final int QUATTRO = 4;
     39 	public static final int CINQUE = 5;
     40 	public static final int SEI = 6;
     41 	public static final int SETTE = 7;
     42 	public static final int FANTE = 8;
     43 	public static final int CAVALLO = 9;
     44 	
     45 	/* semeBriscola serve a determinare quale il seme di briscola (0 coppe,
     46 	 * 1 bastoni, 2 denari, 3 spade).
     47 	 * punteggio è il punteggio del giocatore, punteggioCPU quello della CPU
     48 	 * mano tiene il conto della mano a cui si è arrivati.
     49 	 * cartaDaPescare è la carta che la CPU deve raccogliere dal mazzo
     50 	 * cartaDaGiocare (può assumere valore compraso tra 0 e 2) è la carta
     51 	 * che la cpu deve giocare. */
     52 	public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
     53 	
     54 	/* toccaAllaCPU determina se è il turno del computer o del giocatore,
     55 	 * CPUHaGiocato se il computer ha già giocato in questo turno e
     56 	 * haGiocatoPrima se la prima mossa del turno è stata del giocatore
     57 	 * (true) o della CPU (false).
     58 	 * aiTrenta serve per determinare se la partida che si sta giocando è
     59 	 * normale o ai 30.
     60 	 * carteScoperte serve se viene attivato il trucco per mostrare le
     61 	 * carte della CPU.
     62 	 * sound e keys riguardano le opzioni (souno si o no, tasti rapidi si
     63 	 * o no) salvate nel file di configurazione. */
     64 	public static boolean toccaAllaCPU = false;
     65 	public static boolean CPUHaGiocato = false;
     66 	public static boolean haGiocatoPrima = true;
     67 	public static boolean aiTrenta = false;
     68 	public static boolean carteScoperte = false;
     69 	public static boolean sound = true;
     70 	public static boolean keys = true;
     71 	
     72 	/* frame è la finestra principale del gioco, color il colore dello sfondo.
     73 	 * lang, soundString e keysString servono a leggere le opzioni dal file
     74 	 * di configurazione. */
     75 	public static Frame frame;
     76 	public static Color color = new Color( 0, 150, 0 );
     77 	public static String lang, soundString, keysString;
     78 
     79 	/* Tutte le stringhe che vengono utilizzate durante il gioco sono
     80 	 * inizializzate qui, per poter essere tradotte in altre lingue. */
     81 	public static String version = "0.3.1";
     82 	public static String semi[] = { "Bastoni", "Coppe", "Denari", "Spade" };
     83 	public static String stringaBriscola = "Briscola";
     84 	public static String stringaBottonePrendi = "Prendi/Lascia carte";
     85 	public static String stringaPrimaGioca = "Prima Gioca!";
     86 	public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
     87 	public static String stringaVinto = "Hai Vinto!";
     88 	public static String stringaPerso = "Hai Perso";
     89 	public static String stringaPareggio = "Pareggio";
     90 	public static String stringaGiocatore = "Giocatore: ";
     91 	public static String stringaComputer = "\nComputer: ";
     92 	public static String stringaNuovaPartita = "Nuova Partita";
     93 	public static String stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
     94 	public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
     95 	public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
     96 	public static String stringaSi = "Si";
     97 	public static String stringaNo = "No";
     98 	public static String stringaOpzioni = "Opzioni...";
     99 	public static String stringaEsci = "Esci";
    100 	public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
    101 	public static String stringaLingua = "Lingua";
    102 	public static String stringaAnnulla = "Annulla";
    103 	public static String stringaIt = "Italiano";
    104 	public static String stringaLa = "Latino";
    105 	public static String stringaBL = "Dialetto Bellunese";
    106 	public static String stringaBV = "Dialetto Basso Veneto";
    107 	public static String stringaEN = "Inglese";
    108 	public static String stringaModificaOpzioni = "Modifica Opzioni";
    109 	public static String stringaInformazioni = "Informazioni";
    110 	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";
    111 	public static String stringaSuono = "Effetti Sonori";
    112 	public static String stringaPunteggio = "Punteggio";
    113 	public static String stringaSfondo = "Sfondo";
    114 	public static String stringaTasti = "Tasti rapidi";
    115 	public static String stringaAggiornamenti = "Cerca aggiornamenti";
    116 	public static String stringaTrucchi = "Trucchi";
    117 	public static String stringaInserisciCodice = "Inserisci il codice:";
    118 	public static String stringaTruccoAttivato = "Trucco attivato!";
    119 	public static String stringaTruccoSbagliato = "Trucco non valido";
    120 	public static String stringaCheCartaVuoi = "E allora che carta vuoi?";
    121 	public static String stringaAggiornamentiSi = "Aggiornamento disponibile: ";
    122 	public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
    123 	public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
    124 	public static String stringaNoInternet = "Errore: nessuna connessione internet";
    125 	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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
    126 
    127 	public static void main( String args[] ) {
    128 		
    129 		/* Chiama il metodo settaOpzioni per leggere le impostazioni
    130 		 * dell'utente da un eventuale file di configurazione */
    131 		settaOpzioni();
    132 		
    133 		/* Crea la finestra principale del gioco e la posiziona al centro
    134 		 * dello schermo. */
    135 		frame = new Frame();
    136 		frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
    137 		frame.setResizable( false );
    138 		frame.setSize( 600, 600 );
    139 		frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
    140 		frame.setVisible( true );
    141 	}
    142 	
    143 	/* Algoritmo per mischiare il mazzo: prende due carte a caso e le
    144 	 * inverte di posto, utilizzando una variabile aux. Ripete il procedimento
    145 	 * per 391 volte. */
    146 	public void mischia() {
    147 		
    148 		ImageIcon aux;
    149 		
    150 		mano = 0;
    151 		punteggio = 0;
    152 		punteggioCPU = 0;
    153 		cartaDaPescare = 6;
    154 		frame.mazzo = true;
    155 		toccaAllaCPU = false;
    156 		CPUHaGiocato = false;
    157 		haGiocatoPrima = true;
    158 		frame.mazzo = true;
    159 		
    160 		/* Inizializza l'array di carte mescolate ordinato */
    161 		for ( int i = 0, k = 0; i < 10; i++ )
    162 			for ( int j = 0; j < 4; j++, k++ )
    163 				frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
    164 		
    165 		/* Mescola le carte utilizzando il metodo sopra citato */
    166 		for ( int i = 0; i < 391; i++ ) {
    167 			double a = Math.random() * 40;
    168 			int x = (int) a;
    169 			double b = Math.random() * 40;
    170 			int y = (int) b;
    171 			aux = frame.arrayCarteMescolate[x];
    172 			frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
    173 			frame.arrayCarteMescolate[y] = aux;
    174 		}
    175 		
    176 		/* Imposta il seme della briscola */
    177 		semeBriscola = seme( frame.arrayCarteMescolate[39] );
    178 		
    179 		/* Distribuisce le carte */
    180 		frame.carteInMano[0] = frame.arrayCarteMescolate[0];
    181 		frame.carteInMano[1] = frame.arrayCarteMescolate[1];
    182 		frame.carteInMano[2] = frame.arrayCarteMescolate[2];
    183 		frame.carteCPU[0] = frame.arrayCarteMescolate[3];
    184 		frame.carteCPU[1] = frame.arrayCarteMescolate[4];
    185 		frame.carteCPU[2] = frame.arrayCarteMescolate[5];
    186 		frame.ultimaCarta = frame.arrayCarteMescolate[39];
    187 		frame.giocata[0] = null;
    188 		frame.giocata[1] = null;
    189 	}
    190 	
    191 	/* Viene chiamato a fine partita. */
    192 	public void pulisciTavolo() {
    193 		
    194 		punteggio = 0;
    195 		punteggioCPU = 0;
    196 		cartaDaPescare = 6;
    197 		toccaAllaCPU = false;
    198 		CPUHaGiocato = false;
    199 		haGiocatoPrima = true;
    200 		
    201 		frame.mazzo = false;
    202 		frame.ultimaCarta = null;
    203 		for ( int i = 0; i < 3; i++ ) {
    204 			frame.carteCPU[i] = null;
    205 			frame.carteInMano[i] = null;
    206 		}
    207 		
    208 		frame.pannello.repaint();
    209 		frame.repaint();
    210 		
    211 	}
    212 	
    213 	/* Fa giocare la CPU. Questo metodo contiene l'intelligenza artificiale
    214 	 * del gioco. Ho preferito non commentare molto il corpo del metodo per
    215 	 * due motivi; il primo è che abbastanza intuitivo: basta sapere che i
    216 	 * vari metodi vaiLiscio(), vaiTaglio() ecc... tentano di fare ciò che
    217 	 * ovviamente dice il loro nome, se ci riescono restituiscono true,
    218 	 * in caso contrario false.*/
    219 	public void giocaCPU() {
    220 		
    221 		/* Nelle prime 16 mani ragiona in maniera diversa*/
    222 		if ( mano < 16 ) {
    223 			
    224 			/* Valuta cosa fare se il giocatore non ha ancora giocato. */
    225 			if ( frame.giocata[0] == null ) {
    226 				if ( vaiPunti() );
    227 				else if ( vaiLiscio() );
    228 				else if ( vaiTaglio() );
    229 				else if ( vaiBriscolaAlta() );
    230 				else if ( vaiCarico() );
    231 				else if ( vaiTre() );
    232 				else if ( vaiAsso() );
    233 				else;
    234 			}
    235 			
    236 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    237 			else {
    238 				if ( haLisciato() ) {
    239 					if ( vaiSopra() );
    240 					else if ( vaiLiscio() );
    241 					else if ( vaiPunti() );
    242 					else if ( vaiTaglio() );
    243 					else if ( vaiTre() );
    244 					else if ( vaiBriscolaAlta() );
    245 					else if ( vaiCarico() );
    246 					else if ( vaiAsso() );
    247 				} else if ( haMessoPunti() ) {
    248 					if ( vaiSopra() );
    249 					else if ( vaiLiscio() );
    250 					else if ( vaiTaglio() );
    251 					else if ( vaiPunti() );
    252 					else if ( vaiTre() );
    253 					else if ( vaiBriscolaAlta() );
    254 					else if ( vaiCarico() );
    255 					else if ( vaiAsso() );
    256 				} else if ( haTagliato() ) {
    257 					if ( vaiLiscio() );
    258 					else if ( vaiPunti() );
    259 					else if ( vaiTaglio() );
    260 					else if ( vaiTre() );
    261 					else if ( vaiBriscolaAlta() );
    262 					else if ( vaiCarico() );
    263 					else if ( vaiAsso() );
    264 				} else if ( haMessoBriscolaAlta() ) {
    265 					if ( vaiLiscio() );
    266 					else if ( vaiPunti() );
    267 					else if ( vaiTre() );
    268 					else if ( vaiTaglio() );
    269 					else if ( vaiBriscolaAlta() );
    270 					else if ( vaiCarico() );
    271 					else if ( vaiAsso() );
    272 				} else if ( haMessoTre() ) {
    273 					if ( vaiAsso() );
    274 					else if ( vaiLiscio() );
    275 					else if ( vaiPunti() );
    276 					else if ( vaiTaglio() );
    277 					else if ( vaiBriscolaAlta() );
    278 					else if ( vaiCarico() );
    279 				} else if ( haMessoAsso() ) {
    280 					if ( vaiLiscio() );
    281 					else if ( vaiPunti() );
    282 					else if ( vaiTaglio() );
    283 					else if ( vaiBriscolaAlta() );
    284 					else if ( vaiCarico() );
    285 					else if ( vaiTre() );
    286 				} else if ( haCaricato() ) {
    287 					if ( vaiSopra() );
    288 					else if ( vaiTre() );
    289 					else if ( vaiBriscolaAlta() );
    290 					else if ( vaiTaglio() );
    291 					else if ( vaiAsso() );
    292 					else if ( vaiLiscio() );
    293 					else if ( vaiPunti() );
    294 					else if ( vaiCarico() );
    295 				}
    296 			}
    297 		}
    298 		
    299 		/* Nella penultima mano (prima di pescare l'ultima carta) */
    300 		else if ( mano == 16 ) {
    301 			
    302 			/* Valuta cosa fare se il giocatore non ha ancora giocato. */
    303 			if ( frame.giocata[0] == null ) {
    304 				if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
    305 					if ( vaiCarico() );
    306 					else if ( vaiPunti() );
    307 					else if ( vaiLiscio() );
    308 					else if ( vaiTaglio() );
    309 					else if ( vaiBriscolaAlta() );
    310 					else if ( vaiTre() );
    311 					else if ( vaiAsso() );
    312 					else;
    313 				} else {
    314 					if ( vaiPunti() );
    315 					else if ( vaiLiscio() );
    316 					else if ( vaiTaglio() );
    317 					else if ( vaiBriscolaAlta() );
    318 					else if ( vaiCarico() );
    319 					else if ( vaiTre() );
    320 					else if ( vaiAsso() );
    321 					else;
    322 				}
    323 			}
    324 			
    325 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    326 			else {
    327 				if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
    328 					if ( haCaricato() ) {
    329 						if ( vaiSopra() );
    330 						else if ( vaiLiscio() );
    331 						else if ( vaiPunti() );
    332 						else if ( vaiTre() );
    333 						else if ( vaiTaglio() );
    334 						else if ( vaiBriscolaAlta() );
    335 						else if ( vaiAsso() );
    336 						else if ( vaiCarico() );
    337 					}
    338 				} else {
    339 					if ( haLisciato() ) {
    340 						if ( vaiSopra() );
    341 						else if ( vaiLiscio() );
    342 					else if ( vaiPunti() );
    343 						else if ( vaiTaglio() );
    344 						else if ( vaiTre() );
    345 						else if ( vaiBriscolaAlta() );
    346 						else if ( vaiCarico() );
    347 						else if ( vaiAsso() );
    348 					} else if ( haMessoPunti() ) {
    349 						if ( vaiSopra() );
    350 						else if ( vaiLiscio() );
    351 						else if ( vaiTaglio() );
    352 						else if ( vaiPunti() );
    353 						else if ( vaiTre() );
    354 						else if ( vaiBriscolaAlta() );
    355 						else if ( vaiCarico() );
    356 						else if ( vaiAsso() );
    357 					} else if ( haTagliato() ) {
    358 						if ( vaiLiscio() );
    359 						else if ( vaiPunti() );
    360 						else if ( vaiTaglio() );
    361 						else if ( vaiTre() );
    362 						else if ( vaiBriscolaAlta() );
    363 						else if ( vaiCarico() );
    364 						else if ( vaiAsso() );
    365 					} else if ( haMessoBriscolaAlta() ) {
    366 						if ( vaiLiscio() );
    367 						else if ( vaiPunti() );
    368 						else if ( vaiTre() );
    369 						else if ( vaiTaglio() );
    370 						else if ( vaiBriscolaAlta() );
    371 						else if ( vaiCarico() );
    372 						else if ( vaiAsso() );
    373 					} else if ( haMessoTre() ) {
    374 						if ( vaiAsso() );
    375 						else if ( vaiLiscio() );
    376 						else if ( vaiPunti() );
    377 						else if ( vaiTaglio() );
    378 						else if ( vaiBriscolaAlta() );
    379 						else if ( vaiCarico() );
    380 					} else if ( haMessoAsso() ) {
    381 						if ( vaiLiscio() );
    382 						else if ( vaiPunti() );
    383 						else if ( vaiTaglio() );
    384 						else if ( vaiBriscolaAlta() );
    385 						else if ( vaiCarico() );
    386 						else if ( vaiTre() );
    387 					} else if ( haCaricato() ) {
    388 						if ( vaiSopra() );
    389 						else if ( vaiTre() );
    390 						else if ( vaiBriscolaAlta() );
    391 						else if ( vaiAsso() );
    392 						else if ( vaiTaglio() );
    393 						else if ( vaiLiscio() );
    394 						else if ( vaiPunti() );
    395 						else if ( vaiCarico() );
    396 					}
    397 				}
    398 			}
    399 			
    400 		} else if ( mano == 17 ) {
    401 			
    402 			/* Valuta cosa fare se il giocatore non ha ancora giocato. */
    403 			if ( frame.giocata[0] == null ) {
    404 				if ( hoAsso() ) {
    405 					if ( vaiTre() );
    406 					else if ( vaiBriscolaAlta() );
    407 					else if ( vaiTaglio() );
    408 					else if ( vaiLiscio() );
    409 					else if ( vaiPunti() );
    410 					else if ( vaiAsso() );
    411 					else if ( vaiCarico() );
    412 				} else {
    413 					if ( vaiLiscio() );
    414 					else if ( vaiPunti() );
    415 					else if ( vaiTaglio() );
    416 					else if ( vaiBriscolaAlta() );
    417 					else if ( vaiCarico() );
    418 					else if ( vaiTre() );
    419 				}
    420 			}
    421 			
    422 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    423 			else {
    424 				if ( haLisciato() ) {
    425 					if ( vaiSopra() );
    426 					else if ( vaiLiscio() );
    427 					else if ( vaiPunti() );
    428 					else if ( vaiTaglio() );
    429 					else if ( vaiTre() );
    430 					else if ( vaiBriscolaAlta() );
    431 					else if ( vaiCarico() );
    432 					else if ( vaiAsso() );
    433 				} else if ( haMessoPunti() ) {
    434 					if ( vaiSopra() );
    435 					else if ( vaiLiscio() );
    436 					else if ( vaiTaglio() );
    437 					else if ( vaiPunti() );
    438 					else if ( vaiTre() );
    439 					else if ( vaiBriscolaAlta() );
    440 					else if ( vaiCarico() );
    441 					else if ( vaiAsso() );
    442 				} else if ( haTagliato() ) {
    443 					if ( vaiLiscio() );
    444 					else if ( vaiPunti() );
    445 					else if ( vaiTaglio() );
    446 					else if ( vaiTre() );
    447 					else if ( vaiBriscolaAlta() );
    448 					else if ( vaiCarico() );
    449 					else if ( vaiAsso() );
    450 				} else if ( haMessoBriscolaAlta() ) {
    451 					if ( vaiLiscio() );
    452 					else if ( vaiPunti() );
    453 					else if ( vaiTre() );
    454 					else if ( vaiTaglio() );
    455 					else if ( vaiBriscolaAlta() );
    456 					else if ( vaiCarico() );
    457 					else if ( vaiAsso() );
    458 				} else if ( haMessoTre() ) {
    459 					if ( vaiAsso() );
    460 					else if ( vaiLiscio() );
    461 					else if ( vaiPunti() );
    462 					else if ( vaiTaglio() );
    463 					else if ( vaiBriscolaAlta() );
    464 					else if ( vaiCarico() );
    465 				} else if ( haMessoAsso() ) {
    466 					if ( vaiLiscio() );
    467 					else if ( vaiPunti() );
    468 					else if ( vaiTaglio() );
    469 					else if ( vaiBriscolaAlta() );
    470 					else if ( vaiCarico() );
    471 					else if ( vaiTre() );
    472 				} else if ( haCaricato() ) {
    473 					if ( vaiSopra() );
    474 					else if ( vaiTre() );
    475 					else if ( vaiBriscolaAlta() );
    476 					else if ( vaiAsso() );
    477 					else if ( vaiTaglio() );
    478 					else if ( vaiLiscio() );
    479 					else if ( vaiPunti() );
    480 					else if ( vaiCarico() );
    481 				}
    482 			}
    483 			
    484 		} else if ( mano == 18 ) {
    485 			
    486 			/* Valuta cosa fare se il giocatore non ha ancora giocato. */
    487 			if ( frame.giocata[0] == null ) {
    488 				if ( vaiAsso() );
    489 				else if ( vaiCarico() );
    490 				else if ( vaiBriscolaAlta() );
    491 				else if ( vaiTaglio() );
    492 				else if ( vaiPunti() );
    493 				else if ( vaiLiscio() );
    494 				else if ( vaiTre() );
    495 			}
    496 			
    497 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    498 			else {
    499 				if ( haLisciato() ) {
    500 					if ( vaiSopra() );
    501 					else if ( vaiLiscio() );
    502 					else if ( vaiPunti() );
    503 					else if ( vaiTaglio() );
    504 					else if ( vaiTre() );
    505 					else if ( vaiBriscolaAlta() );
    506 					else if ( vaiCarico() );
    507 					else if ( vaiAsso() );
    508 				} else if ( haMessoPunti() ) {
    509 					if ( vaiSopra() );
    510 					else if ( vaiLiscio() );
    511 					else if ( vaiTaglio() );
    512 					else if ( vaiPunti() );
    513 					else if ( vaiTre() );
    514 					else if ( vaiBriscolaAlta() );
    515 					else if ( vaiCarico() );
    516 					else if ( vaiAsso() );
    517 				} else if ( haTagliato() ) {
    518 					if ( vaiLiscio() );
    519 					else if ( vaiPunti() );
    520 					else if ( vaiTaglio() );
    521 					else if ( vaiTre() );
    522 					else if ( vaiBriscolaAlta() );
    523 					else if ( vaiCarico() );
    524 					else if ( vaiAsso() );
    525 				} else if ( haMessoBriscolaAlta() ) {
    526 					if ( vaiLiscio() );
    527 					else if ( vaiPunti() );
    528 					else if ( vaiTre() );
    529 					else if ( vaiTaglio() );
    530 					else if ( vaiBriscolaAlta() );
    531 					else if ( vaiCarico() );
    532 					else if ( vaiAsso() );
    533 				} else if ( haMessoTre() ) {
    534 					if ( vaiAsso() );
    535 					else if ( vaiLiscio() );
    536 					else if ( vaiPunti() );
    537 					else if ( vaiTaglio() );
    538 					else if ( vaiBriscolaAlta() );
    539 					else if ( vaiCarico() );
    540 				} else if ( haMessoAsso() ) {
    541 					if ( vaiLiscio() );
    542 					else if ( vaiPunti() );
    543 					else if ( vaiTaglio() );
    544 					else if ( vaiBriscolaAlta() );
    545 					else if ( vaiCarico() );
    546 					else if ( vaiTre() );
    547 				} else if ( haCaricato() ) {
    548 					if ( vaiSopra() );
    549 					else if ( vaiTre() );
    550 					else if ( vaiBriscolaAlta() );
    551 					else if ( vaiAsso() );
    552 					else if ( vaiTaglio() );
    553 					else if ( vaiLiscio() );
    554 					else if ( vaiPunti() );
    555 					else if ( vaiCarico() );
    556 				}
    557 			}
    558 			
    559 		/* All'ultima mano è inutile ragionare, dato che ha una sola carta */
    560 		} else {
    561 			if ( vaiTre() );
    562 			else if ( vaiBriscolaAlta() );
    563 			else if ( vaiAsso() );
    564 			else if ( vaiTaglio() );
    565 			else if ( vaiLiscio() );
    566 			else if ( vaiPunti() );
    567 			else if ( vaiCarico() );
    568 		}
    569 		
    570 		/* Gioca la carta e aggiorna la finestra con il metodo repaint() */
    571 		frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
    572 		frame.carteCPU[cartaDaGiocare] = null;
    573 		frame.pannello.repaint();
    574 		
    575 		CPUHaGiocato = true;
    576 		
    577 		if ( frame.giocata[0] == null )
    578 			toccaAllaCPU = false;
    579 	}
    580 	
    581 	/* Fa giocare una partita ai 30. È analogo al metodo precedente, cambia
    582 	 * solo la tecnica di gioco, quindi non è commentato. */
    583 	public void giocaCPUAiTrenta() {
    584 		
    585 		if ( punteggio <= 20 ) {
    586 			
    587 			if ( frame.giocata[0] == null ) {
    588 				if ( vaiPunti() );
    589 				else if ( vaiLiscio() );
    590 				else if ( vaiTaglio() );
    591 				else if ( vaiBriscolaAlta() );
    592 				else if ( vaiCarico() );
    593 				else if ( vaiTre() );
    594 				else if ( vaiAsso() );
    595 				else;
    596 			}
    597 			
    598 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    599 			else {
    600 				if ( haLisciato() ) {
    601 					if ( vaiSopra() );
    602 					else if ( vaiLiscio() );
    603 					else if ( vaiTre() );
    604 					else if ( vaiBriscolaAlta() );
    605 					else if ( vaiTaglio() );
    606 					else if ( vaiPunti() );
    607 					else if ( vaiAsso() );
    608 					else if ( vaiCarico() );
    609 				} else if ( haMessoPunti() ) {
    610 					if ( vaiSopra() );
    611 					else if ( vaiTre() );
    612 					else if ( vaiBriscolaAlta() );
    613 					else if ( vaiTaglio() );
    614 					else if ( vaiLiscio() );
    615 					else if ( vaiPunti() );
    616 					else if ( vaiAsso() );
    617 					else if ( vaiCarico() );
    618 				} else if ( haTagliato() ) {
    619 					if ( vaiLiscio() );
    620 					else if ( vaiPunti() );
    621 					else if ( vaiTaglio() );
    622 					else if ( vaiTre() );
    623 					else if ( vaiBriscolaAlta() );
    624 					else if ( vaiAsso() );
    625 					else if ( vaiCarico() );
    626 				} else if ( haMessoBriscolaAlta() ) {
    627 					if ( vaiLiscio() );
    628 					else if ( vaiPunti() );
    629 					else if ( vaiTre() );
    630 					else if ( vaiTaglio() );
    631 					else if ( vaiBriscolaAlta() );
    632 					else if ( vaiAsso() );
    633 					else if ( vaiCarico() );
    634 				} else if ( haMessoTre() ) {
    635 					if ( vaiAsso() );
    636 					else if ( vaiLiscio() );
    637 					else if ( vaiPunti() );
    638 					else if ( vaiTaglio() );
    639 					else if ( vaiBriscolaAlta() );
    640 					else if ( vaiCarico() );
    641 				} else if ( haMessoAsso() ) {
    642 					if ( vaiLiscio() );
    643 					else if ( vaiPunti() );
    644 					else if ( vaiTaglio() );
    645 					else if ( vaiBriscolaAlta() );
    646 					else if ( vaiCarico() );
    647 					else if ( vaiTre() );
    648 				} else if ( haCaricato() ) {
    649 					if ( vaiSopra() );
    650 					else if ( vaiTre() );
    651 					else if ( vaiBriscolaAlta() );
    652 					else if ( vaiTaglio() );
    653 					else if ( vaiAsso() );
    654 					else if ( vaiLiscio() );
    655 					else if ( vaiPunti() );
    656 					else if ( vaiCarico() );
    657 				}
    658 			}
    659 		}
    660 			
    661 		else {
    662 			
    663 			if ( frame.giocata[0] == null ) {
    664 				if ( vaiLiscio() );
    665 				else if ( vaiPunti() );
    666 				else if ( vaiTaglio() );
    667 				else if ( vaiBriscolaAlta() );
    668 				else if ( vaiAsso() );
    669 				else if ( vaiTre() );
    670 				else if ( vaiCarico() );
    671 				else;
    672 			}
    673 			
    674 			/* Valuta cosa fare quando invece il giocatore ha giocato */
    675 			else {
    676 				if ( haLisciato() ) {
    677 					if ( vaiSopra() );
    678 					else if ( vaiLiscio() );
    679 					else if ( vaiTre() );
    680 					else if ( vaiBriscolaAlta() );
    681 					else if ( vaiTaglio() );
    682 					else if ( vaiAsso() );
    683 					else if ( vaiPunti() );
    684 					else if ( vaiCarico() );
    685 				} else if ( haMessoPunti() ) {
    686 					if ( vaiSopra() );
    687 					else if ( vaiTre() );
    688 					else if ( vaiBriscolaAlta() );
    689 					else if ( vaiTaglio() );
    690 					else if ( vaiAsso() );
    691 					else if ( vaiLiscio() );
    692 					else if ( vaiPunti() );
    693 					else if ( vaiCarico() );
    694 				} else if ( haTagliato() ) {
    695 					if ( vaiLiscio() );
    696 					else if ( vaiTaglio() );
    697 					else if ( vaiTre() );
    698 					else if ( vaiBriscolaAlta() );
    699 					else if ( vaiAsso() );
    700 					else if ( vaiPunti() );
    701 					else if ( vaiCarico() );
    702 				} else if ( haMessoBriscolaAlta() ) {
    703 					if ( vaiLiscio() );
    704 					else if ( vaiTre() );
    705 					else if ( vaiTaglio() );
    706 					else if ( vaiAsso() );
    707 					else if ( vaiBriscolaAlta() );
    708 					else if ( vaiPunti() );
    709 					else if ( vaiCarico() );
    710 				} else if ( haMessoTre() ) {
    711 					if ( vaiAsso() );
    712 					else if ( vaiLiscio() );
    713 					else if ( vaiPunti() );
    714 					else if ( vaiTaglio() );
    715 					else if ( vaiBriscolaAlta() );
    716 					else if ( vaiCarico() );
    717 				} else if ( haMessoAsso() ) {
    718 					if ( vaiLiscio() );
    719 					else if ( vaiTaglio() );
    720 					else if ( vaiPunti() );
    721 					else if ( vaiBriscolaAlta() );
    722 					else if ( vaiCarico() );
    723 					else if ( vaiTre() );
    724 				} else if ( haCaricato() ) {
    725 					if ( vaiSopra() );
    726 					else if ( vaiTre() );
    727 					else if ( vaiBriscolaAlta() );
    728 					else if ( vaiTaglio() );
    729 					else if ( vaiAsso() );
    730 					else if ( vaiLiscio() );
    731 					else if ( vaiPunti() );
    732 					else if ( vaiCarico() );
    733 				}
    734 			}
    735 		}
    736 		
    737 		/* Gioca la carta e aggiorna la finestra con il metodo repaint() */
    738 		frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
    739 		frame.carteCPU[cartaDaGiocare] = null;
    740 		frame.pannello.repaint();
    741 		
    742 		CPUHaGiocato = true;
    743 		
    744 		if ( frame.giocata[0] == null )
    745 			toccaAllaCPU = false;
    746 	}
    747 	
    748 	/* Determina se ha preso la CPU o il giocatore */
    749 	public void chiPrende() {
    750 
    751 		/* Chiama il metodo giocatorePrende( boolean giocatore ) con parametro
    752 		 * true se ha preso il giocatore, false se ha preso la CPU */
    753 		giocatorePrende(   ( (seme( frame.giocata[0] ) == semeBriscola) && (seme( frame.giocata[1] ) != semeBriscola) )
    754 	|| ( (seme( frame.giocata[0] ) == seme( frame.giocata[1] )) && laPrimaEPiuAlta( valore( frame.giocata[0] ), valore( frame.giocata[1] )) )
    755 	|| ( (seme( frame.giocata[1] ) != semeBriscola) && (seme( frame.giocata[0] ) != seme( frame.giocata[1] )) && haGiocatoPrima ) );
    756 	}
    757 	
    758 	/* Confronta due carte per decidere quale ha più valore di presa.
    759 	 * Restituisce true se è la prima, false se è la seconda */
    760 	public boolean laPrimaEPiuAlta( int prima, int seconda ) {
    761 		int a, b;
    762 		switch ( prima ) {
    763 			case 0:
    764 				a = 10;
    765 				break;
    766 			case 1:
    767 				a = 12;
    768 				break;
    769 			case 3:
    770 				a = 11;
    771 				break;
    772 			default:
    773 				a = prima;
    774 				break;
    775 		}
    776 		switch ( seconda ) {
    777 			case 0:
    778 				b = 10;
    779 				break;
    780 			case 1:
    781 				b = 12;
    782 				break;
    783 			case 3:
    784 				b = 11;
    785 				break;
    786 			default:
    787 				b = seconda;
    788 				break;
    789 		}
    790 		return a > b;
    791 	}
    792 	
    793 	/* Viene chiamato con parametro true se ha preso il giocatore, false se
    794 	 * ha preso la CPU */
    795 	public void giocatorePrende( boolean giocatore ) {
    796 		if ( giocatore ) {
    797 			toccaAllaCPU = CPUHaGiocato = false;
    798 			haGiocatoPrima = true;
    799 		}
    800 		else {
    801 			toccaAllaCPU = true;
    802 			CPUHaGiocato = haGiocatoPrima = false;
    803 		}
    804 		daiPunti( giocatore );
    805 	}
    806 	
    807 	/* Da i punti (true al giocatore, false alla CPU) e fa pescare le carte*/
    808 	public void daiPunti( boolean giocatore ) {
    809 		
    810 		int punti = 0;
    811 		
    812 		switch( valore( frame.giocata[0] ) ) {
    813 			case 0:
    814 				punti += 4;
    815 				break;
    816 			case 1:
    817 				punti += 11;
    818 				break;
    819 			case 3:
    820 				punti += 10;
    821 				break;
    822 			case 8:
    823 				punti += 2;
    824 				break;
    825 			case 9:
    826 				punti += 3;
    827 				break;
    828 			default:
    829 				break;
    830 		}
    831 		switch( valore( frame.giocata[1] ) ) {
    832 			case 0:
    833 				punti += 4;
    834 				break;
    835 			case 1:
    836 				punti += 11;
    837 				break;
    838 			case 3:
    839 				punti += 10;
    840 				break;
    841 			case 8:
    842 				punti += 2;
    843 				break;
    844 			case 9:
    845 				punti += 3;
    846 				break;
    847 			default:
    848 				break;
    849 		}
    850 		
    851 		frame.giocata[0] = frame.giocata[1] = null;
    852 		
    853 		if ( giocatore ) {
    854 			punteggio += punti;
    855 			if ( mano < 18 ) {
    856 				if ( frame.carteInMano[0] == null )
    857 					frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
    858 				if ( frame.carteInMano[1] == null )
    859 					frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
    860 				if ( frame.carteInMano[2] == null )
    861 					frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
    862 				cartaDaPescare++;
    863 				if ( frame.carteCPU[0] == null )
    864 					frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
    865 				if ( frame.carteCPU[1] == null )
    866 					frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
    867 				if ( frame.carteCPU[2] == null )
    868 					frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
    869 				cartaDaPescare++;
    870 			}
    871 		}
    872 		
    873 		else {
    874 			punteggioCPU += punti;
    875 			if ( mano < 18 ) {
    876 				if ( frame.carteCPU[0] == null )
    877 					frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
    878 				if ( frame.carteCPU[1] == null )
    879 					frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
    880 				if ( frame.carteCPU[2] == null )
    881 					frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
    882 				cartaDaPescare++;
    883 				if ( frame.carteInMano[0] == null )
    884 					frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
    885 				if ( frame.carteInMano[1] == null )
    886 					frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
    887 				if ( frame.carteInMano[2] == null )
    888 					frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
    889 				cartaDaPescare++;
    890 			}
    891 		}
    892 		
    893 		/* Aggiorna la finestra */
    894 		frame.pannello.repaint();
    895 		frame.repaint();
    896 	}
    897 	
    898 	/* Vari metodi che determinano che tipo di carta ha giocato il giocatore.*/
    899 	public boolean haLisciato() {
    900 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
    901 				 (valore( frame.giocata[0] ) != RE ) && (valore( frame.giocata[0] ) != ASSO ) &&
    902 				 (valore( frame.giocata[0] ) != TRE ) && (valore( frame.giocata[0] ) < FANTE ) );
    903 	}
    904 	
    905 	public boolean haMessoPunti() {
    906 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
    907 				 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
    908 				 (valore( frame.giocata[0] ) == CAVALLO ) ) );
    909 	}
    910 		
    911 	public boolean haTagliato() {
    912 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
    913 				 (valore( frame.giocata[0] ) == RE) && (valore( frame.giocata[0] ) != ASSO) &&
    914 				 (valore( frame.giocata[0] ) == TRE) && (valore( frame.giocata[0] ) <= SETTE) );
    915 	}
    916 	
    917 	public boolean haMessoBriscolaAlta() {
    918 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
    919 				 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
    920 				 (valore( frame.giocata[0] ) == CAVALLO ) ) );
    921 	}
    922 	
    923 	public boolean haMessoTre() {
    924 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
    925 				 (valore( frame.giocata[0] ) == TRE) );
    926 	}
    927 	
    928 	public boolean haMessoAsso() {
    929 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
    930 				 (valore( frame.giocata[0] ) == ASSO) );
    931 	}
    932 	
    933 	public boolean haCaricato() {
    934 		return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
    935 				 ( (valore( frame.giocata[0] ) == ASSO) || (valore( frame.giocata[0] ) == TRE) ) );
    936 	}
    937 	
    938 	/* I metodi seguenti cercano di andare liscio - dare punti - mettere
    939 	 * un taglio - ecc... e restituiscono true se hanno avuto successo,
    940 	 * false altrimenti. */
    941 	public boolean vaiLiscio() {
    942 		for ( int i = 0; i < 3; i++ ) {
    943 			if ( frame.carteCPU[i] != null ) {
    944 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
    945 					 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
    946 					 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
    947 					cartaDaGiocare = i;
    948 					return true;
    949 				}
    950 			}
    951 		}
    952 		
    953 		return false;
    954 	}
    955 	
    956 	public boolean vaiPunti() {
    957 		/* Cerca di dare punti, cercando di darne il meno possibile (meglio
    958 		 * un fante di re). */
    959 		for ( int i = 0; i < 3; i++ ) {
    960 			if ( frame.carteCPU[i] != null ) {
    961 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE ) ) {
    962 					cartaDaGiocare = i;
    963 					return true;
    964 				}
    965 			}
    966 		}
    967 		
    968 		for ( int i = 0; i < 3; i++ ) {
    969 			if ( frame.carteCPU[i] != null ) {
    970 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO ) ) {
    971 					cartaDaGiocare = i;
    972 					return true;
    973 				}
    974 			}
    975 		}
    976 		
    977 		for ( int i = 0; i < 3; i++ ) {
    978 			if ( frame.carteCPU[i] != null ) {
    979 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE ) ) {
    980 					cartaDaGiocare = i;
    981 					return true;
    982 				}
    983 			}
    984 		}
    985 		
    986 		return false;
    987 	}
    988 	public boolean vaiTaglio() {
    989 		for ( int i = 0; i < 3; i++ ) {
    990 			if ( frame.carteCPU[i] != null ) {
    991 				if ( seme( frame.carteCPU[i] ) == semeBriscola &&
    992 					 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
    993 					 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
    994 					cartaDaGiocare = i;
    995 					return true;
    996 				}
    997 			}
    998 		}
    999 		
   1000 		return false;
   1001 	}
   1002 	public boolean vaiBriscolaAlta() {
   1003 		for ( int i = 0; i < 3; i++ ) {
   1004 			if ( frame.carteCPU[i] != null ) {
   1005 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE) ) {
   1006 					cartaDaGiocare = i;
   1007 					return true;
   1008 				}
   1009 			}
   1010 		}
   1011 		
   1012 		for ( int i = 0; i < 3; i++ ) {
   1013 			if ( frame.carteCPU[i] != null ) {
   1014 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO) ) {
   1015 					cartaDaGiocare = i;
   1016 					return true;
   1017 				}
   1018 			}
   1019 		}
   1020 		
   1021 		for ( int i = 0; i < 3; i++ ) {
   1022 			if ( frame.carteCPU[i] != null ) {
   1023 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == RE) ) {
   1024 					cartaDaGiocare = i;
   1025 					return true;
   1026 				}
   1027 			}
   1028 		}
   1029 		
   1030 		return false;
   1031 	}
   1032 	public boolean vaiTre() {
   1033 		for ( int i = 0; i < 3; i++ ) {
   1034 			if ( frame.carteCPU[i] != null ) {
   1035 				if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == TRE) ) {
   1036 					cartaDaGiocare = i;
   1037 					return true;
   1038 				}
   1039 			}
   1040 		}
   1041 		
   1042 		return false;
   1043 	}
   1044 	public boolean vaiAsso() {
   1045 		for ( int i = 0; i < 3; i++ ) {
   1046 			if ( frame.carteCPU[i] != null ) {
   1047 				if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == ASSO) ) {
   1048 					cartaDaGiocare = i;
   1049 					return true;
   1050 				}
   1051 			}
   1052 		}
   1053 		
   1054 		return false;
   1055 	}
   1056 	public boolean vaiCarico() {
   1057 		for ( int i = 0; i < 3; i++ ) {
   1058 			if ( frame.carteCPU[i] != null ) {
   1059 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == TRE) ) {
   1060 					cartaDaGiocare = i;
   1061 					return true;
   1062 				}
   1063 			}
   1064 		}
   1065 		
   1066 		for ( int i = 0; i < 3; i++ ) {
   1067 			if ( frame.carteCPU[i] != null ) {
   1068 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO) ) {
   1069 					cartaDaGiocare = i;
   1070 					return true;
   1071 				}
   1072 			}
   1073 		}
   1074 		
   1075 		return false;
   1076 	}
   1077 	public boolean vaiSopra() {
   1078 		/* Innanzitutto controlla se il giocatore ha giocato (non dovrebbe
   1079 		 * essere possibile, in quanto quando questo metodo viene chiamato
   1080 		 * tale condizione è già stata verificata, ma è sempre meglio un
   1081 		 * controllo in più che uno in meno) e restituisce false in caso
   1082 		 * contrario */
   1083 		if ( frame.giocata[0] == null )
   1084 			return false;
   1085 			
   1086 		/* Tre variabili intere che serviranno a valutare quali delle tre
   1087 		 * carte è meglio giocare, se più di una può andare sopra. */
   1088 		int a = -1;
   1089 		int b = -1;
   1090 		int c = -1;
   1091 		
   1092 		/* Tre booleane che verificano quali delle tre carte possono
   1093 		 * andare sopra. */
   1094 		boolean laPrimaPuoAndareSopra = false;
   1095 		boolean laSecondaPuoAndareSopra = false;
   1096 		boolean laTerzaPuoAndareSopra = false;
   1097 		
   1098 		/* Se il giocatore ha giocato un asso, restituisce direttamente false. */
   1099 		if ( valore( frame.giocata[0] ) == ASSO )
   1100 			return false;
   1101 		
   1102 		/* Valuta quali delle tre carte possono andare sopra, dopo essersi
   1103 		 * accertato di averle: nelle ultime mani non si hanno tutte le carte
   1104 		 * in mano, e noi non vogliamo una NullPointerException sul più bello
   1105 		 * di una partita, vero?! */
   1106 		if ( frame.carteCPU[0] != null ) {
   1107 			a = valore( frame.carteCPU[0] );
   1108 			if ( (seme( frame.carteCPU[0] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( a, valore( frame.giocata[0] ) ) )
   1109 				laPrimaPuoAndareSopra = true;
   1110 		}
   1111 		
   1112 		if ( frame.carteCPU[1] != null ) {	
   1113 			b = valore( frame.carteCPU[1] );
   1114 			if ( (seme( frame.carteCPU[1] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( b, valore( frame.giocata[0] ) ) )
   1115 				laSecondaPuoAndareSopra = true;
   1116 		}
   1117 		
   1118 		if ( frame.carteCPU[2] != null ) {
   1119 			c = valore( frame.carteCPU[2] );
   1120 			if ( (seme( frame.carteCPU[2] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( c, valore( frame.giocata[0] ) ) )
   1121 				laTerzaPuoAndareSopra = true;
   1122 		}
   1123 		
   1124 		/* Se nessuna carta può andare sopra, restituisce false. Se una
   1125 		 * sola delle tre può andare sopra la imposta come carta da giocare. */
   1126 		if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
   1127 			return false;
   1128 		else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
   1129 			cartaDaGiocare = 0;
   1130 		else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
   1131 			cartaDaGiocare = 1;
   1132 		else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
   1133 			cartaDaGiocare = 2;
   1134 			
   1135 		/* Se più di una carta può andare sopra, valuta quale è più alta. */
   1136 		else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
   1137 			if ( laPrimaEPiuAlta( a, b ) )
   1138 				cartaDaGiocare = 0;
   1139 			else
   1140 				cartaDaGiocare = 1;
   1141 		else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
   1142 			if ( laPrimaEPiuAlta( b, c ) )
   1143 				cartaDaGiocare = 1;
   1144 			else
   1145 				cartaDaGiocare = 2;
   1146 		else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
   1147 			if ( laPrimaEPiuAlta( a, c ) )
   1148 				cartaDaGiocare = 0;
   1149 			else
   1150 				cartaDaGiocare = 2;
   1151 		else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
   1152 			if ( laPrimaEPiuAlta( a, b ) )
   1153 				if ( laPrimaEPiuAlta( a, c ) )
   1154 					cartaDaGiocare = 0;
   1155 				else
   1156 					cartaDaGiocare = 2;
   1157 			else
   1158 				if ( laPrimaEPiuAlta( b, c ) )
   1159 					cartaDaGiocare = 1;
   1160 				else
   1161 					cartaDaGiocare = 2;
   1162 		
   1163 		/* Controlla che la carta con cui sta cercando di andare sopra
   1164 		 * sia una figura o un carico. Non vogliamo mica prendere delle
   1165 		 * scartelle con delle scartelle, giusto?! */
   1166 		if ( ( valore( frame.carteCPU[cartaDaGiocare] ) != RE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) != ASSO ) &&
   1167 			 ( valore( frame.carteCPU[cartaDaGiocare] ) != TRE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) <= SETTE ) )
   1168 			return false;
   1169 
   1170 		return true;
   1171 	}
   1172 	
   1173 	/* I metodi seguenti valutano le carte che la CPU ha in mano. */
   1174 	public boolean hoCarico() {
   1175 		for ( int i = 0; i < 3; i++ ) {
   1176 			if ( frame.carteCPU[i] != null ) {
   1177 				if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
   1178 					 ( ( valore( frame.carteCPU[i] ) == ASSO ) || ( valore( frame.carteCPU[i] ) == TRE ) ) ) {
   1179 					return true;
   1180 				}
   1181 			}
   1182 		}
   1183 		
   1184 		return false;
   1185 	}
   1186 	public boolean hoAsso() {
   1187 		for ( int i = 0; i < 3; i++ ) {
   1188 			if ( frame.carteCPU[i] != null ) {
   1189 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO ) ) {
   1190 					return true;
   1191 				}
   1192 			}
   1193 		}
   1194 		
   1195 		return false;
   1196 	}
   1197 	public boolean hoTre() {
   1198 		for ( int i = 0; i < 3; i++ ) {
   1199 			if ( frame.carteCPU[i] != null ) {
   1200 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == TRE ) ) {
   1201 					return true;
   1202 				}
   1203 			}
   1204 		}
   1205 		
   1206 		return false;
   1207 	}
   1208 	public boolean hoBriscolaAlta() {
   1209 		for ( int i = 0; i < 3; i++ ) {
   1210 			if ( frame.carteCPU[i] != null ) {
   1211 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
   1212 					 ( (valore( frame.carteCPU[i] ) == RE) || (valore( frame.carteCPU[i] ) == FANTE) || (valore( frame.carteCPU[i] ) == CAVALLO) ) ) {
   1213 					return true;
   1214 				}
   1215 			}
   1216 		}
   1217 		
   1218 		return false;
   1219 	}
   1220 	public boolean hoTaglio() {
   1221 		for ( int i = 0; i < 3; i++ ) {
   1222 			if ( frame.carteCPU[i] != null ) {
   1223 				if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
   1224 					 (valore( frame.carteCPU[i] ) < FANTE ) && (valore( frame.carteCPU[i] ) != TRE )
   1225 					 && (valore( frame.carteCPU[i] ) != ASSO ) && (valore( frame.carteCPU[i] ) != RE ) ) {
   1226 					return true;
   1227 				}
   1228 			}
   1229 		}
   1230 		
   1231 		return false;
   1232 	}
   1233 
   1234 	/* Restituisce il seme della carta passata come parametro */
   1235 	public static int seme( ImageIcon carta ) {
   1236 		char aux[] = carta.toString().toCharArray();
   1237 		return aux[aux.length-5] - 49;
   1238 	}
   1239 
   1240 	/* Restituisce il valore della carta */
   1241 	public static int valore( ImageIcon carta ) {
   1242 		char aux[] = carta.toString().toCharArray();
   1243 		return aux[aux.length-7] - 48;
   1244 	}
   1245 	
   1246 	/* I vari trucchi del gioco. */
   1247 	public static void trucco( String trucco ) {
   1248 		
   1249 		byte[] truccoByte = trucco.getBytes();
   1250 		char[] truccoChar = new char[ truccoByte.length ];
   1251 		for ( int i = 0; i < truccoChar.length; i++ )
   1252 			truccoChar[i] = (char)truccoByte[i];
   1253 			
   1254 		String attivato = stringaTruccoSbagliato;
   1255 		
   1256 		/* Carta che vuoi dove vuoi. Esempio: x251 sostituisce
   1257 		 * la terza carta (2) con il 6 (5) di coppe (1). */
   1258 		if ( truccoChar[0] == 'x' && truccoChar.length == 4 ) {
   1259 		
   1260 			attivato = stringaTruccoAttivato;
   1261 			
   1262 			String aS = "" + truccoChar[1];
   1263 			String xS = "" + truccoChar[2];
   1264 			String yS = "" + truccoChar[3];
   1265 			
   1266 			int a, x, y;
   1267 			
   1268 			try {
   1269 				
   1270 				a = Integer.parseInt( aS );
   1271 				x = Integer.parseInt( xS );
   1272 				y = Integer.parseInt( yS );
   1273 				
   1274 				frame.carteInMano[a] = frame.arrayCarte[x][y];
   1275 				
   1276 			} catch ( Exception e ) {
   1277 				attivato = stringaTruccoSbagliato;
   1278 			}
   1279 		}
   1280 		
   1281 		/* Mostra le carte del computer. */
   1282 		if ( trucco.equalsIgnoreCase( "Kill Devil Hill" ) ) {
   1283 			
   1284 			attivato = stringaTruccoAttivato;
   1285 			
   1286 			carteScoperte = true;
   1287 			
   1288 		}
   1289 		
   1290 		/* Scambia le carte con il computer. */
   1291 		if ( trucco.equalsIgnoreCase( "Darkside of Aquarius" ) ) {
   1292 			
   1293 			attivato = stringaTruccoAttivato;
   1294 			
   1295 			ImageIcon aux = null;
   1296 			
   1297 			for ( int i = 0; i < 3; i++ ) {
   1298 				
   1299 				aux = frame.carteInMano[i];
   1300 				frame.carteInMano[i] = frame.carteCPU[i];
   1301 				frame.carteCPU[i] = aux;
   1302 				
   1303 			}
   1304 		}
   1305 		
   1306 		/* Cambia il seme di briscola con uno a caso, senza dire quale.
   1307 		 * L'ultima carta non cambia. È possibile comunque capire
   1308 		 * qual'è la briscola dal menu ?->Briscola*/
   1309 		if ( trucco.equalsIgnoreCase( "Change of Heart" ) ) {
   1310 			
   1311 			attivato = stringaTruccoAttivato;
   1312 			
   1313 			semeBriscola = (int) ( Math.random() * 4 );
   1314 			
   1315 		}
   1316 		
   1317 		/* Asso Tre e Re di Briscola tutti in mano (anche in caso di doppioni). */
   1318 		if ( trucco.equalsIgnoreCase( "Tears of The Dragon" ) ) {
   1319 			
   1320 			attivato = stringaTruccoAttivato;
   1321 			
   1322 			frame.carteInMano[0] = frame.arrayCarte[9][semeBriscola];
   1323 			frame.carteInMano[1] = frame.arrayCarte[2][semeBriscola];
   1324 			frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
   1325 			
   1326 		}
   1327 		
   1328 		/* Tre assi di briscola. */
   1329 		if ( trucco.equalsIgnoreCase( "Navigate The Seas of The Sun" ) ) {
   1330 			
   1331 			attivato = stringaTruccoAttivato;
   1332 			
   1333 			frame.carteInMano[0] = frame.arrayCarte[0][semeBriscola];
   1334 			frame.carteInMano[1] = frame.arrayCarte[0][semeBriscola];
   1335 			frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
   1336 			
   1337 		}
   1338 		
   1339 		/* Fa finire la partita al prossimo piglio. */
   1340 		if ( trucco.equalsIgnoreCase( "Omega" ) ) {
   1341 			
   1342 			attivato = stringaTruccoAttivato;
   1343 			
   1344 			mano = 19;
   1345 			
   1346 		}
   1347 		
   1348 		JOptionPane.showMessageDialog( frame, attivato, "JBriscola - " + version, JOptionPane.INFORMATION_MESSAGE );
   1349 		frame.pannello.repaint();
   1350 		frame.repaint();
   1351 		
   1352 	}
   1353 	
   1354 	/* Imposta le opzioni dell'utente cercando di leggerle dal file di configurazione. */
   1355 	public static void settaOpzioni() {
   1356 		
   1357 		/* Impostazioni predefinite. */
   1358 		lang = "it";
   1359 		soundString = "suono=si";
   1360 		keysString = "tasti=si";
   1361 		int r = 0;
   1362 		int g = 150;
   1363 		int b = 0;
   1364 		
   1365 		/* Cerca di leggere il file per impostare le opzioni. */
   1366 		Scanner scanner = null;
   1367 		File file = new File( "JBriscolaConfig.txt" );
   1368 		if ( file.exists() ) {
   1369 			try {
   1370 				scanner = new Scanner( file );
   1371 			} catch ( FileNotFoundException e ) { }
   1372 			try {
   1373 				lang = scanner.next();
   1374 				soundString = scanner.next();
   1375 				keysString = scanner.next();
   1376 				r = scanner.nextInt();
   1377 				g = scanner.nextInt();
   1378 				b = scanner.nextInt();
   1379 			} catch ( NoSuchElementException e ) { }
   1380 		}
   1381 		
   1382 		/* Modifica le opzioni. */
   1383 		if ( lang.equals( "it" ) ) {
   1384 			semi[0] = "Bastoni";
   1385 			semi[1] = "Coppe";
   1386 			semi[2] = "Denari";
   1387 			semi[3] = "Spade";
   1388 			stringaBriscola = "Briscola";
   1389 			stringaBottonePrendi = "Prendi/Lascia carte";
   1390 			stringaPrimaGioca = "Prima Gioca!";
   1391 			stringaUltime4 = "Ultima carta - Occhio alla briscola!";
   1392 			stringaVinto = "Hai Vinto!";
   1393 			stringaPerso = "Hai Perso";
   1394 			stringaPareggio = "Pareggio";
   1395 			stringaGiocatore = "Giocatore: ";
   1396 			stringaComputer = "\nComputer: ";
   1397 			stringaNuovaPartita = "Nuova Partita";
   1398 			stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
   1399 			stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
   1400 			stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
   1401 			stringaSi = "Si";
   1402 			stringaNo = "No";
   1403 			stringaOpzioni = "Opzioni...";
   1404 			stringaEsci = "Esci";
   1405 			stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
   1406 			stringaLingua = "Lingua";
   1407 			stringaAnnulla = "Annulla";
   1408 			stringaIt = "Italiano";
   1409 			stringaLa = "Latino";
   1410 			stringaBL = "Dialetto Bellunese";
   1411 			stringaBV = "Dialetto Basso Veneto";
   1412 			stringaEN = "Inglese";
   1413 			stringaModificaOpzioni = "Modifica Opzioni";
   1414 			stringaInformazioni = "Informazioni";
   1415 			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";
   1416 			stringaSuono = "Effetti sonori";
   1417 			stringaPunteggio = "Punteggio";
   1418 			stringaSfondo = "Sfondo";
   1419 			stringaTasti = "Tasti rapidi";
   1420 			stringaAggiornamenti = "Cerca aggiornamenti";
   1421 			stringaTrucchi = "Trucchi";
   1422 			stringaInserisciCodice = "Inserisci il codice:";
   1423 			stringaTruccoAttivato = "Trucco attivato!";
   1424 			stringaTruccoSbagliato = "Trucco non valido";
   1425 			stringaCheCartaVuoi = "E allora che carta vuoi?";
   1426 			stringaAggiornamentiSi = "Aggiornamento disponibile: ";
   1427 			stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
   1428 			stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
   1429 			stringaNoInternet = "Errore: nessuna connessione internet";
   1430 			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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
   1431 		}
   1432 		else if ( lang.equals( "la" ) ) {
   1433 			semi[0] = "BACULI";
   1434 			semi[1] = "CALICES";
   1435 			semi[2] = "DENARII";
   1436 			semi[3] = "GLADII";
   1437 			stringaBriscola = "BRISCOLA";
   1438 			stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
   1439 			stringaPrimaGioca = "ANTE CHARTAM PONE!";
   1440 			stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
   1441 			stringaVinto = "VICISTI!";
   1442 			stringaPerso = "PERDIDISTI";
   1443 			stringaPareggio = "AEQVATIO!";
   1444 			stringaGiocatore = "LVSOR: ";
   1445 			stringaComputer = "\nCOMPVTER: ";
   1446 			stringaNuovaPartita = "NOVA LVSO";
   1447 			stringaNuovaPartitaAiTrenta = "NOVA LVSO XXX";
   1448 			stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
   1449 			stringaVuoiDavveroUscire = "EXIRE?";
   1450 			stringaSi = "ID VOLO";
   1451 			stringaNo = "NOLO";
   1452 			stringaOpzioni = "OPTIONES...";
   1453 			stringaEsci = "EXIRE";
   1454 			stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
   1455 			stringaLingua = "LINGVA";
   1456 			stringaAnnulla = "ABROGA";
   1457 			stringaIt = "ITALICA";
   1458 			stringaLa = "LATINA";
   1459 			stringaBL = "BELLUNI";
   1460 			stringaBV = "VENETIAE";
   1461 			stringaEN = "ANGLICVS";
   1462 			stringaModificaOpzioni = "OPTIONES NOVARE";
   1463 			stringaInformazioni = "INFORMATIONES";
   1464 			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";
   1465 			stringaSuono = "SONVS";
   1466 			stringaPunteggio = "NVMERI";
   1467 			stringaSfondo = "COLOR";
   1468 			stringaTasti = "TASTI RAPIDI";
   1469 			stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE";
   1470 			stringaTrucchi = "CODICES";
   1471 			stringaInserisciCodice = "CODICEM INSCRIBE:";
   1472 			stringaTruccoAttivato = "CODEX INCIPIVIT!";
   1473 			stringaTruccoSbagliato = "ERROR CODICIS";
   1474 			stringaCheCartaVuoi = "QUAM CHARTAM VOLIS?";
   1475 			stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST";
   1476 			stringaAggiornamentiSi = "VERSIO RECENTIOR EST: ";
   1477 			stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST";
   1478 			stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html";
   1479 			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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
   1480 		}
   1481 		if ( lang.equals( "bl" ) ) {
   1482 			semi[0] = "Bastoi";
   1483 			semi[1] = "Coppe";
   1484 			semi[2] = "Danari";
   1485 			semi[3] = "Spade";
   1486 			stringaBriscola = "Briscola";
   1487 			stringaBottonePrendi = "Cio' su/lasa le carte";
   1488 			stringaPrimaGioca = "Prima Duga!";
   1489 			stringaUltime4 = "Ultima carta - Ocio a la briscola!";
   1490 			stringaVinto = "Te ha vint!";
   1491 			stringaPerso = "Te ha pers";
   1492 			stringaPareggio = "Pari";
   1493 			stringaGiocatore = "Dugador: ";
   1494 			stringaComputer = "\nComputer: ";
   1495 			stringaNuovaPartita = "Taca n'altra partida";
   1496 			stringaNuovaPartitaAiTrenta = "Taca na partida ai 30";
   1497 			stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
   1498 			stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
   1499 			stringaSi = "Si";
   1500 			stringaNo = "No";
   1501 			stringaOpzioni = "Opzioni...";
   1502 			stringaEsci = "Stusa su";
   1503 			stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
   1504 			stringaLingua = "Lengua";
   1505 			stringaAnnulla = "Annulla";
   1506 			stringaIt = "Italian";
   1507 			stringaLa = "Latin";
   1508 			stringaBL = "Dialeto de Belun";
   1509 			stringaBV = "Dialeto de la basa";
   1510 			stringaEN = "Inglese";
   1511 			stringaModificaOpzioni = "Modifica Opzioni";
   1512 			stringaInformazioni = "Informazioni";
   1513 			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";
   1514 			stringaSuono = "Efeti sonori";
   1515 			stringaPunteggio = "Varda i punti";
   1516 			stringaSfondo = "Sfondo";
   1517 			stringaTasti = "Tasti rapidi";
   1518 			stringaAggiornamenti = "Varda se ghe ne' na version pi nova";
   1519 			stringaTrucchi = "Truchi";
   1520 			stringaInserisciCodice = "Scrivi al codice:";
   1521 			stringaTruccoAttivato = "Truco ativa'!";
   1522 			stringaTruccoSbagliato = "Truco sbaia'";
   1523 			stringaCheCartaVuoi = "Che carta utu alora?";
   1524 			stringaAggiornamentiSi = "Ghe ne' na version pi nova: ";
   1525 			stringaAggiornamentiNo = "No ghe ne na version pi nova";
   1526 			stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
   1527 			stringaNoInternet = "Erore: no te se su internet";
   1528 			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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
   1529 		}
   1530 		if ( lang.equals( "bv" ) ) {
   1531 			semi[0] = "Bastoni";
   1532 			semi[1] = "Coppe";
   1533 			semi[2] = "Danari";
   1534 			semi[3] = "Spade";
   1535 			stringaBriscola = "Briscola";
   1536 			stringaBottonePrendi = "Ciapa su/lasa e carte";
   1537 			stringaPrimaGioca = "Prima Zuga!";
   1538 			stringaUltime4 = "Ultima carta - Ocio a la briscola!";
   1539 			stringaVinto = "Ti ga vinto!";
   1540 			stringaPerso = "Ti ga perso";
   1541 			stringaPareggio = "Pari";
   1542 			stringaGiocatore = "Zugador: ";
   1543 			stringaComputer = "\nComputer: ";
   1544 			stringaNuovaPartita = "N'altra Partida";
   1545 			stringaNuovaPartitaAiTrenta = "Na Partida ai 30";
   1546 			stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
   1547 			stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
   1548 			stringaSi = "Si";
   1549 			stringaNo = "No";
   1550 			stringaOpzioni = "Opzioni...";
   1551 			stringaEsci = "Stusa su";
   1552 			stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
   1553 			stringaLingua = "Lengua";
   1554 			stringaAnnulla = "Annulla";
   1555 			stringaIt = "Italian";
   1556 			stringaLa = "Latin";
   1557 			stringaBL = "Dialeto Belumat";
   1558 			stringaBV = "Dialeto Veneto";
   1559 			stringaEN = "Inglese";
   1560 			stringaModificaOpzioni = "Modifica Opzioni";
   1561 			stringaInformazioni = "Informasioni";
   1562 			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";
   1563 			stringaSuono = "Efeti sonori";
   1564 			stringaPunteggio = "Varda i punti";
   1565 			stringaSfondo = "Sfondo";
   1566 			stringaTasti = "Tasti rapidi";
   1567 			stringaAggiornamenti = "Varda se ghe xe na versione pi nova";
   1568 			stringaTrucchi = "Truchi";
   1569 			stringaInserisciCodice = "Scrivi al codice:";
   1570 			stringaTruccoAttivato = "Truco ativa'!";
   1571 			stringaTruccoSbagliato = "Truco sbaia'";
   1572 			stringaCheCartaVuoi = "Che carta utu alora?";
   1573 			stringaAggiornamentiSi = "Ghe xe na versione pi nova: ";
   1574 			stringaAggiornamentiNo = "No ghe xe na versione pi nova";
   1575 			stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
   1576 			stringaNoInternet = "Erore: no ti xe su internet";
   1577 			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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
   1578 		}
   1579 		if ( lang.equals( "en" ) ) {
   1580 			semi[0] = "Sticks";
   1581 			semi[1] = "Cups";
   1582 			semi[2] = "Golds";
   1583 			semi[3] = "Swords";
   1584 			stringaBriscola = "Briscola";
   1585 			stringaBottonePrendi = "Take/leave cards";
   1586 			stringaPrimaGioca = "Play your card before!";
   1587 			stringaUltime4 = "Last card - keep your eye on the briscola!";
   1588 			stringaVinto = "You won!";
   1589 			stringaPerso = "You lost";
   1590 			stringaPareggio = "Sixty - sixty!";
   1591 			stringaGiocatore = "Palyer: ";
   1592 			stringaComputer = "\nComputer: ";
   1593 			stringaNuovaPartita = "New Game";
   1594 			stringaNuovaPartitaAiTrenta = "New Game - 30 Points";
   1595 			stringaVuoiDavveroIniziare = "Do you really want to start a new game?";
   1596 			stringaVuoiDavveroUscire = "Do you really want to exit?";
   1597 			stringaSi = "Yes";
   1598 			stringaNo = "No";
   1599 			stringaOpzioni = "Options...";
   1600 			stringaEsci = "Exit";
   1601 			stringaImpossibileConfigurare = "Couldn't write to the configuration file.\nPlease report the bug to: sebastiano@luganega.org\n\nException:\n";
   1602 			stringaLingua = "Lang";
   1603 			stringaAnnulla = "Cancel";
   1604 			stringaIt = "Italian";
   1605 			stringaLa = "Latin";
   1606 			stringaBL = "Belluno dialect";
   1607 			stringaBV = "Venice dialect";
   1608 			stringaEN = "English";
   1609 			stringaModificaOpzioni = "Change options";
   1610 			stringaInformazioni = "Information";
   1611 			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";
   1612 			stringaSuono = "Sound";
   1613 			stringaPunteggio = "Score";
   1614 			stringaSfondo = "Background";
   1615 			stringaTasti = "Hot keys";
   1616 			stringaAggiornamenti = "Check updates";
   1617 			stringaTrucchi = "Cheats";
   1618 			stringaInserisciCodice = "Insert cheat:";
   1619 			stringaTruccoAttivato = "Cheat actived!";
   1620 			stringaTruccoSbagliato = "Wrong cheat";
   1621 			stringaCheCartaVuoi = "So what card do you want?";
   1622 			stringaAggiornamentiSi = "Update available: ";
   1623 			stringaAggiornamentiNo = "No updates available";
   1624 			stringaScarica = "You can get the latest version from the site\nhttp://porkynator.altervista.org/programmi.html";
   1625 			stringaNoInternet = "Error: no internet connection";
   1626 			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 + "\nF7   " + stringaNuovaPartitaAiTrenta + "\nF8   " + stringaTrucchi + "\nq    " + stringaEsci;
   1627 		}
   1628 		sound = ( soundString.equals( "suono=si" ) );
   1629 		keys = ( keysString.equals( "tasti=si" ) );
   1630 		color = new Color( r, g, b );
   1631 		if ( frame != null ) {
   1632 			frame.pannello.repaint();
   1633 			frame.pannello2.repaint();
   1634 			frame.repaint();
   1635 		}
   1636 	}
   1637 }