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 | |
| download | ancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.tar.gz ancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.zip | |
Diffstat (limited to 'JBriscola/all_versions/0.2/0.2.2/src')
56 files changed, 1974 insertions, 0 deletions
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/Frame.java b/JBriscola/all_versions/0.2/0.2.2/src/Frame.java new file mode 100755 index 0000000..bea69a4 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/Frame.java | |||
| @@ -0,0 +1,432 @@ | |||
| 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 javax.swing.*; | ||
| 23 | import javax.sound.sampled.*; | ||
| 24 | import java.io.*; | ||
| 25 | import java.net.*; | ||
| 26 | import java.awt.*; | ||
| 27 | import java.awt.event.*; | ||
| 28 | |||
| 29 | public class Frame extends JFrame { | ||
| 30 | |||
| 31 | /* Booleana per determinare se disegnare il mazzo di carte o no (se | ||
| 32 | * è l'ultima mano). */ | ||
| 33 | public static boolean mazzo; | ||
| 34 | |||
| 35 | public static Main main; | ||
| 36 | |||
| 37 | /* Menu, bottoni, pannelli e componenti vari. */ | ||
| 38 | public static Pannello pannello; | ||
| 39 | public static JPanel pannello2; | ||
| 40 | public static JButton button; | ||
| 41 | public static JMenuBar barraMenu; | ||
| 42 | public static JMenu file, puntoInterrogativo; | ||
| 43 | public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti, aggiornamenti, tastiRapidi; | ||
| 44 | |||
| 45 | /* Immagini delle carte. */ | ||
| 46 | public static ImageIcon retro1, retro2, ultimaCarta; | ||
| 47 | public static ImageIcon[] giocata = new ImageIcon[2]; | ||
| 48 | public static ImageIcon[] carteInMano = new ImageIcon[3]; | ||
| 49 | public static ImageIcon[] carteCPU = new ImageIcon[3]; | ||
| 50 | public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40]; | ||
| 51 | public static ImageIcon[][] arrayCarte = new ImageIcon[10][4]; | ||
| 52 | |||
| 53 | public Frame() { | ||
| 54 | |||
| 55 | super( "Tronto's JBriscola " + main.version ); | ||
| 56 | |||
| 57 | mazzo = true; | ||
| 58 | main = new Main(); | ||
| 59 | pannello = new Pannello(); | ||
| 60 | pannello2 = new JPanel( new FlowLayout() ); | ||
| 61 | |||
| 62 | button = new JButton( main.stringaBottonePrendi ); | ||
| 63 | button.addActionListener( new ActionListener() { | ||
| 64 | |||
| 65 | /* Quando viene premuto il bottone per prendere/lasciare le carte, | ||
| 66 | * valuta innanzitutto se il giocatore ha giocato, e poi a chi | ||
| 67 | * darle ed eventualmente, se è finita la partita, a caricare | ||
| 68 | * il suono adatto. */ | ||
| 69 | public void actionPerformed( ActionEvent e ) { | ||
| 70 | |||
| 71 | if ( giocata[0] != null && giocata[1] != null ) | ||
| 72 | main.mano++; | ||
| 73 | |||
| 74 | try { | ||
| 75 | main.chiPrende(); | ||
| 76 | } catch ( Exception ex ) { | ||
| 77 | /* Avvisa di giocare una carta. */ | ||
| 78 | JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE ); | ||
| 79 | } | ||
| 80 | |||
| 81 | if ( main.mano == 16 ) | ||
| 82 | /* Avvisa che si è arrivati alla quartultima mano. */ | ||
| 83 | JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 84 | |||
| 85 | /* Non disegna più la briscola e il mazzo se sono già state | ||
| 86 | * pescate tutte le carte. */ | ||
| 87 | if ( main.mano == 17 ) { | ||
| 88 | mazzo = false; | ||
| 89 | ultimaCarta = null; | ||
| 90 | pannello.repaint(); | ||
| 91 | Frame.this.repaint(); | ||
| 92 | } | ||
| 93 | |||
| 94 | /* Mostra il punteggio e carica i suoni se è finita la partita. */ | ||
| 95 | if ( main.mano == 20 ) { | ||
| 96 | |||
| 97 | String titolo = ""; | ||
| 98 | String suonoFinale = ""; | ||
| 99 | |||
| 100 | if ( main.punteggio > main.punteggioCPU ) { | ||
| 101 | titolo = main.stringaVinto; | ||
| 102 | suonoFinale = "sounds/perso.wav"; | ||
| 103 | } | ||
| 104 | if ( main.punteggio < main.punteggioCPU ) { | ||
| 105 | titolo = main.stringaPerso; | ||
| 106 | suonoFinale = "sounds/vinto.wav"; | ||
| 107 | } | ||
| 108 | if ( main.punteggio == main.punteggioCPU ) { | ||
| 109 | titolo = main.stringaPareggio; | ||
| 110 | suonoFinale = "sounds/pareggio.wav"; | ||
| 111 | } | ||
| 112 | |||
| 113 | if ( main.sound ) { | ||
| 114 | try { | ||
| 115 | AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) ); | ||
| 116 | AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) ); | ||
| 117 | AudioFormat af = aff.getFormat(); | ||
| 118 | DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) ); | ||
| 119 | Clip ol = ( Clip ) AudioSystem.getLine( info ); | ||
| 120 | ol.open(ais); | ||
| 121 | ol.loop( 0 ); | ||
| 122 | } catch ( Exception ex ) { | ||
| 123 | System.err.println( e ); | ||
| 124 | } | ||
| 125 | } | ||
| 126 | |||
| 127 | JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE ); | ||
| 128 | } | ||
| 129 | } | ||
| 130 | } ); | ||
| 131 | button.addKeyListener( new KeyAdapter() { | ||
| 132 | /* Aggiunge il keyListener per le scorciatoie da tastiera. Dato | ||
| 133 | * che il bottone prendi/lascia è l'unico componente effettivo | ||
| 134 | * della finestra, avrà obbligatoriamente il focus ed è necessario | ||
| 135 | * che sia lui a gestire gli eventi della tastiera. */ | ||
| 136 | public void keyReleased( KeyEvent key ) { | ||
| 137 | |||
| 138 | if ( main.keys ) { | ||
| 139 | switch ( key.getKeyCode() ) { | ||
| 140 | case KeyEvent.VK_1: | ||
| 141 | if ( mettiCarta( 231, 500 ) ) { | ||
| 142 | if ( !main.CPUHaGiocato ) | ||
| 143 | main.giocaCPU(); | ||
| 144 | } | ||
| 145 | break; | ||
| 146 | |||
| 147 | case KeyEvent.VK_2: | ||
| 148 | if ( mettiCarta( 301, 500 ) ) { | ||
| 149 | if ( !main.CPUHaGiocato ) | ||
| 150 | main.giocaCPU(); | ||
| 151 | } | ||
| 152 | break; | ||
| 153 | |||
| 154 | case KeyEvent.VK_3: | ||
| 155 | if ( mettiCarta( 371, 500 ) ) { | ||
| 156 | if ( !main.CPUHaGiocato ) | ||
| 157 | main.giocaCPU(); | ||
| 158 | } | ||
| 159 | break; | ||
| 160 | |||
| 161 | case KeyEvent.VK_F1: | ||
| 162 | JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 163 | break; | ||
| 164 | |||
| 165 | case KeyEvent.VK_F2: | ||
| 166 | if ( main.mano == 20 ) { | ||
| 167 | main.mischia(); | ||
| 168 | pannello.repaint(); | ||
| 169 | repaint(); | ||
| 170 | } | ||
| 171 | else { | ||
| 172 | int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroIniziare, "JBriscola " + main.version, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo ); | ||
| 173 | if ( selezione == JOptionPane.YES_OPTION ) { | ||
| 174 | main.mischia(); | ||
| 175 | pannello.repaint(); | ||
| 176 | repaint(); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | break; | ||
| 180 | |||
| 181 | case KeyEvent.VK_F3: | ||
| 182 | OptionFrame optionFrame = new OptionFrame(); | ||
| 183 | optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); | ||
| 184 | optionFrame.setResizable( false ); | ||
| 185 | optionFrame.setAlwaysOnTop( true ); | ||
| 186 | optionFrame.setSize( 300, 200 ); | ||
| 187 | optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2); | ||
| 188 | optionFrame.setVisible( true ); | ||
| 189 | break; | ||
| 190 | case KeyEvent.VK_F4: | ||
| 191 | |||
| 192 | JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE ); | ||
| 193 | break; | ||
| 194 | case KeyEvent.VK_F5: | ||
| 195 | |||
| 196 | JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE ); | ||
| 197 | break; | ||
| 198 | case KeyEvent.VK_F6: | ||
| 199 | |||
| 200 | String latest = main.version; | ||
| 201 | try { | ||
| 202 | URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" ); | ||
| 203 | BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) ); | ||
| 204 | latest = latestIsReader.readLine(); | ||
| 205 | } catch ( Exception ex ) { | ||
| 206 | JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE ); | ||
| 207 | } | ||
| 208 | if ( latest.equals( main.version ) ) | ||
| 209 | JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 210 | else | ||
| 211 | JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 212 | break; | ||
| 213 | case KeyEvent.VK_Q: | ||
| 214 | |||
| 215 | int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroUscire, "JBriscola " + main.version, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo ); | ||
| 216 | if ( selezione == JOptionPane.YES_OPTION ) | ||
| 217 | Frame.this.dispose(); | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } | ||
| 222 | } ); | ||
| 223 | |||
| 224 | barraMenu = new JMenuBar(); | ||
| 225 | |||
| 226 | file = new JMenu( "File" ); | ||
| 227 | |||
| 228 | nuovaPartita = new JMenuItem( main.stringaNuovaPartita ); | ||
| 229 | nuovaPartita.addActionListener( new ActionListener() { | ||
| 230 | /* Avvia una nuova partita, chiedendo prima conferma se ce n'è | ||
| 231 | * già una in corso. */ | ||
| 232 | public void actionPerformed( ActionEvent e ) { | ||
| 233 | if ( main.mano == 20 ) { | ||
| 234 | main.mischia(); | ||
| 235 | pannello.repaint(); | ||
| 236 | repaint(); | ||
| 237 | } | ||
| 238 | |||
| 239 | else { | ||
| 240 | int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroIniziare, "JBriscola " + main.version, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo ); | ||
| 241 | if ( selezione == JOptionPane.YES_OPTION ) { | ||
| 242 | main.mischia(); | ||
| 243 | pannello.repaint(); | ||
| 244 | repaint(); | ||
| 245 | } | ||
| 246 | } | ||
| 247 | } | ||
| 248 | }); | ||
| 249 | |||
| 250 | opzioni = new JMenuItem( main.stringaOpzioni ); | ||
| 251 | opzioni.addActionListener( new ActionListener() { | ||
| 252 | /* Apre una OptionFrame per modificare le opzioni. */ | ||
| 253 | public void actionPerformed( ActionEvent e ) { | ||
| 254 | |||
| 255 | OptionFrame optionFrame = new OptionFrame(); | ||
| 256 | optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); | ||
| 257 | optionFrame.setResizable( false ); | ||
| 258 | optionFrame.setAlwaysOnTop( true ); | ||
| 259 | optionFrame.setSize( 300, 200 ); | ||
| 260 | optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2); | ||
| 261 | optionFrame.setVisible( true ); | ||
| 262 | } | ||
| 263 | }); | ||
| 264 | |||
| 265 | esci = new JMenuItem( main.stringaEsci ); | ||
| 266 | esci.addActionListener( new ActionListener() { | ||
| 267 | /* Ciede conferma prima di uscire. */ | ||
| 268 | public void actionPerformed( ActionEvent e ) { | ||
| 269 | int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroUscire, "JBriscola " + main.version, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo ); | ||
| 270 | if ( selezione == JOptionPane.YES_OPTION ) | ||
| 271 | Frame.this.dispose(); | ||
| 272 | } | ||
| 273 | }); | ||
| 274 | |||
| 275 | file.add( nuovaPartita ); | ||
| 276 | file.add( opzioni ); | ||
| 277 | file.addSeparator(); | ||
| 278 | file.add( esci ); | ||
| 279 | |||
| 280 | puntoInterrogativo = new JMenu( "?" ); | ||
| 281 | |||
| 282 | informazioni = new JMenuItem( main.stringaInformazioni ); | ||
| 283 | informazioni.addActionListener( new ActionListener() { | ||
| 284 | /* Visualizza le informazioni. */ | ||
| 285 | public void actionPerformed( ActionEvent e ) { | ||
| 286 | JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE ); | ||
| 287 | } | ||
| 288 | } ); | ||
| 289 | |||
| 290 | tastiRapidi = new JMenuItem( main.stringaTasti ); | ||
| 291 | tastiRapidi.addActionListener( new ActionListener() { | ||
| 292 | /* Visualizza i tasti rapidi. */ | ||
| 293 | public void actionPerformed( ActionEvent e ) { | ||
| 294 | JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 295 | } | ||
| 296 | } ); | ||
| 297 | |||
| 298 | punti = new JMenuItem( main.stringaPunteggio ); | ||
| 299 | punti.addActionListener( new ActionListener() { | ||
| 300 | /* Visualizza il punteggio. */ | ||
| 301 | public void actionPerformed( ActionEvent e ) { | ||
| 302 | JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE ); | ||
| 303 | } | ||
| 304 | } ); | ||
| 305 | |||
| 306 | aggiornamenti = new JMenuItem( main.stringaAggiornamenti ); | ||
| 307 | aggiornamenti.addActionListener( new ActionListener() { | ||
| 308 | /* Cerca aggiornamenti sul sito http://porkynator.altervista.org, | ||
| 309 | * confrontando la versione del programma con quella scritta nel | ||
| 310 | * file jbriscola-latest.is (online). */ | ||
| 311 | public void actionPerformed( ActionEvent e ) { | ||
| 312 | String latest = main.version; | ||
| 313 | try { | ||
| 314 | URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" ); | ||
| 315 | BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) ); | ||
| 316 | latest = latestIsReader.readLine(); | ||
| 317 | } catch ( Exception ex ) { | ||
| 318 | JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE ); | ||
| 319 | } | ||
| 320 | if ( latest.equals( main.version ) ) | ||
| 321 | JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 322 | else | ||
| 323 | JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE ); | ||
| 324 | } | ||
| 325 | } ); | ||
| 326 | |||
| 327 | puntoInterrogativo.add( punti ); | ||
| 328 | puntoInterrogativo.add( tastiRapidi ); | ||
| 329 | puntoInterrogativo.add( informazioni ); | ||
| 330 | puntoInterrogativo.add( aggiornamenti ); | ||
| 331 | |||
| 332 | barraMenu.add( file ); | ||
| 333 | barraMenu.add( puntoInterrogativo ); | ||
| 334 | |||
| 335 | setJMenuBar( barraMenu ); | ||
| 336 | |||
| 337 | /* Inizializza le immagini del retro delle carte. */ | ||
| 338 | retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) ); | ||
| 339 | retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) ); | ||
| 340 | |||
| 341 | /* Inizializza tutte le immagini delle carte scorrendo l'array bidimensionale. */ | ||
| 342 | for (int i = 0; i < 10; i++) | ||
| 343 | for (int j = 0; j < 4; j++) | ||
| 344 | arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) ); | ||
| 345 | |||
| 346 | /* Mischia le carte. */ | ||
| 347 | main.mischia(); | ||
| 348 | |||
| 349 | /* Aggiunge i vari componenti. */ | ||
| 350 | pannello2.add( button ); | ||
| 351 | setLayout( new BorderLayout() ); | ||
| 352 | add( pannello, BorderLayout.CENTER ); | ||
| 353 | add( pannello2, BorderLayout.SOUTH ); | ||
| 354 | |||
| 355 | /* Chiama il metodo mettiCarta se l'utente clicca. */ | ||
| 356 | addMouseListener( | ||
| 357 | new MouseAdapter() { | ||
| 358 | public void mouseClicked ( MouseEvent e ) { | ||
| 359 | if ( mettiCarta( e.getX(), e.getY() ) ) { | ||
| 360 | if ( !main.CPUHaGiocato ) | ||
| 361 | main.giocaCPU(); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | } | ||
| 365 | ); | ||
| 366 | |||
| 367 | /* Chiede conferma prima di uscire quando viene chiusa la finestra. */ | ||
| 368 | addWindowListener( | ||
| 369 | new WindowAdapter() { | ||
| 370 | public void windowClosing( WindowEvent e ) { | ||
| 371 | int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroUscire, "JBriscola " + main.version, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo ); | ||
| 372 | if ( selezione == JOptionPane.YES_OPTION ) | ||
| 373 | System.exit( 0 ); | ||
| 374 | } | ||
| 375 | } | ||
| 376 | ); | ||
| 377 | } | ||
| 378 | |||
| 379 | /* Se il giocatore ha cliccato su una carta la gioca e riproduce un suono casuale. */ | ||
| 380 | public boolean mettiCarta( int x, int y ) { | ||
| 381 | |||
| 382 | if ( !main.toccaAllaCPU && giocata[0] == null ) { | ||
| 383 | if ( main.sound && | ||
| 384 | ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) || | ||
| 385 | ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) || | ||
| 386 | ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) { | ||
| 387 | try { | ||
| 388 | |||
| 389 | double a = Math.random() * 6; | ||
| 390 | int i = (int) a; | ||
| 391 | |||
| 392 | AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") ); | ||
| 393 | AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") ); | ||
| 394 | AudioFormat af = aff.getFormat(); | ||
| 395 | DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) ); | ||
| 396 | Clip ol = ( Clip ) AudioSystem.getLine( info ); | ||
| 397 | |||
| 398 | ol.open(ais); | ||
| 399 | ol.loop( 0 ); | ||
| 400 | |||
| 401 | } catch ( Exception e ) { | ||
| 402 | System.err.println( e ); | ||
| 403 | } | ||
| 404 | } | ||
| 405 | |||
| 406 | if ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) { | ||
| 407 | giocata[0] = carteInMano[0]; | ||
| 408 | carteInMano[0] = null; | ||
| 409 | pannello.repaint(); | ||
| 410 | return true; | ||
| 411 | } | ||
| 412 | |||
| 413 | if ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) { | ||
| 414 | giocata[0] = carteInMano[1]; | ||
| 415 | carteInMano[1] = null; | ||
| 416 | pannello.repaint(); | ||
| 417 | return true; | ||
| 418 | } | ||
| 419 | |||
| 420 | if ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) { | ||
| 421 | giocata[0] = carteInMano[2]; | ||
| 422 | carteInMano[2] = null; | ||
| 423 | pannello.repaint(); | ||
| 424 | return true; | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | return false; | ||
| 429 | } | ||
| 430 | } | ||
| 431 | |||
| 432 | |||
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 | } | ||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2.2/src/OptionFrame.java new file mode 100755 index 0000000..d89745b --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/OptionFrame.java | |||
| @@ -0,0 +1,169 @@ | |||
| 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.util.Formatter; | ||
| 23 | import javax.swing.*; | ||
| 24 | import java.awt.*; | ||
| 25 | import java.awt.event.*; | ||
| 26 | |||
| 27 | public class OptionFrame extends JFrame { | ||
| 28 | |||
| 29 | public static Main main = new Main(); | ||
| 30 | public static Formatter formatter; | ||
| 31 | public static JButton ok, annulla, scegliColore; | ||
| 32 | public static JLabel lingua, sfondo; | ||
| 33 | public static JComboBox selezionaLingua; | ||
| 34 | public static JCheckBox suono, tastiRapidi; | ||
| 35 | public static JPanel[] pannello = new JPanel[6]; | ||
| 36 | |||
| 37 | public OptionFrame() { | ||
| 38 | |||
| 39 | super( "JBriscola - " + main.stringaModificaOpzioni ); | ||
| 40 | |||
| 41 | ok = new JButton( "OK" ); | ||
| 42 | ok.addActionListener( new ActionListener() { | ||
| 43 | |||
| 44 | /* Quando le modifiche vengono confermate premendo ok, viene scritto | ||
| 45 | * il file di configurazione (o aggiornato) se possibile, e modificate | ||
| 46 | * le impostazioni attuali. */ | ||
| 47 | public void actionPerformed( ActionEvent e ) { | ||
| 48 | |||
| 49 | try { | ||
| 50 | formatter = new Formatter( "JBriscolaConfig.txt" ); | ||
| 51 | } catch ( Exception ex ) { | ||
| 52 | JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE ); | ||
| 53 | } | ||
| 54 | |||
| 55 | String lang; | ||
| 56 | |||
| 57 | switch ( selezionaLingua.getSelectedIndex() ) { | ||
| 58 | case 0: | ||
| 59 | lang = "it"; | ||
| 60 | break; | ||
| 61 | case 1: | ||
| 62 | lang = "la"; | ||
| 63 | break; | ||
| 64 | case 2: | ||
| 65 | lang = "bl"; | ||
| 66 | break; | ||
| 67 | case 3: | ||
| 68 | lang = "bv"; | ||
| 69 | break; | ||
| 70 | case 4: | ||
| 71 | lang = "en"; | ||
| 72 | break; | ||
| 73 | default: | ||
| 74 | lang = "it"; | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | |||
| 78 | String suonosiono, tastisiono; | ||
| 79 | |||
| 80 | if ( suono.isSelected() ) | ||
| 81 | suonosiono = "suono=si"; | ||
| 82 | else | ||
| 83 | suonosiono = "suono=no"; | ||
| 84 | if ( tastiRapidi.isSelected() ) | ||
| 85 | tastisiono = "tasti=si"; | ||
| 86 | else | ||
| 87 | tastisiono = "tasti=no"; | ||
| 88 | |||
| 89 | formatter.format( lang ); | ||
| 90 | formatter.format( "\n" ); | ||
| 91 | formatter.format( suonosiono ); | ||
| 92 | formatter.format( "\n" ); | ||
| 93 | formatter.format( tastisiono ); | ||
| 94 | formatter.format( "\n" ); | ||
| 95 | formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() ); | ||
| 96 | formatter.close(); | ||
| 97 | |||
| 98 | main.settaOpzioni(); | ||
| 99 | |||
| 100 | OptionFrame.this.dispose(); | ||
| 101 | } | ||
| 102 | }); | ||
| 103 | |||
| 104 | annulla = new JButton( main.stringaAnnulla ); | ||
| 105 | annulla.addActionListener( new ActionListener() { | ||
| 106 | /* Se l'utente annulla viene chiusa la finestra senza fare nulla. */ | ||
| 107 | public void actionPerformed( ActionEvent e ) { | ||
| 108 | OptionFrame.this.dispose(); | ||
| 109 | } | ||
| 110 | }); | ||
| 111 | |||
| 112 | scegliColore = new JButton( " " ); | ||
| 113 | scegliColore.setBackground( main.color ); | ||
| 114 | scegliColore.addActionListener( new ActionListener() { | ||
| 115 | /* Permette di scegliere il colore dello sfondo. */ | ||
| 116 | public void actionPerformed( ActionEvent e ) { | ||
| 117 | Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color ); | ||
| 118 | if ( colore != null ) | ||
| 119 | main.color = colore; | ||
| 120 | OptionFrame.scegliColore.setBackground( main.color ); | ||
| 121 | } | ||
| 122 | } ); | ||
| 123 | |||
| 124 | /* Vengono impostati e disegnati i vari componenti. */ | ||
| 125 | lingua = new JLabel( main.stringaLingua ); | ||
| 126 | sfondo = new JLabel( main.stringaSfondo ); | ||
| 127 | String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV, main.stringaEN }; | ||
| 128 | selezionaLingua = new JComboBox( lingueDaSelezionare ); | ||
| 129 | int linguaPreselezionata = 0; | ||
| 130 | |||
| 131 | if ( main.lang.equals( "it" ) ) | ||
| 132 | linguaPreselezionata = 0; | ||
| 133 | else if ( main.lang.equals( "la" ) ) | ||
| 134 | linguaPreselezionata = 1; | ||
| 135 | else if ( main.lang.equals( "bl" ) ) | ||
| 136 | linguaPreselezionata = 2; | ||
| 137 | else if ( main.lang.equals( "bv" ) ) | ||
| 138 | linguaPreselezionata = 3; | ||
| 139 | else if ( main.lang.equals( "en" ) ) | ||
| 140 | linguaPreselezionata = 4; | ||
| 141 | |||
| 142 | selezionaLingua.setSelectedIndex( linguaPreselezionata ); | ||
| 143 | suono = new JCheckBox( main.stringaSuono ); | ||
| 144 | suono.setSelected( main.sound ); | ||
| 145 | tastiRapidi = new JCheckBox( main.stringaTasti ); | ||
| 146 | tastiRapidi.setSelected( main.keys ); | ||
| 147 | |||
| 148 | pannello[0] = new JPanel( new GridLayout( 4, 1 ) ); | ||
| 149 | pannello[1] = new JPanel( new FlowLayout() ); | ||
| 150 | pannello[2] = new JPanel( new FlowLayout() ); | ||
| 151 | pannello[3] = new JPanel( new FlowLayout() ); | ||
| 152 | pannello[4] = new JPanel( new FlowLayout() ); | ||
| 153 | pannello[5] = new JPanel( new FlowLayout() ); | ||
| 154 | pannello[5].add( ok ); | ||
| 155 | pannello[5].add( annulla ); | ||
| 156 | pannello[4].add( sfondo ); | ||
| 157 | pannello[4].add( scegliColore ); | ||
| 158 | pannello[3].add( tastiRapidi ); | ||
| 159 | pannello[2].add( suono ); | ||
| 160 | pannello[1].add( lingua ); | ||
| 161 | pannello[1].add( selezionaLingua ); | ||
| 162 | pannello[0].add( pannello[1] ); | ||
| 163 | pannello[0].add( pannello[2] ); | ||
| 164 | pannello[0].add( pannello[3] ); | ||
| 165 | pannello[0].add( pannello[4] ); | ||
| 166 | add( pannello[0], BorderLayout.CENTER ); | ||
| 167 | add( pannello[5], BorderLayout.SOUTH ); | ||
| 168 | } | ||
| 169 | } | ||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/Pannello.java b/JBriscola/all_versions/0.2/0.2.2/src/Pannello.java new file mode 100755 index 0000000..0de79f6 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/Pannello.java | |||
| @@ -0,0 +1,56 @@ | |||
| 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 javax.swing.*; | ||
| 23 | import java.awt.*; | ||
| 24 | |||
| 25 | /* Questa classe dispone semplicemente le carte | ||
| 26 | * sulla finestra e imposta la sfondo. */ | ||
| 27 | public class Pannello extends JPanel { | ||
| 28 | public static Main main; | ||
| 29 | public static Color color; | ||
| 30 | public Pannello() { } | ||
| 31 | public void paint( Graphics g ) { | ||
| 32 | super.paint( g ); | ||
| 33 | setBackground( main.color ); | ||
| 34 | if ( main.frame.ultimaCarta != null ) | ||
| 35 | main.frame.ultimaCarta.paintIcon( this, g, 50, 180 ); | ||
| 36 | if ( main.frame.mazzo ) | ||
| 37 | main.frame.retro2.paintIcon( this, g, 17, 256 ); | ||
| 38 | if ( main.frame.carteCPU[0] != null ) | ||
| 39 | main.frame.retro1.paintIcon( this, g, 230, 5 ); | ||
| 40 | if ( main.frame.carteCPU[1] != null ) | ||
| 41 | main.frame.retro1.paintIcon( this, g, 300, 5 ); | ||
| 42 | if ( main.frame.carteCPU[2] != null ) | ||
| 43 | main.frame.retro1.paintIcon( this, g, 370, 5 ); | ||
| 44 | if ( main.frame.carteInMano[0] != null ) | ||
| 45 | main.frame.carteInMano[0].paintIcon( this, g, 230, 340 ); | ||
| 46 | if ( main.frame.carteInMano[1] != null ) | ||
| 47 | main.frame.carteInMano[1].paintIcon( this, g, 300, 340 ); | ||
| 48 | if ( main.frame.carteInMano[2] != null ) | ||
| 49 | main.frame.carteInMano[2].paintIcon( this, g, 370, 340 ); | ||
| 50 | if ( main.frame.giocata[0] != null ) | ||
| 51 | main.frame.giocata[0].paintIcon( this, g, 250, 200 ); | ||
| 52 | if ( main.frame.giocata[1] != null ) | ||
| 53 | main.frame.giocata[1].paintIcon( this, g, 325, 150 ); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/1-1.jpg new file mode 100755 index 0000000..ae43510 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/1-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/1-2.jpg new file mode 100755 index 0000000..3f7c75a --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/1-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/1-3.jpg new file mode 100755 index 0000000..9e1ead7 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/1-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/1-4.jpg new file mode 100755 index 0000000..710f879 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/1-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/10-1.jpg new file mode 100755 index 0000000..9aba45a --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/10-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/10-2.jpg new file mode 100755 index 0000000..037eeb7 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/10-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/10-3.jpg new file mode 100755 index 0000000..8780b72 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/10-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/10-4.jpg new file mode 100755 index 0000000..587dc0f --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/10-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/2-1.jpg new file mode 100755 index 0000000..5dcb7db --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/2-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/2-2.jpg new file mode 100755 index 0000000..ea9eeb7 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/2-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/2-3.jpg new file mode 100755 index 0000000..8cb22dd --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/2-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/2-4.jpg new file mode 100755 index 0000000..b3e7898 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/2-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/3-1.jpg new file mode 100755 index 0000000..dcb435c --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/3-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/3-2.jpg new file mode 100755 index 0000000..1e5b6ec --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/3-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/3-3.jpg new file mode 100755 index 0000000..9202cfe --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/3-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/3-4.jpg new file mode 100755 index 0000000..5436a8d --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/3-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/4-1.jpg new file mode 100755 index 0000000..3bab6d5 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/4-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/4-2.jpg new file mode 100755 index 0000000..b4901a6 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/4-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/4-3.jpg new file mode 100755 index 0000000..d754ad8 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/4-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/4-4.jpg new file mode 100755 index 0000000..3a54b96 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/4-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/5-1.jpg new file mode 100755 index 0000000..3f7ba1f --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/5-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/5-2.jpg new file mode 100755 index 0000000..fcacb75 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/5-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/5-3.jpg new file mode 100755 index 0000000..ce32f9f --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/5-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/5-4.jpg new file mode 100755 index 0000000..b86b09a --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/5-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/6-1.jpg new file mode 100755 index 0000000..f90cd81 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/6-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/6-2.jpg new file mode 100755 index 0000000..cf2a67a --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/6-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/6-3.jpg new file mode 100755 index 0000000..2cd2fe2 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/6-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/6-4.jpg new file mode 100755 index 0000000..73f410f --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/6-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/7-1.jpg new file mode 100755 index 0000000..08cd397 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/7-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/7-2.jpg new file mode 100755 index 0000000..a168ff8 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/7-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/7-3.jpg new file mode 100755 index 0000000..5cda411 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/7-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/7-4.jpg new file mode 100755 index 0000000..5d63229 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/7-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/8-1.jpg new file mode 100755 index 0000000..a6faa7b --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/8-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/8-2.jpg new file mode 100755 index 0000000..0d9edbb --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/8-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/8-3.jpg new file mode 100755 index 0000000..91f8354 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/8-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/8-4.jpg new file mode 100755 index 0000000..cc0089c --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/8-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/9-1.jpg new file mode 100755 index 0000000..be9c6bf --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/9-1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/9-2.jpg new file mode 100755 index 0000000..e25da4c --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/9-2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/9-3.jpg new file mode 100755 index 0000000..cd384f8 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/9-3.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/9-4.jpg new file mode 100755 index 0000000..441210e --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/9-4.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/carte.jpg new file mode 100755 index 0000000..838ffac --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/carte.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/retro1.jpg new file mode 100755 index 0000000..9651b06 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/retro1.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2.2/src/img/retro2.jpg new file mode 100755 index 0000000..c5d3925 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/img/retro2.jpg | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/0.wav new file mode 100755 index 0000000..67d9abd --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/0.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/1.wav new file mode 100755 index 0000000..9357c97 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/1.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/2.wav new file mode 100755 index 0000000..92b1541 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/2.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/3.wav new file mode 100755 index 0000000..45a6e42 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/3.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/4.wav new file mode 100755 index 0000000..1f7ec90 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/4.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/5.wav new file mode 100755 index 0000000..3627f96 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/5.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/pareggio.wav new file mode 100755 index 0000000..ff978e6 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/pareggio.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/perso.wav new file mode 100755 index 0000000..a454ba4 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/perso.wav | |||
| Binary files differ | |||
diff --git a/JBriscola/all_versions/0.2/0.2.2/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2.2/src/sounds/vinto.wav new file mode 100755 index 0000000..a6f3ac5 --- /dev/null +++ b/JBriscola/all_versions/0.2/0.2.2/src/sounds/vinto.wav | |||
| Binary files differ | |||
