aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
commit7167b4341ef290d56fb96e2af10883a4b925d83b (patch)
tree1eb1b9e5ab82ddd89540e68d6b22ae69514575c6
downloadancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.tar.gz
ancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.zip
I found my old code!HEADmaster
-rwxr-xr-xGiocoUno/GiocoUno.BAT1
-rwxr-xr-xGiocoUno/GiocoUno.classbin0 -> 4170 bytes
-rwxr-xr-xGiocoUno/GiocoUno.java241
-rwxr-xr-xGiocoUno/GiocoUno.sh1
-rwxr-xr-xGiocoUno/Readme.txt3
-rwxr-xr-xJBriscola/JBriscola.jarbin0 -> 1357647 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Alpha 1/src/Frame.java118
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Alpha 1/src/Main.java211
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Alpha 1/src/Pannello.java53
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 1/src/Frame.java159
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 1/src/Main.java399
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 1/src/Pannello.java53
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 2/src/Frame.java174
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 2/src/Main.java492
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 2/src/OptionFrame.java83
-rwxr-xr-xJBriscola/all_versions/0.1/0.1 Beta 2/src/Pannello.java53
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/Frame.java186
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/Main.java708
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java87
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/Pannello.java53
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.1/0.1.1/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/Frame.java242
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/Main.java1068
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/OptionFrame.java129
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/Pannello.java54
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/Frame.java243
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/Main.java1069
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/OptionFrame.java129
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/Pannello.java54
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/Frame.java306
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/Main.java1080
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/OptionFrame.java129
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/Pannello.java54
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/Frame.java348
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/Main.java1101
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java140
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/Pannello.java54
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/Frame.java432
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/Main.java1317
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/OptionFrame.java169
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/Pannello.java56
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.2/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/Frame.java308
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/Main.java1077
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/OptionFrame.java140
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/Pannello.java54
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.2/0.2/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/Frame.java523
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/Main.java1637
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/OptionFrame.java169
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/Pannello.java88
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/Thumbs.dbbin0 -> 155648 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.1/src/sounds/vinto.wavbin0 -> 152108 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/CartePassateFrame.java39
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/Frame.java552
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/Main.java2086
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/OptionFrame.java169
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/Pannello.java88
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/PannelloCartePassate.java49
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/Thumbs.dbbin0 -> 155648 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3.2/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/Frame.java523
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/Main.java1702
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/OptionFrame.java169
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/Pannello.java88
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/1-1.jpgbin0 -> 3893 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/1-2.jpgbin0 -> 3688 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/1-3.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/1-4.jpgbin0 -> 3827 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/10-1.jpgbin0 -> 3375 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/10-2.jpgbin0 -> 3831 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/10-3.jpgbin0 -> 3699 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/10-4.jpgbin0 -> 3638 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/2-1.jpgbin0 -> 3351 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/2-2.jpgbin0 -> 3228 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/2-3.jpgbin0 -> 3111 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/2-4.jpgbin0 -> 3711 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/3-1.jpgbin0 -> 3527 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/3-2.jpgbin0 -> 3249 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/3-3.jpgbin0 -> 3235 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/3-4.jpgbin0 -> 3647 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/4-1.jpgbin0 -> 3616 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/4-2.jpgbin0 -> 3640 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/4-3.jpgbin0 -> 3121 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/4-4.jpgbin0 -> 3867 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/5-1.jpgbin0 -> 3703 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/5-2.jpgbin0 -> 3535 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/5-3.jpgbin0 -> 2854 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/5-4.jpgbin0 -> 3829 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/6-1.jpgbin0 -> 3717 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/6-2.jpgbin0 -> 3673 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/6-3.jpgbin0 -> 3140 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/6-4.jpgbin0 -> 3982 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/7-1.jpgbin0 -> 3798 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/7-2.jpgbin0 -> 3630 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/7-3.jpgbin0 -> 3265 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/7-4.jpgbin0 -> 3958 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/8-1.jpgbin0 -> 3777 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/8-2.jpgbin0 -> 3694 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/8-3.jpgbin0 -> 3742 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/8-4.jpgbin0 -> 3526 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/9-1.jpgbin0 -> 3558 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/9-2.jpgbin0 -> 3614 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/9-3.jpgbin0 -> 3485 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/9-4.jpgbin0 -> 3542 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/Thumbs.dbbin0 -> 155648 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/carte.jpgbin0 -> 348200 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/retro1.jpgbin0 -> 3850 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/img/retro2.jpgbin0 -> 3848 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/0.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/1.wavbin0 -> 71468 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/2.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/3.wavbin0 -> 18476 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/4.wavbin0 -> 21932 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/5.wavbin0 -> 34604 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/pareggio.wavbin0 -> 253484 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/perso.wavbin0 -> 94508 bytes
-rwxr-xr-xJBriscola/all_versions/0.3/0.3/src/sounds/vinto.wavbin0 -> 152108 bytes
-rw-r--r--JBriscola/trucchi.txt18
-rwxr-xr-xPagaLavoro/PagaLavoro.bat1
-rwxr-xr-xPagaLavoro/PagaLavoro.classbin0 -> 2392 bytes
-rwxr-xr-xPagaLavoro/PagaLavoro.java55
-rwxr-xr-xPagaLavoro/PagaLavoro.sh1
-rwxr-xr-xPagaLavoro/Readme.txt2
-rw-r--r--README.md60
-rwxr-xr-xSlackYouInterpreter/README.txt29
-rwxr-xr-xSlackYouInterpreter/SlackYouInterpreter-1.1/src/Frame.java209
-rwxr-xr-xSlackYouInterpreter/SlackYouInterpreter-1.1/src/HelloWorld.sky12
-rwxr-xr-xSlackYouInterpreter/SlackYouInterpreter-1.1/src/Main.java325
-rwxr-xr-xSlackYouInterpreter/SlackYouInterpreter.jarbin0 -> 11315 bytes
-rwxr-xr-xpbfi/PBFI.jarbin0 -> 9636 bytes
-rwxr-xr-xpbfi/pbfi-1.0/src/Frame.java49
-rwxr-xr-xpbfi/pbfi-1.0/src/Main.java119
-rwxr-xr-xpbfi/pbfi-1.1/src/99BottlesOfBeer.bfk249
-rwxr-xr-xpbfi/pbfi-1.1/src/Frame.java209
-rwxr-xr-xpbfi/pbfi-1.1/src/HelloWorld.bfk20
-rwxr-xr-xpbfi/pbfi-1.1/src/Main.java119
-rwxr-xr-xpbfi/pbfi-1.1/src/Quine.bfk13
-rwxr-xr-xrobottino/Robottino.jarbin0 -> 207946 bytes
-rwxr-xr-xrobottino/all_versions/Changelog.txt20
-rwxr-xr-xrobottino/all_versions/v1.0/Esegui.bat2
-rwxr-xr-xrobottino/all_versions/v1.0/Esegui.sh2
-rwxr-xr-xrobottino/all_versions/v1.0/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v1.0/bin/PartiDelRobot.classbin0 -> 379 bytes
-rwxr-xr-xrobottino/all_versions/v1.0/bin/Robottino.classbin0 -> 6493 bytes
-rwxr-xr-xrobottino/all_versions/v1.0/src/PartiDelRobot.java9
-rwxr-xr-xrobottino/all_versions/v1.0/src/Robottino.java160
-rwxr-xr-xrobottino/all_versions/v2.0/Esegui.bat2
-rwxr-xr-xrobottino/all_versions/v2.0/Esegui.sh2
-rwxr-xr-xrobottino/all_versions/v2.0/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v2.0/bin/PartiDelRobot.classbin0 -> 379 bytes
-rwxr-xr-xrobottino/all_versions/v2.0/bin/Robottino.classbin0 -> 9673 bytes
-rwxr-xr-xrobottino/all_versions/v2.0/src/PartiDelRobot.java9
-rwxr-xr-xrobottino/all_versions/v2.0/src/Robottino.java270
-rwxr-xr-xrobottino/all_versions/v2.1/Esegui.bat2
-rwxr-xr-xrobottino/all_versions/v2.1/Esegui.sh2
-rwxr-xr-xrobottino/all_versions/v2.1/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v2.1/bin/PartiDelRobot.classbin0 -> 379 bytes
-rwxr-xr-xrobottino/all_versions/v2.1/bin/Robottino.classbin0 -> 10163 bytes
-rwxr-xr-xrobottino/all_versions/v2.1/src/PartiDelRobot.java9
-rwxr-xr-xrobottino/all_versions/v2.1/src/Robottino.java258
-rwxr-xr-xrobottino/all_versions/v2.2/Esegui.bat3
-rwxr-xr-xrobottino/all_versions/v2.2/Esegui.sh3
-rwxr-xr-xrobottino/all_versions/v2.2/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v2.2/bin/RobottinoAzioni/RobottinoAzioni.classbin0 -> 8973 bytes
-rwxr-xr-xrobottino/all_versions/v2.2/bin/RobottinoMain/Robottino.classbin0 -> 2677 bytes
-rwxr-xr-xrobottino/all_versions/v2.2/bin/RobottinoUtils/Grafica.classbin0 -> 914 bytes
-rwxr-xr-xrobottino/all_versions/v2.2/bin/RobottinoUtils/Listener.classbin0 -> 1610 bytes
-rwxr-xr-xrobottino/all_versions/v2.2/bin/RobottinoUtils/PartiDelRobot.classbin0 -> 394 bytes
-rwxr-xr-xrobottino/all_versions/v2.2/src/RobottinoAzioni/RobottinoAzioni.java369
-rwxr-xr-xrobottino/all_versions/v2.2/src/RobottinoMain/Robottino.java115
-rwxr-xr-xrobottino/all_versions/v2.2/src/RobottinoUtils/Grafica.java60
-rwxr-xr-xrobottino/all_versions/v2.2/src/RobottinoUtils/Listener.java62
-rwxr-xr-xrobottino/all_versions/v2.2/src/RobottinoUtils/PartiDelRobot.java22
-rwxr-xr-xrobottino/all_versions/v2.3/Esegui.bat3
-rwxr-xr-xrobottino/all_versions/v2.3/Esegui.sh3
-rwxr-xr-xrobottino/all_versions/v2.3/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v2.3/bin/RobottinoAzioni/RobottinoAzioni.classbin0 -> 9270 bytes
-rwxr-xr-xrobottino/all_versions/v2.3/bin/RobottinoMain/Robottino.classbin0 -> 1957 bytes
-rwxr-xr-xrobottino/all_versions/v2.3/bin/RobottinoUtils/Grafica.classbin0 -> 4503 bytes
-rwxr-xr-xrobottino/all_versions/v2.3/bin/RobottinoUtils/Listener.classbin0 -> 2134 bytes
-rwxr-xr-xrobottino/all_versions/v2.3/bin/RobottinoUtils/PartiDelRobot.classbin0 -> 394 bytes
-rwxr-xr-xrobottino/all_versions/v2.3/src/RobottinoAzioni/RobottinoAzioni.java397
-rwxr-xr-xrobottino/all_versions/v2.3/src/RobottinoMain/Robottino.java83
-rwxr-xr-xrobottino/all_versions/v2.3/src/RobottinoUtils/Grafica.java210
-rwxr-xr-xrobottino/all_versions/v2.3/src/RobottinoUtils/Listener.java72
-rwxr-xr-xrobottino/all_versions/v2.3/src/RobottinoUtils/PartiDelRobot.java22
-rwxr-xr-xrobottino/all_versions/v3.0/Esegui.bat3
-rwxr-xr-xrobottino/all_versions/v3.0/Esegui.sh3
-rwxr-xr-xrobottino/all_versions/v3.0/Readme.txt10
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/ImmagineRobot.classbin0 -> 1143 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/Immagini/img/robot.gifbin0 -> 15158 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/RobottinoAzioni/RobottinoAzioni.classbin0 -> 9270 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/RobottinoMain/Robottino.classbin0 -> 1020 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/RobottinoUtils/Grafica.classbin0 -> 5043 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/RobottinoUtils/Listener.classbin0 -> 2193 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/bin/RobottinoUtils/PartiDelRobot.classbin0 -> 394 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/ImmagineRobot.java35
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/Immagini/img/robot.gifbin0 -> 15158 bytes
-rwxr-xr-xrobottino/all_versions/v3.0/src/RobottinoAzioni/RobottinoAzioni.java397
-rwxr-xr-xrobottino/all_versions/v3.0/src/RobottinoMain/Robottino.java63
-rwxr-xr-xrobottino/all_versions/v3.0/src/RobottinoUtils/Grafica.java226
-rwxr-xr-xrobottino/all_versions/v3.0/src/RobottinoUtils/Listener.java73
-rwxr-xr-xrobottino/all_versions/v3.0/src/RobottinoUtils/PartiDelRobot.java22
-rwxr-xr-xrobottino/all_versions/v4.0.1/Robottino.jarbin0 -> 155568 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/Frame.java66
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/List.java74
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/Main.java36
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/Robot.java107
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/RobotFrame.java118
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/RobotPanel.java96
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/birra1.jpgbin0 -> 15478 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/birra2.jpgbin0 -> 18106 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/birra3.jpgbin0 -> 14673 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/birra4.jpgbin0 -> 36627 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/birra5.gifbin0 -> 13960 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/laon.gifbin0 -> 4151 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/llon.gifbin0 -> 2557 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/raon.gifbin0 -> 5121 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/rlon.gifbin0 -> 2705 bytes
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/img/robot.gifbin0 -> 15158 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/Robottino.jarbin0 -> 58495 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/Frame.java66
-rwxr-xr-xrobottino/all_versions/v4.0/src/List.java74
-rwxr-xr-xrobottino/all_versions/v4.0/src/Main.java36
-rwxr-xr-xrobottino/all_versions/v4.0/src/Robot.java126
-rwxr-xr-xrobottino/all_versions/v4.0/src/RobotFrame.java179
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/laon.gifbin0 -> 4151 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/llon.gifbin0 -> 2557 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/raon.gifbin0 -> 5121 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/rlon.gifbin0 -> 2705 bytes
-rwxr-xr-xrobottino/all_versions/v4.0/src/img/robot.gifbin0 -> 15158 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/Robottino.jarbin0 -> 211887 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/license.txt340
-rwxr-xr-xrobottino/all_versions/v4.1/src/Frame.java66
-rwxr-xr-xrobottino/all_versions/v4.1/src/List.java74
-rwxr-xr-xrobottino/all_versions/v4.1/src/Main.java36
-rwxr-xr-xrobottino/all_versions/v4.1/src/Robot.java101
-rwxr-xr-xrobottino/all_versions/v4.1/src/RobotFrame.java312
-rwxr-xr-xrobottino/all_versions/v4.1/src/RobotPanel.java96
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/birra1.jpgbin0 -> 15478 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/birra2.jpgbin0 -> 18106 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/birra3.jpgbin0 -> 14673 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/birra4.jpgbin0 -> 36627 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/birra5.gifbin0 -> 13960 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/boom.pngbin0 -> 53636 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/laon.gifbin0 -> 4151 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/llon.gifbin0 -> 2557 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/raon.gifbin0 -> 5121 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/rlon.gifbin0 -> 2705 bytes
-rwxr-xr-xrobottino/all_versions/v4.1/src/img/robot.gifbin0 -> 15158 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/Robottino.jarbin0 -> 207946 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/license.txt340
-rwxr-xr-xrobottino/all_versions/v4.2/src/Frame.java314
-rwxr-xr-xrobottino/all_versions/v4.2/src/Main.java34
-rwxr-xr-xrobottino/all_versions/v4.2/src/Robot.java72
-rwxr-xr-xrobottino/all_versions/v4.2/src/RobotPanel.java94
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/birra1.jpgbin0 -> 15478 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/birra2.jpgbin0 -> 18106 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/birra3.jpgbin0 -> 14673 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/birra4.jpgbin0 -> 36627 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/birra5.gifbin0 -> 13960 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/boom.pngbin0 -> 53636 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/laoff.gifbin0 -> 4148 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/laon.gifbin0 -> 4151 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/lloff.gifbin0 -> 4552 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/llon.gifbin0 -> 2557 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/raoff.gifbin0 -> 5137 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/raon.gifbin0 -> 5121 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/rloff.gifbin0 -> 4802 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/rlon.gifbin0 -> 2705 bytes
-rwxr-xr-xrobottino/all_versions/v4.2/src/img/robot.gifbin0 -> 15158 bytes
737 files changed, 28110 insertions, 0 deletions
diff --git a/GiocoUno/GiocoUno.BAT b/GiocoUno/GiocoUno.BAT
new file mode 100755
index 0000000..471c907
--- /dev/null
+++ b/GiocoUno/GiocoUno.BAT
@@ -0,0 +1 @@
java GiocoUno
diff --git a/GiocoUno/GiocoUno.class b/GiocoUno/GiocoUno.class
new file mode 100755
index 0000000..51d01da
--- /dev/null
+++ b/GiocoUno/GiocoUno.class
Binary files differ
diff --git a/GiocoUno/GiocoUno.java b/GiocoUno/GiocoUno.java
new file mode 100755
index 0000000..d967dbd
--- /dev/null
+++ b/GiocoUno/GiocoUno.java
@@ -0,0 +1,241 @@
1import javax.swing.JOptionPane;
2public class GiocoUno {
3 public static void main(String args[]) {
4 int grpas = 0,
5 grpbs = 0,
6 grpcs = 0,
7 grpds = 0,
8 grpes = 0,
9 A = 2,
10 B = 1,
11 C = 16,
12 D = 8,
13 E = 4;
14 String grpa = "",
15 grpb = "",
16 grpc = "",
17 grpd = "",
18 grpe = "";
19 JOptionPane.showMessageDialog(null,"Con questo giochetto vi stupirò (forse)\n\nPremi OK per continuare","Gioco numero uno",1);
20 JOptionPane.showMessageDialog(null,"Scegli un numero da 1 a 30...\n\nE premi OK per continuare","Gioco numero uno",1);
21 JOptionPane.showMessageDialog(null,"In quali di questi 5 gruppi appare il vostro numero?\n\nGruppo A: 2; 27; 14; 15; 18; 10; 22; 7; 19; 26; 23; 6; 3; 11; 30\nGruppo B: 1; 5; 17; 11; 9; 21; 3; 29; 19; 7; 15; 25; 23; 13; 27\nGruppo C: 16; 24; 28; 17; 30; 21; 18; 22; 23; 19; 26; 27; 25; 20; 29\nGruppo D: 8; 9; 30; 10; 27; 14; 26; 28; 13; 11; 29; 24; 12; 15; 25\nGruppo E: 4; 23; 20; 7; 12; 15; 6; 30; 5; 21; 14; 22; 13; 29; 28","Gioco numero uno",1);
22 grpa=JOptionPane.showInputDialog("Il numero appariva nel gruppo A?\n(1 per sì o qualunque altro numero per no)");
23 grpas=Integer.parseInt(grpa);
24 if (grpas == 1) {
25 grpb=JOptionPane.showInputDialog("Il numero appariva nel gruppo B?\n(1 per sì o qualunque altro numero per no)");
26 grpbs=Integer.parseInt(grpb);
27 if (grpbs == 1) {
28 grpc=JOptionPane.showInputDialog("Il numero appariva nel gruppo C?\n(1 per sì o qualunque altro numero per no)");
29 grpcs=Integer.parseInt(grpc);
30 if (grpcs == 1) {
31 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
32 grpds=Integer.parseInt(grpd);
33 if (grpds == 1) {
34 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
35 grpes=Integer.parseInt(grpe);
36 if (grpes == 1) {
37 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + C + D + E));
38 }
39 else {
40 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + C + D));
41 }
42 }
43 else {
44 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
45 grpes=Integer.parseInt(grpe);
46 if (grpes == 1) {
47 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + C + E));
48 }
49 else {
50 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + C));
51 }
52 }
53 }
54 else {
55 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
56 grpds=Integer.parseInt(grpd);
57 if (grpds == 1) {
58 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
59 grpes=Integer.parseInt(grpe);
60 if (grpes == 1) {
61 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + D + E));
62 }
63 else {
64 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + D));
65 }
66 }
67 else {
68 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
69 grpes=Integer.parseInt(grpe);
70 if (grpes == 1) {
71 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B + E));
72 }
73 else {
74 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + B));
75 }
76 }
77 }
78 }
79 else {
80 grpc=JOptionPane.showInputDialog("Il numero appariva nel gruppo C?\n(1 per sì o qualunque altro numero per no)");
81 grpcs=Integer.parseInt(grpc);
82 if (grpcs == 1) {
83 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
84 grpds=Integer.parseInt(grpd);
85 if (grpds == 1) {
86 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
87 grpes=Integer.parseInt(grpe);
88 if (grpes == 1) {
89 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + C + D + E));
90 }
91 else {
92 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + C + D));
93 }
94 }
95 else {
96 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
97 grpes=Integer.parseInt(grpe);
98 if (grpes == 1) {
99 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + C + E));
100 }
101 else {
102 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + C));
103 }
104 }
105 }
106 else {
107 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
108 grpds=Integer.parseInt(grpd);
109 if (grpds == 1) {
110 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
111 grpes=Integer.parseInt(grpe);
112 if (grpes == 1) {
113 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + D + E));
114 }
115 else {
116 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + D));
117 }
118 }
119 else {
120 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
121 grpes=Integer.parseInt(grpe);
122 if (grpes == 1) {
123 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (A + E));
124 }
125 else {
126 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + A);
127 }
128 }
129 }
130 }
131 }
132 else {
133 grpb=JOptionPane.showInputDialog("Il numero appariva nel gruppo B?\n(1 per sì o qualunque altro numero per no)");
134 grpbs=Integer.parseInt(grpb);
135 if (grpbs == 1) {
136 grpc=JOptionPane.showInputDialog("Il numero appariva nel gruppo C?\n(1 per sì o qualunque altro numero per no)");
137 grpcs=Integer.parseInt(grpc);
138 if (grpcs == 1) {
139 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
140 grpds=Integer.parseInt(grpd);
141 if (grpds == 1) {
142 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
143 grpes=Integer.parseInt(grpe);
144 if (grpes == 1) {
145 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + C + D + E));
146 }
147 else {
148 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + C + D));
149 }
150 }
151 else {
152 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
153 grpes=Integer.parseInt(grpe);
154 if (grpes == 1) {
155 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + C + E));
156 }
157 else {
158 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + C));
159 }
160 }
161 }
162 else {
163 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
164 grpds=Integer.parseInt(grpd);
165 if (grpds == 1) {
166 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
167 grpes=Integer.parseInt(grpe);
168 if (grpes == 1) {
169 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + D + E));
170 }
171 else {
172 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + D));
173 }
174 }
175 else {
176 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
177 grpes=Integer.parseInt(grpe);
178 if (grpes == 1) {
179 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (B + E));
180 }
181 else {
182 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + B);
183 }
184 }
185 }
186 }
187 else {
188 grpc=JOptionPane.showInputDialog("Il numero appariva nel gruppo C?\n(1 per sì o qualunque altro numero per no)");
189 grpcs=Integer.parseInt(grpc);
190 if (grpcs == 1) {
191 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
192 grpds=Integer.parseInt(grpd);
193 if (grpds == 1) {
194 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
195 grpes=Integer.parseInt(grpe);
196 if (grpes == 1) {
197 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (C + D + E));
198 }
199 else {
200 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (C + D));
201 }
202 }
203 else {
204 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
205 grpes=Integer.parseInt(grpe);
206 if (grpes == 1) {
207 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (C + E));
208 }
209 else {
210 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + C);
211 }
212 }
213 }
214 else {
215 grpd=JOptionPane.showInputDialog("Il numero appariva nel gruppo D?\n(1 per sì o qualunque altro numero per no)");
216 grpds=Integer.parseInt(grpd);
217 if (grpds == 1) {
218 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
219 grpes=Integer.parseInt(grpe);
220 if (grpes == 1) {
221 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + (D + E));
222 }
223 else {
224 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + D);
225 }
226 }
227 else {
228 grpe=JOptionPane.showInputDialog("Il numero appariva nel gruppo E?\n(1 per sì o qualunque altro numero per no)");
229 grpes=Integer.parseInt(grpe);
230 if (grpes == 1) {
231 JOptionPane.showMessageDialog(null,"Il numero che hai pensato è " + E);
232 }
233 else {
234 JOptionPane.showMessageDialog(null,"Errore! Deve pur eesere da qualche parte!");
235 }
236 }
237 }
238 }
239 }
240 }
241} \ No newline at end of file
diff --git a/GiocoUno/GiocoUno.sh b/GiocoUno/GiocoUno.sh
new file mode 100755
index 0000000..471c907
--- /dev/null
+++ b/GiocoUno/GiocoUno.sh
@@ -0,0 +1 @@
java GiocoUno
diff --git a/GiocoUno/Readme.txt b/GiocoUno/Readme.txt
new file mode 100755
index 0000000..2d67d6c
--- /dev/null
+++ b/GiocoUno/Readme.txt
@@ -0,0 +1,3 @@
1Ecco il gioco che vi legge nel pensiero!
2Non mi credete? provatelo!
3Se usate windows aprite il file GiocoUno.BAT, se usate linux GiocoUno.sh \ No newline at end of file
diff --git a/JBriscola/JBriscola.jar b/JBriscola/JBriscola.jar
new file mode 100755
index 0000000..9306db5
--- /dev/null
+++ b/JBriscola/JBriscola.jar
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Frame.java b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Frame.java
new file mode 100755
index 0000000..a372588
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Frame.java
@@ -0,0 +1,118 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24import java.awt.event.*;
25
26public class Frame extends JFrame {
27 public static boolean mazzo;
28 public static Main main;
29 public static Pannello pannello;
30 public static JButton button;
31 public static ImageIcon retro1, retro2, ultimaCarta;
32 public static ImageIcon[] giocata = new ImageIcon[2];
33 public static ImageIcon[] carteInMano = new ImageIcon[3];
34 public static ImageIcon[] carteCPU = new ImageIcon[3];
35 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
36 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
37 public Frame() {
38 super( "Tronto's JBriscola 0.1" );
39 mazzo = true;
40 main = new Main();
41 pannello = new Pannello();
42 button = new JButton( "Prendi/Lascia carte" );
43 button.addActionListener( new ActionListener() {
44 public void actionPerformed( ActionEvent e ) {
45 if ( giocata[0] != null && giocata[1] != null )
46 main.mano++;
47 else
48 JOptionPane.showMessageDialog( Frame.this, "Prima gioca!" );
49 try {
50 main.chiPrende();
51 } catch ( Exception ex ) {
52 JOptionPane.showMessageDialog( Frame.this, "Prima gioca!" );
53 }
54 if ( main.mano == 16 )
55 JOptionPane.showMessageDialog( Frame.this, "Ultime 4 mani - occhio alla briscola!" );
56 if ( main.mano == 17 ) {
57 mazzo = false;
58 ultimaCarta = null;
59 pannello.repaint();
60 Frame.this.repaint();
61 }
62 if ( main.mano == 20 )
63 JOptionPane.showMessageDialog( Frame.this, "Giocatore: " + main.punteggio + "\nComputer: " + main.punteggioCPU + "\n\nMa grazie tante, il computer gioca a caso!\nNon serve che ti gasi tanto." );
64 }
65 } );
66 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
67 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
68 for (int i = 0; i < 10; i++)
69 for (int j = 0; j < 4; j++)
70 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
71 main.mischia();
72 carteInMano[0] = arrayCarteMescolate[0];
73 carteInMano[1] = arrayCarteMescolate[1];
74 carteInMano[2] = arrayCarteMescolate[2];
75 carteCPU[0] = arrayCarteMescolate[3];
76 carteCPU[1] = arrayCarteMescolate[4];
77 carteCPU[2] = arrayCarteMescolate[5];
78 ultimaCarta = arrayCarteMescolate[39];
79 setLayout( new BorderLayout() );
80 add( pannello, BorderLayout.CENTER );
81 add( button, BorderLayout.SOUTH );
82 addMouseListener(
83 new MouseAdapter() {
84 public void mouseClicked ( MouseEvent e ) {
85 if ( mettiCarta( e.getX(), e.getY() ) ) {
86 if ( !main.CPUHaGiocato )
87 main.giocaCPU();
88 }
89 }
90 }
91 );
92 }
93 public boolean mettiCarta( int x, int y ) {
94 if ( !main.toccaAllaCPU && giocata[0] == null ) {
95 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
96 giocata[0] = carteInMano[0];
97 carteInMano[0] = null;
98 pannello.repaint();
99 return true;
100 }
101 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
102 giocata[0] = carteInMano[1];
103 carteInMano[1] = null;
104 pannello.repaint();
105 return true;
106 }
107 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
108 giocata[0] = carteInMano[2];
109 carteInMano[2] = null;
110 pannello.repaint();
111 return true;
112 }
113 }
114 return false;
115 }
116}
117
118
diff --git a/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Main.java b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Main.java
new file mode 100755
index 0000000..22f6e47
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Main.java
@@ -0,0 +1,211 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23
24public class Main {
25 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare;
26 public static boolean toccaAllaCPU = false;
27 public static boolean CPUHaGiocato = false;
28 public static boolean haGiocatoPrima = true;
29 public static Frame frame;
30 public static void main( String args[] ) {
31 frame = new Frame();
32 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
33 frame.setVisible( true );
34 frame.setResizable( false );
35 frame.setSize( 600, 550 );
36 }
37 public void mischia() {
38 mano = 0;
39 cartaDaPescare = 6;
40 ImageIcon aux;
41 for ( int i = 0, k = 0; i < 10; i++ )
42 for ( int j = 0; j < 4; j++, k++ )
43 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
44 for ( int i = 0; i < 391; i++ ) {
45 double a = Math.random() * 40;
46 int x = (int) a;
47 double b = Math.random() * 40;
48 int y = (int) b;
49 aux = frame.arrayCarteMescolate[x];
50 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
51 frame.arrayCarteMescolate[y] = aux;
52 }
53 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
54 semeBriscola = auxChar[auxChar.length-5] - 49;
55 }
56 public void giocaCPU() {
57 int cartaDaGiocare;
58 /*******************************************/
59 if ( frame.carteCPU[0] != null )
60 cartaDaGiocare = 0;
61 else if ( frame.carteCPU[1] != null )
62 cartaDaGiocare = 1;
63 else
64 cartaDaGiocare = 2;
65 /*******************************************/
66 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
67 frame.carteCPU[cartaDaGiocare] = null;
68 frame.pannello.repaint();
69 CPUHaGiocato = true;
70 if ( frame.giocata[0] == null )
71 toccaAllaCPU = false;
72 }
73 public void chiPrende() {
74 char aux[], auxCPU[];
75 aux = frame.giocata[0].toString().toCharArray();
76 auxCPU = frame.giocata[1].toString().toCharArray();
77 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
78 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
79 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
80 }
81 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
82 int a, b;
83 switch ( prima ) {
84 case 0:
85 a = 10;
86 break;
87 case 1:
88 a = 12;
89 break;
90 case 3:
91 a = 11;
92 break;
93 default:
94 a = prima;
95 break;
96 }
97 switch ( seconda ) {
98 case 0:
99 b = 10;
100 break;
101 case 1:
102 b = 12;
103 break;
104 case 3:
105 b = 11;
106 break;
107 default:
108 b = seconda;
109 break;
110 }
111 return a > b;
112 }
113 public void giocatorePrende( boolean giocatore ) {
114 if ( giocatore ) {
115 toccaAllaCPU = CPUHaGiocato = false;
116 haGiocatoPrima = true;
117 }
118 else {
119 toccaAllaCPU = true;
120 CPUHaGiocato = haGiocatoPrima = false;
121 }
122 daiPunti( giocatore );
123 if ( toccaAllaCPU )
124 giocaCPU();
125 }
126 public void daiPunti( boolean giocatore ) {
127 char aux[], auxCPU[];
128 aux = frame.giocata[0].toString().toCharArray();
129 auxCPU = frame.giocata[1].toString().toCharArray();
130 int punti = 0;
131 switch( aux[aux.length-7] - 48 ) {
132 case 0:
133 punti += 4;
134 break;
135 case 1:
136 punti += 11;
137 break;
138 case 3:
139 punti += 10;
140 break;
141 case 8:
142 punti += 2;
143 break;
144 case 9:
145 punti += 3;
146 break;
147 default:
148 break;
149 }
150 switch( auxCPU[auxCPU.length-7] - 48 ) {
151 case 0:
152 punti += 4;
153 break;
154 case 1:
155 punti += 11;
156 break;
157 case 3:
158 punti += 10;
159 break;
160 case 8:
161 punti += 2;
162 break;
163 case 9:
164 punti += 3;
165 break;
166 default:
167 break;
168 }
169 frame.giocata[0] = frame.giocata[1] = null;
170 if ( giocatore ) {
171 punteggio += punti;
172 if ( mano < 18 ) {
173 if ( frame.carteInMano[0] == null )
174 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
175 if ( frame.carteInMano[1] == null )
176 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
177 if ( frame.carteInMano[2] == null )
178 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
179 cartaDaPescare++;
180 if ( frame.carteCPU[0] == null )
181 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
182 if ( frame.carteCPU[1] == null )
183 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
184 if ( frame.carteCPU[2] == null )
185 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
186 cartaDaPescare++;
187 }
188 }
189 else {
190 punteggioCPU += punti;
191 if ( mano < 18 ) {
192 if ( frame.carteCPU[0] == null )
193 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
194 if ( frame.carteCPU[1] == null )
195 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
196 if ( frame.carteCPU[2] == null )
197 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
198 cartaDaPescare++;
199 if ( frame.carteInMano[0] == null )
200 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
201 if ( frame.carteInMano[1] == null )
202 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
203 if ( frame.carteInMano[2] == null )
204 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
205 cartaDaPescare++;
206 }
207 }
208 frame.pannello.repaint();
209 frame.repaint();
210 }
211}
diff --git a/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Pannello.java b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Pannello.java
new file mode 100755
index 0000000..9e73356
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Alpha 1/src/Pannello.java
@@ -0,0 +1,53 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.Graphics;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public Pannello() {
28 }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 if ( main.frame.ultimaCarta != null )
32 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
33 if ( main.frame.mazzo )
34 main.frame.retro2.paintIcon( this, g, 17, 256 );
35 if ( main.frame.carteCPU[0] != null )
36 main.frame.retro1.paintIcon( this, g, 230, 5 );
37 if ( main.frame.carteCPU[1] != null )
38 main.frame.retro1.paintIcon( this, g, 300, 5 );
39 if ( main.frame.carteCPU[2] != null )
40 main.frame.retro1.paintIcon( this, g, 370, 5 );
41 if ( main.frame.carteInMano[0] != null )
42 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
43 if ( main.frame.carteInMano[1] != null )
44 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
45 if ( main.frame.carteInMano[2] != null )
46 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
47 if ( main.frame.giocata[0] != null )
48 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
49 if ( main.frame.giocata[1] != null )
50 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
51 }
52}
53
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 1/src/Frame.java b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Frame.java
new file mode 100755
index 0000000..452cfe2
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Frame.java
@@ -0,0 +1,159 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24import java.awt.event.*;
25
26public class Frame extends JFrame {
27 public static boolean mazzo;
28 public static Main main;
29 public static Pannello pannello;
30 public static JButton button;
31 public static JMenuBar barraMenu;
32 public static JMenu file;
33 public static JMenuItem nuovaPartita, esci;
34 public static ImageIcon retro1, retro2, ultimaCarta;
35 public static ImageIcon[] giocata = new ImageIcon[2];
36 public static ImageIcon[] carteInMano = new ImageIcon[3];
37 public static ImageIcon[] carteCPU = new ImageIcon[3];
38 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
39 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
40 public Frame() {
41 super( "Tronto's JBriscola 0.1" );
42 mazzo = true;
43 main = new Main();
44 pannello = new Pannello();
45 button = new JButton( "Prendi/Lascia carte" );
46 button.addActionListener( new ActionListener() {
47 public void actionPerformed( ActionEvent e ) {
48 if ( giocata[0] != null && giocata[1] != null )
49 main.mano++;
50 try {
51 main.chiPrende();
52 } catch ( Exception ex ) {
53 JOptionPane.showMessageDialog( Frame.this, "Prima gioca!" );
54 }
55 if ( main.mano == 16 )
56 JOptionPane.showMessageDialog( Frame.this, "Ultime 4 mani - occhio alla briscola!" );
57 if ( main.mano == 17 ) {
58 mazzo = false;
59 ultimaCarta = null;
60 pannello.repaint();
61 Frame.this.repaint();
62 }
63 if ( main.mano == 20 ) {
64 String titolo = "Hai vinto!";
65 if ( main.punteggio < main.punteggioCPU )
66 titolo = "Hai perso";
67 if ( main.punteggio == main.punteggioCPU )
68 titolo = "Pareggio!";
69 JOptionPane.showMessageDialog( Frame.this, "Giocatore: " + main.punteggio + "\nComputer: " + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
70 }
71 }
72 } );
73 barraMenu = new JMenuBar();
74 file = new JMenu( "File" );
75 nuovaPartita = new JMenuItem( "Nuova Partita" );
76 nuovaPartita.addActionListener( new ActionListener() {
77 public void actionPerformed( ActionEvent e ) {
78 if ( main.mano == 20 ) {
79 main.mischia();
80 pannello.repaint();
81 repaint();
82 }
83 else {
84 int selezione = JOptionPane.showOptionDialog( Frame.this, "Vuoi davvero iniziare una nuova partita?", "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
85 if ( selezione == JOptionPane.YES_OPTION ) {
86 main.mischia();
87 pannello.repaint();
88 repaint();
89 }
90 }
91 }
92 });
93 esci = new JMenuItem( "Esci" );
94 esci.addActionListener( new ActionListener() {
95 public void actionPerformed( ActionEvent e ) {
96 int selezione = JOptionPane.showOptionDialog( Frame.this, "Vuoi davvero uscire?", "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
97 if ( selezione == JOptionPane.YES_OPTION )
98 Frame.this.dispose();
99 }
100 });
101 file.add( nuovaPartita );
102 file.add( esci );
103 barraMenu.add( file );
104 setJMenuBar( barraMenu );
105 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
106 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
107 for (int i = 0; i < 10; i++)
108 for (int j = 0; j < 4; j++)
109 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
110 main.mischia();
111 setLayout( new BorderLayout() );
112 add( pannello, BorderLayout.CENTER );
113 add( button, BorderLayout.SOUTH );
114 addMouseListener(
115 new MouseAdapter() {
116 public void mouseClicked ( MouseEvent e ) {
117 if ( mettiCarta( e.getX(), e.getY() ) ) {
118 if ( !main.CPUHaGiocato )
119 main.giocaCPU();
120 }
121 }
122 }
123 );
124 addWindowListener(
125 new WindowAdapter() {
126 public void windowClosing( WindowEvent e ) {
127 int selezione = JOptionPane.showOptionDialog( Frame.this, "Vuoi davvero uscire?", "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
128 if ( selezione == JOptionPane.YES_OPTION )
129 System.exit( 0 );
130 }
131 }
132 );
133 }
134 public boolean mettiCarta( int x, int y ) {
135 if ( !main.toccaAllaCPU && giocata[0] == null ) {
136 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
137 giocata[0] = carteInMano[0];
138 carteInMano[0] = null;
139 pannello.repaint();
140 return true;
141 }
142 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
143 giocata[0] = carteInMano[1];
144 carteInMano[1] = null;
145 pannello.repaint();
146 return true;
147 }
148 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
149 giocata[0] = carteInMano[2];
150 carteInMano[2] = null;
151 pannello.repaint();
152 return true;
153 }
154 }
155 return false;
156 }
157}
158
159
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 1/src/Main.java b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Main.java
new file mode 100755
index 0000000..f844dd8
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Main.java
@@ -0,0 +1,399 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23
24public class Main {
25 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
26 public static boolean toccaAllaCPU = false;
27 public static boolean CPUHaGiocato = false;
28 public static boolean haGiocatoPrima = true;
29 public static Frame frame;
30 public static void main( String args[] ) {
31 frame = new Frame();
32 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
33 frame.setVisible( true );
34 frame.setResizable( false );
35 frame.setSize( 600, 600 );
36 }
37 public void mischia() {
38 mano = 0;
39 punteggio = 0;
40 punteggioCPU = 0;
41 cartaDaPescare = 6;
42 ImageIcon aux;
43 frame.mazzo = true;
44 toccaAllaCPU = false;
45 CPUHaGiocato = false;
46 haGiocatoPrima = true;
47 for ( int i = 0, k = 0; i < 10; i++ )
48 for ( int j = 0; j < 4; j++, k++ )
49 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
50 for ( int i = 0; i < 391; i++ ) {
51 double a = Math.random() * 40;
52 int x = (int) a;
53 double b = Math.random() * 40;
54 int y = (int) b;
55 aux = frame.arrayCarteMescolate[x];
56 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
57 frame.arrayCarteMescolate[y] = aux;
58 }
59 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
60 semeBriscola = auxChar[auxChar.length-5] - 49;
61 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
62 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
63 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
64 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
65 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
66 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
67 frame.ultimaCarta = frame.arrayCarteMescolate[39];
68 frame.giocata[0] = null;
69 frame.giocata[1] = null;
70 }
71 public void giocaCPU() {
72 if ( frame.giocata[0] == null ) {
73 if ( vaiLiscio() );
74 else if ( vaiPunti() );
75 else if ( vaiBriscola() );
76 else if ( vaiCarico() );
77 else;
78 }
79 else {
80 if ( haLisciato() || haMessoPunti() ) {
81 if ( vaiSopra() );
82 else if ( vaiLiscio() );
83 else if ( vaiPunti() );
84 else if ( vaiBriscola() );
85 else if ( vaiCarico() );
86 else System.out.println("Ha lisciato e non so cosa fare");
87 } else if ( haMessoBriscola() ) {
88 if ( vaiLiscio() );
89 else if ( vaiPunti() );
90 else if ( vaiBriscola() );
91 else if ( vaiCarico() );
92 else System.out.println("Ha messo una briscola e non so cosa fare");
93 } else if ( haCaricato() ) {
94 if ( vaiSopra() );
95 else if ( vaiBriscola() );
96 else if ( vaiLiscio() );
97 else if ( vaiPunti() );
98 else if ( vaiCarico() );
99 else System.out.println("Ha caricato e non so cosa fare");
100 } else System.out.println("Non so cosa ha fatto");
101 }
102 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
103 frame.carteCPU[cartaDaGiocare] = null;
104 frame.pannello.repaint();
105 CPUHaGiocato = true;
106 if ( frame.giocata[0] == null )
107 toccaAllaCPU = false;
108 }
109 public void chiPrende() {
110 char aux[], auxCPU[];
111 aux = frame.giocata[0].toString().toCharArray();
112 auxCPU = frame.giocata[1].toString().toCharArray();
113 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
114 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
115 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
116 }
117 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
118 int a, b;
119 switch ( prima ) {
120 case 0:
121 a = 10;
122 break;
123 case 1:
124 a = 12;
125 break;
126 case 3:
127 a = 11;
128 break;
129 default:
130 a = prima;
131 break;
132 }
133 switch ( seconda ) {
134 case 0:
135 b = 10;
136 break;
137 case 1:
138 b = 12;
139 break;
140 case 3:
141 b = 11;
142 break;
143 default:
144 b = seconda;
145 break;
146 }
147 return a > b;
148 }
149 public void giocatorePrende( boolean giocatore ) {
150 if ( giocatore ) {
151 toccaAllaCPU = CPUHaGiocato = false;
152 haGiocatoPrima = true;
153 }
154 else {
155 toccaAllaCPU = true;
156 CPUHaGiocato = haGiocatoPrima = false;
157 }
158 daiPunti( giocatore );
159 if ( toccaAllaCPU )
160 giocaCPU();
161 }
162 public void daiPunti( boolean giocatore ) {
163 char aux[], auxCPU[];
164 aux = frame.giocata[0].toString().toCharArray();
165 auxCPU = frame.giocata[1].toString().toCharArray();
166 int punti = 0;
167 switch( aux[aux.length-7] - 48 ) {
168 case 0:
169 punti += 4;
170 break;
171 case 1:
172 punti += 11;
173 break;
174 case 3:
175 punti += 10;
176 break;
177 case 8:
178 punti += 2;
179 break;
180 case 9:
181 punti += 3;
182 break;
183 default:
184 break;
185 }
186 switch( auxCPU[auxCPU.length-7] - 48 ) {
187 case 0:
188 punti += 4;
189 break;
190 case 1:
191 punti += 11;
192 break;
193 case 3:
194 punti += 10;
195 break;
196 case 8:
197 punti += 2;
198 break;
199 case 9:
200 punti += 3;
201 break;
202 default:
203 break;
204 }
205 frame.giocata[0] = frame.giocata[1] = null;
206 if ( giocatore ) {
207 punteggio += punti;
208 if ( mano < 18 ) {
209 if ( frame.carteInMano[0] == null )
210 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
211 if ( frame.carteInMano[1] == null )
212 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
213 if ( frame.carteInMano[2] == null )
214 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
215 cartaDaPescare++;
216 if ( frame.carteCPU[0] == null )
217 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
218 if ( frame.carteCPU[1] == null )
219 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
220 if ( frame.carteCPU[2] == null )
221 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
222 cartaDaPescare++;
223 }
224 }
225 else {
226 punteggioCPU += punti;
227 if ( mano < 18 ) {
228 if ( frame.carteCPU[0] == null )
229 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
230 if ( frame.carteCPU[1] == null )
231 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
232 if ( frame.carteCPU[2] == null )
233 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
234 cartaDaPescare++;
235 if ( frame.carteInMano[0] == null )
236 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
237 if ( frame.carteInMano[1] == null )
238 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
239 if ( frame.carteInMano[2] == null )
240 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
241 cartaDaPescare++;
242 }
243 }
244 frame.pannello.repaint();
245 frame.repaint();
246 }
247 public boolean haLisciato() {
248 char auxCPU[];
249 auxCPU = frame.giocata[0].toString().toCharArray();
250 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
251 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
252 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
253 }
254 public boolean haMessoPunti() {
255 char auxCPU[];
256 auxCPU = frame.giocata[0].toString().toCharArray();
257 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
258 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
259 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
260 }
261 public boolean haMessoBriscola() {
262 char auxCPU[];
263 auxCPU = frame.giocata[0].toString().toCharArray();
264 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) );
265 }
266 public boolean haCaricato() {
267 char auxCPU[];
268 auxCPU = frame.giocata[0].toString().toCharArray();
269 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
270 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
271 }
272 public boolean vaiLiscio() {
273 char auxCPU[];
274 for ( int i = 0; i < 3; i++ ) {
275 if ( frame.carteCPU[i] != null ) {
276 auxCPU = frame.carteCPU[i].toString().toCharArray();
277 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
278 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
279 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
280 cartaDaGiocare = i;
281 return true;
282 }
283 }
284 }
285 return false;
286 }
287 public boolean vaiPunti() {
288 char auxCPU[];
289 for ( int i = 0; i < 3; i++ ) {
290 if ( frame.carteCPU[i] != null ) {
291 auxCPU = frame.carteCPU[i].toString().toCharArray();
292 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
293 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
294 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
295 cartaDaGiocare = i;
296 return true;
297 }
298 }
299 }
300 return false;
301 }
302 public boolean vaiBriscola() {
303 char auxCPU[];
304 for ( int i = 0; i < 3; i++ ) {
305 if ( frame.carteCPU[i] != null ) {
306 auxCPU = frame.carteCPU[i].toString().toCharArray();
307 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola ) {
308 cartaDaGiocare = i;
309 return true;
310 }
311 }
312 }
313 return false;
314 }
315 public boolean vaiCarico() {
316 char auxCPU[];
317 for ( int i = 0; i < 3; i++ ) {
318 if ( frame.carteCPU[i] != null ) {
319 auxCPU = frame.carteCPU[i].toString().toCharArray();
320 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
321 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
322 cartaDaGiocare = i;
323 return true;
324 }
325 }
326 }
327 return false;
328 }
329 public boolean vaiSopra() {
330 if ( frame.giocata[0] == null )
331 return false;
332 int a = -1;
333 int b = -1;
334 int c = -1;
335 boolean laPrimaPuoAndareSopra = false;
336 boolean laSecondaPuoAndareSopra = false;
337 boolean laTerzaPuoAndareSopra = false;
338 char[] auxCPU1 = new char[1024];
339 char[] auxCPU2 = new char[1024];
340 char[] auxCPU3 = new char[1024];
341 char[] aux = frame.giocata[0].toString().toCharArray();
342 if ( aux[aux.length-7] - 48 == 1 )
343 return false;
344 if ( frame.carteCPU[0] != null ) {
345 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
346 a = auxCPU1[auxCPU1.length-7] - 48;
347 }
348 if ( frame.carteCPU[1] != null ) {
349 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
350 b = auxCPU2[auxCPU2.length-7] - 48;
351 }
352 if ( frame.carteCPU[2] != null ) {
353 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
354 c = auxCPU3[auxCPU3.length-7] - 48;
355 }
356 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
357 laPrimaPuoAndareSopra = true;
358 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
359 laSecondaPuoAndareSopra = true;
360 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
361 laTerzaPuoAndareSopra = true;
362 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
363 return false;
364 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
365 cartaDaGiocare = 0;
366 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
367 cartaDaGiocare = 1;
368 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
369 cartaDaGiocare = 2;
370 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
371 if ( laPrimaEPiuAlta( a, b ) )
372 cartaDaGiocare = 0;
373 else
374 cartaDaGiocare = 1;
375 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
376 if ( laPrimaEPiuAlta( b, c ) )
377 cartaDaGiocare = 1;
378 else
379 cartaDaGiocare = 2;
380 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
381 if ( laPrimaEPiuAlta( a, c ) )
382 cartaDaGiocare = 0;
383 else
384 cartaDaGiocare = 2;
385 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
386 if ( laPrimaEPiuAlta( a, b ) )
387 if ( laPrimaEPiuAlta( a, c ) )
388 cartaDaGiocare = 0;
389 else
390 cartaDaGiocare = 2;
391 else
392 if ( laPrimaEPiuAlta( b, c ) )
393 cartaDaGiocare = 1;
394 else
395 cartaDaGiocare = 2;
396 else cartaDaGiocare = 55;
397 return true;
398 }
399}
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 1/src/Pannello.java b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Pannello.java
new file mode 100755
index 0000000..9e73356
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 1/src/Pannello.java
@@ -0,0 +1,53 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.Graphics;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public Pannello() {
28 }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 if ( main.frame.ultimaCarta != null )
32 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
33 if ( main.frame.mazzo )
34 main.frame.retro2.paintIcon( this, g, 17, 256 );
35 if ( main.frame.carteCPU[0] != null )
36 main.frame.retro1.paintIcon( this, g, 230, 5 );
37 if ( main.frame.carteCPU[1] != null )
38 main.frame.retro1.paintIcon( this, g, 300, 5 );
39 if ( main.frame.carteCPU[2] != null )
40 main.frame.retro1.paintIcon( this, g, 370, 5 );
41 if ( main.frame.carteInMano[0] != null )
42 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
43 if ( main.frame.carteInMano[1] != null )
44 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
45 if ( main.frame.carteInMano[2] != null )
46 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
47 if ( main.frame.giocata[0] != null )
48 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
49 if ( main.frame.giocata[1] != null )
50 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
51 }
52}
53
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 2/src/Frame.java b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Frame.java
new file mode 100755
index 0000000..36ff831
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Frame.java
@@ -0,0 +1,174 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24import java.awt.event.*;
25
26public class Frame extends JFrame {
27 public static boolean mazzo;
28 public static Main main;
29 public static Pannello pannello;
30 public static JButton button;
31 public static JMenuBar barraMenu;
32 public static JMenu file;
33 public static JMenuItem nuovaPartita, opzioni, esci;
34 public static ImageIcon retro1, retro2, ultimaCarta;
35 public static ImageIcon[] giocata = new ImageIcon[2];
36 public static ImageIcon[] carteInMano = new ImageIcon[3];
37 public static ImageIcon[] carteCPU = new ImageIcon[3];
38 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
39 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
40 public Frame() {
41 super( "Tronto's JBriscola 0.1 Beta 2" );
42 mazzo = true;
43 main = new Main();
44 pannello = new Pannello();
45 button = new JButton( main.stringaBottonePrendi );
46 button.addActionListener( new ActionListener() {
47 public void actionPerformed( ActionEvent e ) {
48 if ( giocata[0] != null && giocata[1] != null )
49 main.mano++;
50 try {
51 main.chiPrende();
52 } catch ( Exception ex ) {
53 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola 0.1", JOptionPane.WARNING_MESSAGE );
54 }
55 if ( main.mano == 16 )
56 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
57 if ( main.mano == 17 ) {
58 mazzo = false;
59 ultimaCarta = null;
60 pannello.repaint();
61 Frame.this.repaint();
62 }
63 if ( main.mano == 20 ) {
64 String titolo = main.stringaVinto;
65 if ( main.punteggio < main.punteggioCPU )
66 titolo = main.stringaPerso;
67 if ( main.punteggio == main.punteggioCPU )
68 titolo = main.stringaPareggio;
69 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
70 }
71 }
72 } );
73 barraMenu = new JMenuBar();
74 file = new JMenu( "File" );
75 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
76 nuovaPartita.addActionListener( new ActionListener() {
77 public void actionPerformed( ActionEvent e ) {
78 if ( main.mano == 20 ) {
79 main.mischia();
80 pannello.repaint();
81 repaint();
82 }
83 else {
84 int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroIniziare, "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo );
85 if ( selezione == JOptionPane.YES_OPTION ) {
86 main.mischia();
87 pannello.repaint();
88 repaint();
89 }
90 }
91 }
92 });
93 opzioni = new JMenuItem( main.stringaOpzioni );
94 opzioni.addActionListener( new ActionListener() {
95 public void actionPerformed( ActionEvent e ) {
96 OptionFrame optionFrame = new OptionFrame();
97 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
98 optionFrame.setResizable( false );
99 optionFrame.setAlwaysOnTop( true );
100 optionFrame.setSize( 300, 150 );
101 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
102 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
103 optionFrame.setVisible( true );
104 }
105 });
106 esci = new JMenuItem( main.stringaEsci );
107 esci.addActionListener( new ActionListener() {
108 public void actionPerformed( ActionEvent e ) {
109 int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroUscire, "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo );
110 if ( selezione == JOptionPane.YES_OPTION )
111 Frame.this.dispose();
112 }
113 });
114 file.add( nuovaPartita );
115 file.add( opzioni );
116 file.addSeparator();
117 file.add( esci );
118 barraMenu.add( file );
119 setJMenuBar( barraMenu );
120 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
121 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
122 for (int i = 0; i < 10; i++)
123 for (int j = 0; j < 4; j++)
124 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
125 main.mischia();
126 setLayout( new BorderLayout() );
127 add( pannello, BorderLayout.CENTER );
128 add( button, BorderLayout.SOUTH );
129 addMouseListener(
130 new MouseAdapter() {
131 public void mouseClicked ( MouseEvent e ) {
132 if ( mettiCarta( e.getX(), e.getY() ) ) {
133 if ( !main.CPUHaGiocato )
134 main.giocaCPU();
135 }
136 }
137 }
138 );
139 addWindowListener(
140 new WindowAdapter() {
141 public void windowClosing( WindowEvent e ) {
142 int selezione = JOptionPane.showOptionDialog( Frame.this, main.stringaVuoiDavveroUscire, "JBriscola 0.1", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { main.stringaSi, main.stringaNo }, main.stringaNo );
143 if ( selezione == JOptionPane.YES_OPTION )
144 System.exit( 0 );
145 }
146 }
147 );
148 }
149 public boolean mettiCarta( int x, int y ) {
150 if ( !main.toccaAllaCPU && giocata[0] == null ) {
151 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
152 giocata[0] = carteInMano[0];
153 carteInMano[0] = null;
154 pannello.repaint();
155 return true;
156 }
157 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
158 giocata[0] = carteInMano[1];
159 carteInMano[1] = null;
160 pannello.repaint();
161 return true;
162 }
163 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
164 giocata[0] = carteInMano[2];
165 carteInMano[2] = null;
166 pannello.repaint();
167 return true;
168 }
169 }
170 return false;
171 }
172}
173
174
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 2/src/Main.java b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Main.java
new file mode 100755
index 0000000..2a3191b
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Main.java
@@ -0,0 +1,492 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static Frame frame;
33 public static String stringaBottonePrendi = "Prendi/Lascia carte";
34 public static String stringaPrimaGioca = "Prima Gioca!";
35 public static String stringaUltime4 = "Ultime 4 mani - Occhio alla briscola!";
36 public static String stringaVinto = "Hai Vinto!";
37 public static String stringaPerso = "Hai Perso";
38 public static String stringaPareggio = "Pareggio";
39 public static String stringaGiocatore = "Giocatore";
40 public static String stringaComputer = "\nComputer";
41 public static String stringaNuovaPartita = "Nuova Partita";
42 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
43 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
44 public static String stringaSi = "Si";
45 public static String stringaNo = "No";
46 public static String stringaOpzioni = "Opzioni...";
47 public static String stringaEsci = "Esci";
48 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
49 public static String stringaLingua = "Lingua";
50 public static String stringaAnnulla = "Annulla";
51 public static String stringaIt = "Italiano";
52 public static String stringaLa = "Latino";
53 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
54 public static String stringaModificaOpzioni = "Modifica Opzioni";
55 public static void main( String args[] ) {
56 settaOpzioni();
57 frame = new Frame();
58 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
59 frame.setResizable( false );
60 frame.setSize( 600, 600 );
61 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
62 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
63
64 frame.setVisible( true );
65 }
66 public void mischia() {
67 mano = 0;
68 punteggio = 0;
69 punteggioCPU = 0;
70 cartaDaPescare = 6;
71 ImageIcon aux;
72 frame.mazzo = true;
73 toccaAllaCPU = false;
74 CPUHaGiocato = false;
75 haGiocatoPrima = true;
76 for ( int i = 0, k = 0; i < 10; i++ )
77 for ( int j = 0; j < 4; j++, k++ )
78 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
79 for ( int i = 0; i < 391; i++ ) {
80 double a = Math.random() * 40;
81 int x = (int) a;
82 double b = Math.random() * 40;
83 int y = (int) b;
84 aux = frame.arrayCarteMescolate[x];
85 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
86 frame.arrayCarteMescolate[y] = aux;
87 }
88 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
89 semeBriscola = auxChar[auxChar.length-5] - 49;
90 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
91 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
92 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
93 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
94 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
95 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
96 frame.ultimaCarta = frame.arrayCarteMescolate[39];
97 frame.giocata[0] = null;
98 frame.giocata[1] = null;
99 }
100 public void giocaCPU() {
101 if ( frame.giocata[0] == null ) {
102 if ( vaiLiscio() );
103 else if ( vaiPunti() );
104 else if ( vaiBriscola() );
105 else if ( vaiCarico() );
106 else;
107 }
108 else {
109 if ( haLisciato() || haMessoPunti() ) {
110 if ( vaiSopra() );
111 else if ( vaiLiscio() );
112 else if ( vaiPunti() );
113 else if ( vaiBriscola() );
114 else if ( vaiCarico() );
115 else System.out.println("Ha lisciato e non so cosa fare");
116 } else if ( haMessoBriscola() ) {
117 if ( vaiLiscio() );
118 else if ( vaiPunti() );
119 else if ( vaiBriscola() );
120 else if ( vaiCarico() );
121 else System.out.println("Ha messo una briscola e non so cosa fare");
122 } else if ( haCaricato() ) {
123 if ( vaiSopra() );
124 else if ( vaiBriscola() );
125 else if ( vaiLiscio() );
126 else if ( vaiPunti() );
127 else if ( vaiCarico() );
128 else System.out.println("Ha caricato e non so cosa fare");
129 } else System.out.println("Non so cosa ha fatto");
130 }
131 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
132 frame.carteCPU[cartaDaGiocare] = null;
133 frame.pannello.repaint();
134 CPUHaGiocato = true;
135 if ( frame.giocata[0] == null )
136 toccaAllaCPU = false;
137 }
138 public void chiPrende() {
139 char aux[], auxCPU[];
140 aux = frame.giocata[0].toString().toCharArray();
141 auxCPU = frame.giocata[1].toString().toCharArray();
142 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
143 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
144 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
145 }
146 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
147 int a, b;
148 switch ( prima ) {
149 case 0:
150 a = 10;
151 break;
152 case 1:
153 a = 12;
154 break;
155 case 3:
156 a = 11;
157 break;
158 default:
159 a = prima;
160 break;
161 }
162 switch ( seconda ) {
163 case 0:
164 b = 10;
165 break;
166 case 1:
167 b = 12;
168 break;
169 case 3:
170 b = 11;
171 break;
172 default:
173 b = seconda;
174 break;
175 }
176 return a > b;
177 }
178 public void giocatorePrende( boolean giocatore ) {
179 if ( giocatore ) {
180 toccaAllaCPU = CPUHaGiocato = false;
181 haGiocatoPrima = true;
182 }
183 else {
184 toccaAllaCPU = true;
185 CPUHaGiocato = haGiocatoPrima = false;
186 }
187 daiPunti( giocatore );
188 if ( toccaAllaCPU )
189 giocaCPU();
190 }
191 public void daiPunti( boolean giocatore ) {
192 char aux[], auxCPU[];
193 aux = frame.giocata[0].toString().toCharArray();
194 auxCPU = frame.giocata[1].toString().toCharArray();
195 int punti = 0;
196 switch( aux[aux.length-7] - 48 ) {
197 case 0:
198 punti += 4;
199 break;
200 case 1:
201 punti += 11;
202 break;
203 case 3:
204 punti += 10;
205 break;
206 case 8:
207 punti += 2;
208 break;
209 case 9:
210 punti += 3;
211 break;
212 default:
213 break;
214 }
215 switch( auxCPU[auxCPU.length-7] - 48 ) {
216 case 0:
217 punti += 4;
218 break;
219 case 1:
220 punti += 11;
221 break;
222 case 3:
223 punti += 10;
224 break;
225 case 8:
226 punti += 2;
227 break;
228 case 9:
229 punti += 3;
230 break;
231 default:
232 break;
233 }
234 frame.giocata[0] = frame.giocata[1] = null;
235 if ( giocatore ) {
236 punteggio += punti;
237 if ( mano < 18 ) {
238 if ( frame.carteInMano[0] == null )
239 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
240 if ( frame.carteInMano[1] == null )
241 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
242 if ( frame.carteInMano[2] == null )
243 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
244 cartaDaPescare++;
245 if ( frame.carteCPU[0] == null )
246 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
247 if ( frame.carteCPU[1] == null )
248 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
249 if ( frame.carteCPU[2] == null )
250 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
251 cartaDaPescare++;
252 }
253 }
254 else {
255 punteggioCPU += punti;
256 if ( mano < 18 ) {
257 if ( frame.carteCPU[0] == null )
258 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
259 if ( frame.carteCPU[1] == null )
260 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
261 if ( frame.carteCPU[2] == null )
262 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
263 cartaDaPescare++;
264 if ( frame.carteInMano[0] == null )
265 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
266 if ( frame.carteInMano[1] == null )
267 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
268 if ( frame.carteInMano[2] == null )
269 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
270 cartaDaPescare++;
271 }
272 }
273 frame.pannello.repaint();
274 frame.repaint();
275 }
276 public boolean haLisciato() {
277 char auxCPU[];
278 auxCPU = frame.giocata[0].toString().toCharArray();
279 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
280 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
281 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
282 }
283 public boolean haMessoPunti() {
284 char auxCPU[];
285 auxCPU = frame.giocata[0].toString().toCharArray();
286 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
287 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
288 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
289 }
290 public boolean haMessoBriscola() {
291 char auxCPU[];
292 auxCPU = frame.giocata[0].toString().toCharArray();
293 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) );
294 }
295 public boolean haCaricato() {
296 char auxCPU[];
297 auxCPU = frame.giocata[0].toString().toCharArray();
298 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
299 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
300 }
301 public boolean vaiLiscio() {
302 char auxCPU[];
303 for ( int i = 0; i < 3; i++ ) {
304 if ( frame.carteCPU[i] != null ) {
305 auxCPU = frame.carteCPU[i].toString().toCharArray();
306 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
307 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
308 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
309 cartaDaGiocare = i;
310 return true;
311 }
312 }
313 }
314 return false;
315 }
316 public boolean vaiPunti() {
317 char auxCPU[];
318 for ( int i = 0; i < 3; i++ ) {
319 if ( frame.carteCPU[i] != null ) {
320 auxCPU = frame.carteCPU[i].toString().toCharArray();
321 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
322 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
323 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
324 cartaDaGiocare = i;
325 return true;
326 }
327 }
328 }
329 return false;
330 }
331 public boolean vaiBriscola() {
332 char auxCPU[];
333 for ( int i = 0; i < 3; i++ ) {
334 if ( frame.carteCPU[i] != null ) {
335 auxCPU = frame.carteCPU[i].toString().toCharArray();
336 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola ) {
337 cartaDaGiocare = i;
338 return true;
339 }
340 }
341 }
342 return false;
343 }
344 public boolean vaiCarico() {
345 char auxCPU[];
346 for ( int i = 0; i < 3; i++ ) {
347 if ( frame.carteCPU[i] != null ) {
348 auxCPU = frame.carteCPU[i].toString().toCharArray();
349 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
350 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
351 cartaDaGiocare = i;
352 return true;
353 }
354 }
355 }
356 return false;
357 }
358 public boolean vaiSopra() {
359 if ( frame.giocata[0] == null )
360 return false;
361 int a = -1;
362 int b = -1;
363 int c = -1;
364 boolean laPrimaPuoAndareSopra = false;
365 boolean laSecondaPuoAndareSopra = false;
366 boolean laTerzaPuoAndareSopra = false;
367 char[] auxCPU1 = new char[1024];
368 char[] auxCPU2 = new char[1024];
369 char[] auxCPU3 = new char[1024];
370 char[] aux = frame.giocata[0].toString().toCharArray();
371 if ( aux[aux.length-7] - 48 == 1 )
372 return false;
373 if ( frame.carteCPU[0] != null ) {
374 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
375 a = auxCPU1[auxCPU1.length-7] - 48;
376 }
377 if ( frame.carteCPU[1] != null ) {
378 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
379 b = auxCPU2[auxCPU2.length-7] - 48;
380 }
381 if ( frame.carteCPU[2] != null ) {
382 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
383 c = auxCPU3[auxCPU3.length-7] - 48;
384 }
385 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
386 laPrimaPuoAndareSopra = true;
387 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
388 laSecondaPuoAndareSopra = true;
389 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
390 laTerzaPuoAndareSopra = true;
391 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
392 return false;
393 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
394 cartaDaGiocare = 0;
395 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
396 cartaDaGiocare = 1;
397 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
398 cartaDaGiocare = 2;
399 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
400 if ( laPrimaEPiuAlta( a, b ) )
401 cartaDaGiocare = 0;
402 else
403 cartaDaGiocare = 1;
404 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
405 if ( laPrimaEPiuAlta( b, c ) )
406 cartaDaGiocare = 1;
407 else
408 cartaDaGiocare = 2;
409 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
410 if ( laPrimaEPiuAlta( a, c ) )
411 cartaDaGiocare = 0;
412 else
413 cartaDaGiocare = 2;
414 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
415 if ( laPrimaEPiuAlta( a, b ) )
416 if ( laPrimaEPiuAlta( a, c ) )
417 cartaDaGiocare = 0;
418 else
419 cartaDaGiocare = 2;
420 else
421 if ( laPrimaEPiuAlta( b, c ) )
422 cartaDaGiocare = 1;
423 else
424 cartaDaGiocare = 2;
425 else cartaDaGiocare = 55;
426 return true;
427 }
428 public static void settaOpzioni() {
429 String lang;
430 Scanner scanner = null;
431 File file = new File( "JBriscolaConfig.txt" );
432 if ( file.exists() ) {
433 try {
434 scanner = new Scanner( file );
435 } catch ( FileNotFoundException e ) {
436 lang = "it";
437 }
438 lang = scanner.next();
439 }
440 else {
441 lang = "it";
442 }
443 if ( lang.equals( "it" ) ) {
444 stringaBottonePrendi = "Prendi/Lascia carte";
445 stringaPrimaGioca = "Prima Gioca!";
446 stringaUltime4 = "Ultime 4 mani - Occhio alla briscola!";
447 stringaVinto = "Hai Vinto!";
448 stringaPerso = "Hai Perso";
449 stringaPareggio = "Pareggio";
450 stringaGiocatore = "Giocatore";
451 stringaComputer = "\nComputer";
452 stringaNuovaPartita = "Nuova Partita";
453 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
454 stringaVuoiDavveroUscire = "Vuoi davvero dscire?";
455 stringaSi = "Si";
456 stringaNo = "No";
457 stringaOpzioni = "Opzioni...";
458 stringaEsci = "Esci";
459 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
460 stringaLingua = "Lingua";
461 stringaAnnulla = "Annulla";
462 stringaIt = "Italiano";
463 stringaLa = "Latino";
464 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
465 stringaModificaOpzioni = "Modifica Opzioni";
466 }
467 else if ( lang.equals( "la" ) ) {
468 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
469 stringaPrimaGioca = "ANTE CHARTAM PONE!";
470 stringaUltime4 = "IV MANVS POSTREMAS - INTVERE BRISCOLAM!";
471 stringaVinto = "VINXISTI!";
472 stringaPerso = "PERDIDISTI";
473 stringaPareggio = "AEQVATIO!";
474 stringaGiocatore = "LVSOR: ";
475 stringaComputer = "\nCOMPVTER: ";
476 stringaNuovaPartita = "NOVA LVSO";
477 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
478 stringaVuoiDavveroUscire = "EXIRE?";
479 stringaSi = "ID VOLO";
480 stringaNo = "NOLO";
481 stringaOpzioni = "OPTIONES...";
482 stringaEsci = "EXIRE";
483 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
484 stringaLingua = "LINGVA";
485 stringaAnnulla = "ABROGA";
486 stringaIt = "ITALICE";
487 stringaLa = "LATINE";
488 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SUNT.\nALIQVAE ANTE ID VERSA ERVNT";
489 stringaModificaOpzioni = "OPTIONES NOVARE";
490 }
491 }
492}
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 2/src/OptionFrame.java b/JBriscola/all_versions/0.1/0.1 Beta 2/src/OptionFrame.java
new file mode 100755
index 0000000..de6734b
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 2/src/OptionFrame.java
@@ -0,0 +1,83 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla;
31 public static JLabel lingua;
32 public static JComboBox selezionaLingua;
33 public static JPanel pannello1, pannello2;
34 public OptionFrame() {
35 super( "JBriscola - " + main.stringaModificaOpzioni );
36 ok = new JButton( "OK" );
37 ok.addActionListener( new ActionListener() {
38 public void actionPerformed( ActionEvent e ) {
39 try {
40 formatter = new Formatter( "JBriscolaConfig.txt" );
41 } catch ( Exception ex ) {
42 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
43 }
44 String lang;
45 switch ( selezionaLingua.getSelectedIndex() ) {
46 case 0:
47 lang = "it";
48 break;
49 case 1:
50 lang = "la";
51 break;
52 default:
53 lang = "it";
54 break;
55 }
56 formatter.format( lang );
57 formatter.close();
58 main.settaOpzioni();
59 main.frame.pannello.repaint();
60 main.frame.repaint();
61 OptionFrame.this.dispose();
62 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
63 }
64 });
65 annulla = new JButton( main.stringaAnnulla );
66 annulla.addActionListener( new ActionListener() {
67 public void actionPerformed( ActionEvent e ) {
68 OptionFrame.this.dispose();
69 }
70 });
71 lingua = new JLabel( main.stringaLingua );
72 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa };
73 selezionaLingua = new JComboBox( lingueDaSelezionare );
74 pannello1 = new JPanel( new FlowLayout() );
75 pannello1.add( lingua );
76 pannello1.add( selezionaLingua );
77 pannello2 = new JPanel( new FlowLayout() );
78 pannello2.add( ok );
79 pannello2.add( annulla );
80 add( pannello1, BorderLayout.CENTER );
81 add( pannello2, BorderLayout.SOUTH );
82 }
83}
diff --git a/JBriscola/all_versions/0.1/0.1 Beta 2/src/Pannello.java b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Pannello.java
new file mode 100755
index 0000000..9e73356
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1 Beta 2/src/Pannello.java
@@ -0,0 +1,53 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.Graphics;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public Pannello() {
28 }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 if ( main.frame.ultimaCarta != null )
32 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
33 if ( main.frame.mazzo )
34 main.frame.retro2.paintIcon( this, g, 17, 256 );
35 if ( main.frame.carteCPU[0] != null )
36 main.frame.retro1.paintIcon( this, g, 230, 5 );
37 if ( main.frame.carteCPU[1] != null )
38 main.frame.retro1.paintIcon( this, g, 300, 5 );
39 if ( main.frame.carteCPU[2] != null )
40 main.frame.retro1.paintIcon( this, g, 370, 5 );
41 if ( main.frame.carteInMano[0] != null )
42 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
43 if ( main.frame.carteInMano[1] != null )
44 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
45 if ( main.frame.carteInMano[2] != null )
46 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
47 if ( main.frame.giocata[0] != null )
48 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
49 if ( main.frame.giocata[1] != null )
50 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
51 }
52}
53
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/Frame.java b/JBriscola/all_versions/0.1/0.1.1/src/Frame.java
new file mode 100755
index 0000000..ab85a28
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/Frame.java
@@ -0,0 +1,186 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24import java.awt.event.*;
25
26public class Frame extends JFrame {
27 public static boolean mazzo;
28 public static Main main;
29 public static Pannello pannello;
30 public static JPanel pannello2;
31 public static JButton button;
32 public static JMenuBar barraMenu;
33 public static JMenu file, puntoInterrogativo;
34 public static JMenuItem nuovaPartita, opzioni, esci, informazioni;
35 public static ImageIcon retro1, retro2, ultimaCarta;
36 public static ImageIcon[] giocata = new ImageIcon[2];
37 public static ImageIcon[] carteInMano = new ImageIcon[3];
38 public static ImageIcon[] carteCPU = new ImageIcon[3];
39 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
40 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
41 public Frame() {
42 super( "Tronto's JBriscola " + main.version );
43 mazzo = true;
44 main = new Main();
45 pannello = new Pannello();
46 pannello2 = new JPanel( new FlowLayout() );
47 button = new JButton( main.stringaBottonePrendi );
48 button.addActionListener( new ActionListener() {
49 public void actionPerformed( ActionEvent e ) {
50 if ( giocata[0] != null && giocata[1] != null )
51 main.mano++;
52 try {
53 main.chiPrende();
54 } catch ( Exception ex ) {
55 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
56 }
57 if ( main.mano == 16 )
58 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
59 if ( main.mano == 17 ) {
60 mazzo = false;
61 ultimaCarta = null;
62 pannello.repaint();
63 Frame.this.repaint();
64 }
65 if ( main.mano == 20 ) {
66 String titolo = main.stringaVinto;
67 if ( main.punteggio < main.punteggioCPU )
68 titolo = main.stringaPerso;
69 if ( main.punteggio == main.punteggioCPU )
70 titolo = main.stringaPareggio;
71 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
72 }
73 }
74 } );
75 barraMenu = new JMenuBar();
76 file = new JMenu( "File" );
77 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
78 nuovaPartita.addActionListener( new ActionListener() {
79 public void actionPerformed( ActionEvent e ) {
80 if ( main.mano == 20 ) {
81 main.mischia();
82 pannello.repaint();
83 repaint();
84 }
85 else {
86 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 );
87 if ( selezione == JOptionPane.YES_OPTION ) {
88 main.mischia();
89 pannello.repaint();
90 repaint();
91 }
92 }
93 }
94 });
95 opzioni = new JMenuItem( main.stringaOpzioni );
96 opzioni.addActionListener( new ActionListener() {
97 public void actionPerformed( ActionEvent e ) {
98 OptionFrame optionFrame = new OptionFrame();
99 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
100 optionFrame.setResizable( false );
101 optionFrame.setAlwaysOnTop( true );
102 optionFrame.setSize( 300, 150 );
103 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
104 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
105 optionFrame.setVisible( true );
106 }
107 });
108 esci = new JMenuItem( main.stringaEsci );
109 esci.addActionListener( new ActionListener() {
110 public void actionPerformed( ActionEvent e ) {
111 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 );
112 if ( selezione == JOptionPane.YES_OPTION )
113 Frame.this.dispose();
114 }
115 });
116 file.add( nuovaPartita );
117 file.add( opzioni );
118 file.addSeparator();
119 file.add( esci );
120 puntoInterrogativo = new JMenu( "?" );
121 informazioni = new JMenuItem( main.stringaInformazioni );
122 informazioni.addActionListener( new ActionListener() {
123 public void actionPerformed( ActionEvent e ) {
124 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
125 }
126 } );
127 puntoInterrogativo.add( informazioni );
128 barraMenu.add( file );
129 barraMenu.add( puntoInterrogativo );
130 setJMenuBar( barraMenu );
131 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
132 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
133 for (int i = 0; i < 10; i++)
134 for (int j = 0; j < 4; j++)
135 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
136 main.mischia();
137 pannello2.add( button );
138 setLayout( new BorderLayout() );
139 add( pannello, BorderLayout.CENTER );
140 add( pannello2, BorderLayout.SOUTH );
141 addMouseListener(
142 new MouseAdapter() {
143 public void mouseClicked ( MouseEvent e ) {
144 if ( mettiCarta( e.getX(), e.getY() ) ) {
145 if ( !main.CPUHaGiocato )
146 main.giocaCPU();
147 }
148 }
149 }
150 );
151 addWindowListener(
152 new WindowAdapter() {
153 public void windowClosing( WindowEvent e ) {
154 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 );
155 if ( selezione == JOptionPane.YES_OPTION )
156 System.exit( 0 );
157 }
158 }
159 );
160 }
161 public boolean mettiCarta( int x, int y ) {
162 if ( !main.toccaAllaCPU && giocata[0] == null ) {
163 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
164 giocata[0] = carteInMano[0];
165 carteInMano[0] = null;
166 pannello.repaint();
167 return true;
168 }
169 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
170 giocata[0] = carteInMano[1];
171 carteInMano[1] = null;
172 pannello.repaint();
173 return true;
174 }
175 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
176 giocata[0] = carteInMano[2];
177 carteInMano[2] = null;
178 pannello.repaint();
179 return true;
180 }
181 }
182 return false;
183 }
184}
185
186
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/Main.java b/JBriscola/all_versions/0.1/0.1.1/src/Main.java
new file mode 100755
index 0000000..a97b21e
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/Main.java
@@ -0,0 +1,708 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static Frame frame;
33 public static String version = "0.1.1";
34 public static String stringaBottonePrendi = "Prendi/Lascia carte";
35 public static String stringaPrimaGioca = "Prima Gioca!";
36 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
37 public static String stringaVinto = "Hai Vinto!";
38 public static String stringaPerso = "Hai Perso";
39 public static String stringaPareggio = "Pareggio";
40 public static String stringaGiocatore = "Giocatore: ";
41 public static String stringaComputer = "\nComputer: ";
42 public static String stringaNuovaPartita = "Nuova Partita";
43 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
44 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
45 public static String stringaSi = "Si";
46 public static String stringaNo = "No";
47 public static String stringaOpzioni = "Opzioni...";
48 public static String stringaEsci = "Esci";
49 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
50 public static String stringaLingua = "Lingua";
51 public static String stringaAnnulla = "Annulla";
52 public static String stringaIt = "Italiano";
53 public static String stringaLa = "Latino";
54 public static String stringaBL = "Dialetto Bellunese";
55 public static String stringaBV = "Dialetto Basso Veneto";
56 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
57 public static String stringaModificaOpzioni = "Modifica Opzioni";
58 public static String stringaInformazioni = "Informazioni";
59 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";
60 public static void main( String args[] ) {
61 settaOpzioni();
62 frame = new Frame();
63 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
64 frame.setResizable( false );
65 frame.setSize( 600, 600 );
66 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
67 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
68
69 frame.setVisible( true );
70 }
71 public void mischia() {
72 mano = 0;
73 punteggio = 0;
74 punteggioCPU = 0;
75 cartaDaPescare = 6;
76 ImageIcon aux;
77 frame.mazzo = true;
78 toccaAllaCPU = false;
79 CPUHaGiocato = false;
80 haGiocatoPrima = true;
81 for ( int i = 0, k = 0; i < 10; i++ )
82 for ( int j = 0; j < 4; j++, k++ )
83 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
84 for ( int i = 0; i < 391; i++ ) {
85 double a = Math.random() * 40;
86 int x = (int) a;
87 double b = Math.random() * 40;
88 int y = (int) b;
89 aux = frame.arrayCarteMescolate[x];
90 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
91 frame.arrayCarteMescolate[y] = aux;
92 }
93 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
94 semeBriscola = auxChar[auxChar.length-5] - 49;
95 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
96 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
97 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
98 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
99 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
100 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
101 frame.ultimaCarta = frame.arrayCarteMescolate[39];
102 frame.giocata[0] = null;
103 frame.giocata[1] = null;
104 }
105 public void giocaCPU() {
106 if ( frame.giocata[0] == null ) {
107 if ( vaiLiscio() );
108 else if ( vaiPunti() );
109 else if ( vaiTaglio() );
110 else if ( vaiBriscolaAlta() );
111 else if ( vaiCarico() );
112 else if ( vaiTre() );
113 else if ( vaiAsso() );
114 else;
115 }
116 else {
117 if ( haLisciato() ) {
118 if ( vaiSopra() );
119 else if ( vaiLiscio() );
120 else if ( vaiPunti() );
121 else if ( vaiTaglio() );
122 else if ( vaiTre() );
123 else if ( vaiBriscolaAlta() );
124 else if ( vaiCarico() );
125 else if ( vaiAsso() );
126 } else if ( haMessoPunti() ) {
127 if ( vaiSopra() );
128 else if ( vaiLiscio() );
129 else if ( vaiTaglio() );
130 else if ( vaiPunti() );
131 else if ( vaiTre() );
132 else if ( vaiBriscolaAlta() );
133 else if ( vaiCarico() );
134 else if ( vaiAsso() );
135 } else if ( haTagliato() ) {
136 if ( vaiLiscio() );
137 else if ( vaiPunti() );
138 else if ( vaiTaglio() );
139 else if ( vaiTre() );
140 else if ( vaiBriscolaAlta() );
141 else if ( vaiCarico() );
142 else if ( vaiAsso() );
143 } else if ( haMessoBriscolaAlta() ) {
144 if ( vaiLiscio() );
145 else if ( vaiPunti() );
146 else if ( vaiTre() );
147 else if ( vaiTaglio() );
148 else if ( vaiBriscolaAlta() );
149 else if ( vaiCarico() );
150 else if ( vaiAsso() );
151 } else if ( haMessoTre() ) {
152 if ( vaiAsso() );
153 else if ( vaiLiscio() );
154 else if ( vaiPunti() );
155 else if ( vaiTaglio() );
156 else if ( vaiBriscolaAlta() );
157 else if ( vaiCarico() );
158 } else if ( haMessoAsso() ) {
159 if ( vaiLiscio() );
160 else if ( vaiPunti() );
161 else if ( vaiTaglio() );
162 else if ( vaiBriscolaAlta() );
163 else if ( vaiCarico() );
164 else if ( vaiTre() );
165 } else if ( haCaricato() ) {
166 if ( vaiSopra() );
167 else if ( vaiTre() );
168 else if ( vaiBriscolaAlta() );
169 else if ( vaiAsso() );
170 else if ( vaiTaglio() );
171 else if ( vaiLiscio() );
172 else if ( vaiPunti() );
173 else if ( vaiCarico() );
174 }
175 }
176 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
177 frame.carteCPU[cartaDaGiocare] = null;
178 frame.pannello.repaint();
179 CPUHaGiocato = true;
180 if ( frame.giocata[0] == null )
181 toccaAllaCPU = false;
182 }
183 public void chiPrende() {
184 char aux[], auxCPU[];
185 aux = frame.giocata[0].toString().toCharArray();
186 auxCPU = frame.giocata[1].toString().toCharArray();
187 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
188 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
189 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
190 }
191 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
192 int a, b;
193 switch ( prima ) {
194 case 0:
195 a = 10;
196 break;
197 case 1:
198 a = 12;
199 break;
200 case 3:
201 a = 11;
202 break;
203 default:
204 a = prima;
205 break;
206 }
207 switch ( seconda ) {
208 case 0:
209 b = 10;
210 break;
211 case 1:
212 b = 12;
213 break;
214 case 3:
215 b = 11;
216 break;
217 default:
218 b = seconda;
219 break;
220 }
221 return a > b;
222 }
223 public void giocatorePrende( boolean giocatore ) {
224 if ( giocatore ) {
225 toccaAllaCPU = CPUHaGiocato = false;
226 haGiocatoPrima = true;
227 }
228 else {
229 toccaAllaCPU = true;
230 CPUHaGiocato = haGiocatoPrima = false;
231 }
232 daiPunti( giocatore );
233 if ( toccaAllaCPU )
234 giocaCPU();
235 }
236 public void daiPunti( boolean giocatore ) {
237 char aux[], auxCPU[];
238 aux = frame.giocata[0].toString().toCharArray();
239 auxCPU = frame.giocata[1].toString().toCharArray();
240 int punti = 0;
241 switch( aux[aux.length-7] - 48 ) {
242 case 0:
243 punti += 4;
244 break;
245 case 1:
246 punti += 11;
247 break;
248 case 3:
249 punti += 10;
250 break;
251 case 8:
252 punti += 2;
253 break;
254 case 9:
255 punti += 3;
256 break;
257 default:
258 break;
259 }
260 switch( auxCPU[auxCPU.length-7] - 48 ) {
261 case 0:
262 punti += 4;
263 break;
264 case 1:
265 punti += 11;
266 break;
267 case 3:
268 punti += 10;
269 break;
270 case 8:
271 punti += 2;
272 break;
273 case 9:
274 punti += 3;
275 break;
276 default:
277 break;
278 }
279 frame.giocata[0] = frame.giocata[1] = null;
280 if ( giocatore ) {
281 punteggio += punti;
282 if ( mano < 18 ) {
283 if ( frame.carteInMano[0] == null )
284 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
285 if ( frame.carteInMano[1] == null )
286 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
287 if ( frame.carteInMano[2] == null )
288 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
289 cartaDaPescare++;
290 if ( frame.carteCPU[0] == null )
291 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
292 if ( frame.carteCPU[1] == null )
293 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
294 if ( frame.carteCPU[2] == null )
295 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
296 cartaDaPescare++;
297 }
298 }
299 else {
300 punteggioCPU += punti;
301 if ( mano < 18 ) {
302 if ( frame.carteCPU[0] == null )
303 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
304 if ( frame.carteCPU[1] == null )
305 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
306 if ( frame.carteCPU[2] == null )
307 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
308 cartaDaPescare++;
309 if ( frame.carteInMano[0] == null )
310 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
311 if ( frame.carteInMano[1] == null )
312 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
313 if ( frame.carteInMano[2] == null )
314 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
315 cartaDaPescare++;
316 }
317 }
318 frame.pannello.repaint();
319 frame.repaint();
320 }
321 public boolean haLisciato() {
322 char auxCPU[];
323 auxCPU = frame.giocata[0].toString().toCharArray();
324 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
325 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
326 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
327 }
328 public boolean haMessoPunti() {
329 char auxCPU[];
330 auxCPU = frame.giocata[0].toString().toCharArray();
331 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
332 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
333 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
334 }
335 public boolean haTagliato() {
336 char auxCPU[];
337 auxCPU = frame.giocata[0].toString().toCharArray();
338 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
339 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
340 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
341 }
342 public boolean haMessoBriscolaAlta() {
343 char auxCPU[];
344 auxCPU = frame.giocata[0].toString().toCharArray();
345 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
346 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
347 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
348 }
349 public boolean haMessoTre() {
350 char auxCPU[];
351 auxCPU = frame.giocata[0].toString().toCharArray();
352 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
353 (auxCPU[auxCPU.length-7] - 48 == 3) );
354 }
355 public boolean haMessoAsso() {
356 char auxCPU[];
357 auxCPU = frame.giocata[0].toString().toCharArray();
358 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
359 (auxCPU[auxCPU.length-7] - 48 == 1) );
360 }
361 public boolean haCaricato() {
362 char auxCPU[];
363 auxCPU = frame.giocata[0].toString().toCharArray();
364 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
365 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
366 }
367 public boolean vaiLiscio() {
368 char auxCPU[];
369 for ( int i = 0; i < 3; i++ ) {
370 if ( frame.carteCPU[i] != null ) {
371 auxCPU = frame.carteCPU[i].toString().toCharArray();
372 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
373 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
374 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
375 cartaDaGiocare = i;
376 return true;
377 }
378 }
379 }
380 return false;
381 }
382 public boolean vaiPunti() {
383 char[] auxCPU;
384 for ( int i = 0; i < 3; i++ ) {
385 if ( frame.carteCPU[i] != null ) {
386 auxCPU = frame.carteCPU[i].toString().toCharArray();
387 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
388 cartaDaGiocare = i;
389 return true;
390 }
391 }
392 }
393 for ( int i = 0; i < 3; i++ ) {
394 if ( frame.carteCPU[i] != null ) {
395 auxCPU = frame.carteCPU[i].toString().toCharArray();
396 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
397 cartaDaGiocare = i;
398 return true;
399 }
400 }
401 }
402 for ( int i = 0; i < 3; i++ ) {
403 if ( frame.carteCPU[i] != null ) {
404 auxCPU = frame.carteCPU[i].toString().toCharArray();
405 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
406 cartaDaGiocare = i;
407 return true;
408 }
409 }
410 }
411 return false;
412 }
413 public boolean vaiTaglio() {
414 char auxCPU[];
415 for ( int i = 0; i < 3; i++ ) {
416 if ( frame.carteCPU[i] != null ) {
417 auxCPU = frame.carteCPU[i].toString().toCharArray();
418 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
419 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
420 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
421 cartaDaGiocare = i;
422 return true;
423 }
424 }
425 }
426 return false;
427 }
428 public boolean vaiBriscolaAlta() {
429 char[] auxCPU;
430 for ( int i = 0; i < 3; i++ ) {
431 if ( frame.carteCPU[i] != null ) {
432 auxCPU = frame.carteCPU[i].toString().toCharArray();
433 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
434 cartaDaGiocare = i;
435 return true;
436 }
437 }
438 }
439 for ( int i = 0; i < 3; i++ ) {
440 if ( frame.carteCPU[i] != null ) {
441 auxCPU = frame.carteCPU[i].toString().toCharArray();
442 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
443 cartaDaGiocare = i;
444 return true;
445 }
446 }
447 }
448 for ( int i = 0; i < 3; i++ ) {
449 if ( frame.carteCPU[i] != null ) {
450 auxCPU = frame.carteCPU[i].toString().toCharArray();
451 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
452 cartaDaGiocare = i;
453 return true;
454 }
455 }
456 }
457 return false;
458 }
459 public boolean vaiTre() {
460 char auxCPU[];
461 for ( int i = 0; i < 3; i++ ) {
462 if ( frame.carteCPU[i] != null ) {
463 auxCPU = frame.carteCPU[i].toString().toCharArray();
464 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
465 cartaDaGiocare = i;
466 return true;
467 }
468 }
469 }
470 return false;
471 }
472 public boolean vaiAsso() {
473 char auxCPU[];
474 for ( int i = 0; i < 3; i++ ) {
475 if ( frame.carteCPU[i] != null ) {
476 auxCPU = frame.carteCPU[i].toString().toCharArray();
477 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
478 cartaDaGiocare = i;
479 return true;
480 }
481 }
482 }
483 return false;
484 }
485 public boolean vaiCarico() {
486 char[] auxCPU;
487 for ( int i = 0; i < 3; i++ ) {
488 if ( frame.carteCPU[i] != null ) {
489 auxCPU = frame.carteCPU[i].toString().toCharArray();
490 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
491 cartaDaGiocare = i;
492 return true;
493 }
494 }
495 }
496 for ( int i = 0; i < 3; i++ ) {
497 if ( frame.carteCPU[i] != null ) {
498 auxCPU = frame.carteCPU[i].toString().toCharArray();
499 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
500 cartaDaGiocare = i;
501 return true;
502 }
503 }
504 }
505 return false;
506 }
507 public boolean vaiSopra() {
508 if ( frame.giocata[0] == null )
509 return false;
510 int a = -1;
511 int b = -1;
512 int c = -1;
513 boolean laPrimaPuoAndareSopra = false;
514 boolean laSecondaPuoAndareSopra = false;
515 boolean laTerzaPuoAndareSopra = false;
516 char[] auxCPU1 = new char[1024];
517 char[] auxCPU2 = new char[1024];
518 char[] auxCPU3 = new char[1024];
519 char[] aux = frame.giocata[0].toString().toCharArray();
520 if ( aux[aux.length-7] - 48 == 1 )
521 return false;
522 if ( frame.carteCPU[0] != null ) {
523 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
524 a = auxCPU1[auxCPU1.length-7] - 48;
525 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
526 laPrimaPuoAndareSopra = true;
527 }
528 if ( frame.carteCPU[1] != null ) {
529 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
530 b = auxCPU2[auxCPU2.length-7] - 48;
531 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
532 laSecondaPuoAndareSopra = true;
533 }
534 if ( frame.carteCPU[2] != null ) {
535 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
536 c = auxCPU3[auxCPU3.length-7] - 48;
537 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
538 laTerzaPuoAndareSopra = true;
539 }
540 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
541 return false;
542 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
543 cartaDaGiocare = 0;
544 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
545 cartaDaGiocare = 1;
546 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
547 cartaDaGiocare = 2;
548 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
549 if ( laPrimaEPiuAlta( a, b ) )
550 cartaDaGiocare = 0;
551 else
552 cartaDaGiocare = 1;
553 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
554 if ( laPrimaEPiuAlta( b, c ) )
555 cartaDaGiocare = 1;
556 else
557 cartaDaGiocare = 2;
558 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
559 if ( laPrimaEPiuAlta( a, c ) )
560 cartaDaGiocare = 0;
561 else
562 cartaDaGiocare = 2;
563 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
564 if ( laPrimaEPiuAlta( a, b ) )
565 if ( laPrimaEPiuAlta( a, c ) )
566 cartaDaGiocare = 0;
567 else
568 cartaDaGiocare = 2;
569 else
570 if ( laPrimaEPiuAlta( b, c ) )
571 cartaDaGiocare = 1;
572 else
573 cartaDaGiocare = 2;
574 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
575 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
576 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
577 return false;
578 return true;
579 }
580 public static void settaOpzioni() {
581 String lang;
582 Scanner scanner = null;
583 File file = new File( "JBriscolaConfig.txt" );
584 if ( file.exists() ) {
585 try {
586 scanner = new Scanner( file );
587 } catch ( FileNotFoundException e ) {
588 lang = "it";
589 }
590 lang = scanner.next();
591 }
592 else {
593 lang = "it";
594 }
595 if ( lang.equals( "it" ) ) {
596 stringaBottonePrendi = "Prendi/Lascia carte";
597 stringaPrimaGioca = "Prima Gioca!";
598 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
599 stringaVinto = "Hai Vinto!";
600 stringaPerso = "Hai Perso";
601 stringaPareggio = "Pareggio";
602 stringaGiocatore = "Giocatore: ";
603 stringaComputer = "\nComputer: ";
604 stringaNuovaPartita = "Nuova Partita";
605 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
606 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
607 stringaSi = "Si";
608 stringaNo = "No";
609 stringaOpzioni = "Opzioni...";
610 stringaEsci = "Esci";
611 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
612 stringaLingua = "Lingua";
613 stringaAnnulla = "Annulla";
614 stringaIt = "Italiano";
615 stringaLa = "Latino";
616 stringaBL = "Dialetto Bellunese";
617 stringaBV = "Dialetto Basso Veneto";
618 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
619 stringaModificaOpzioni = "Modifica Opzioni";
620 stringaInformazioni = "Informazioni";
621 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";
622 }
623 else if ( lang.equals( "la" ) ) {
624 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
625 stringaPrimaGioca = "ANTE CHARTAM PONE!";
626 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
627 stringaVinto = "VICISTI!";
628 stringaPerso = "PERDIDISTI";
629 stringaPareggio = "AEQVATIO!";
630 stringaGiocatore = "LVSOR: ";
631 stringaComputer = "\nCOMPVTER: ";
632 stringaNuovaPartita = "NOVA LVSO";
633 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
634 stringaVuoiDavveroUscire = "EXIRE?";
635 stringaSi = "ID VOLO";
636 stringaNo = "NOLO";
637 stringaOpzioni = "OPTIONES...";
638 stringaEsci = "EXIRE";
639 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
640 stringaLingua = "LINGVA";
641 stringaAnnulla = "ABROGA";
642 stringaIt = "ITALICA";
643 stringaLa = "LATINA";
644 stringaBL = "BELLUNI";
645 stringaBV = "VENETIAE";
646 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
647 stringaModificaOpzioni = "OPTIONES NOVARE";
648 stringaInformazioni = "INFORMATIONES";
649 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";
650 }
651 if ( lang.equals( "bl" ) ) {
652 stringaBottonePrendi = "Cio' su/lasa le carte";
653 stringaPrimaGioca = "Prima Duga!";
654 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
655 stringaVinto = "Te ha vint!";
656 stringaPerso = "Te ha pers";
657 stringaPareggio = "Pari";
658 stringaGiocatore = "Dugador: ";
659 stringaComputer = "\nComputer: ";
660 stringaNuovaPartita = "Taca n'altra partida";
661 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
662 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
663 stringaSi = "Si";
664 stringaNo = "No";
665 stringaOpzioni = "Opzioni...";
666 stringaEsci = "Stusa su";
667 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
668 stringaLingua = "Lengua";
669 stringaAnnulla = "Annulla";
670 stringaIt = "Italian";
671 stringaLa = "Latin";
672 stringaBL = "Dialeto de Belun";
673 stringaBV = "Dialeto de la basa";
674 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
675 stringaModificaOpzioni = "Modifica Opzioni";
676 stringaInformazioni = "Informazioni";
677 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";
678 }
679 if ( lang.equals( "bv" ) ) {
680 stringaBottonePrendi = "Ciapa su/lasa e carte";
681 stringaPrimaGioca = "Prima Zuga!";
682 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
683 stringaVinto = "Ti ga vinto!";
684 stringaPerso = "Ti ga perso";
685 stringaPareggio = "Pari";
686 stringaGiocatore = "Zugador: ";
687 stringaComputer = "\nComputer: ";
688 stringaNuovaPartita = "N'altra Partida";
689 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
690 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
691 stringaSi = "Si";
692 stringaNo = "No";
693 stringaOpzioni = "Opzioni...";
694 stringaEsci = "Stusa su";
695 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
696 stringaLingua = "Lengua";
697 stringaAnnulla = "Annulla";
698 stringaIt = "Italian";
699 stringaLa = "Latin";
700 stringaBL = "Dialeto Belumat";
701 stringaBV = "Dialeto Veneto";
702 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
703 stringaModificaOpzioni = "Modifica Opzioni";
704 stringaInformazioni = "Informasioni";
705 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";
706 }
707 }
708}
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java b/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java
new file mode 100755
index 0000000..bd6f0da
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java
@@ -0,0 +1,87 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla;
31 public static JLabel lingua;
32 public static JComboBox selezionaLingua;
33 public static JPanel pannello1, pannello2;
34 public OptionFrame() {
35 super( "JBriscola - " + main.stringaModificaOpzioni );
36 ok = new JButton( "OK" );
37 ok.addActionListener( new ActionListener() {
38 public void actionPerformed( ActionEvent e ) {
39 try {
40 formatter = new Formatter( "JBriscolaConfig.txt" );
41 } catch ( Exception ex ) {
42 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
43 }
44 String lang;
45 switch ( selezionaLingua.getSelectedIndex() ) {
46 case 0:
47 lang = "it";
48 break;
49 case 1:
50 lang = "la";
51 break;
52 case 2:
53 lang = "bl";
54 break;
55 case 3:
56 lang = "bv";
57 break;
58 default:
59 lang = "it";
60 break;
61 }
62 formatter.format( lang );
63 formatter.close();
64 main.settaOpzioni();
65 OptionFrame.this.dispose();
66 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
67 }
68 });
69 annulla = new JButton( main.stringaAnnulla );
70 annulla.addActionListener( new ActionListener() {
71 public void actionPerformed( ActionEvent e ) {
72 OptionFrame.this.dispose();
73 }
74 });
75 lingua = new JLabel( main.stringaLingua );
76 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
77 selezionaLingua = new JComboBox( lingueDaSelezionare );
78 pannello1 = new JPanel( new FlowLayout() );
79 pannello1.add( lingua );
80 pannello1.add( selezionaLingua );
81 pannello2 = new JPanel( new FlowLayout() );
82 pannello2.add( ok );
83 pannello2.add( annulla );
84 add( pannello1, BorderLayout.CENTER );
85 add( pannello2, BorderLayout.SOUTH );
86 }
87}
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/Pannello.java b/JBriscola/all_versions/0.1/0.1.1/src/Pannello.java
new file mode 100755
index 0000000..9e73356
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/Pannello.java
@@ -0,0 +1,53 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.Graphics;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public Pannello() {
28 }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 if ( main.frame.ultimaCarta != null )
32 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
33 if ( main.frame.mazzo )
34 main.frame.retro2.paintIcon( this, g, 17, 256 );
35 if ( main.frame.carteCPU[0] != null )
36 main.frame.retro1.paintIcon( this, g, 230, 5 );
37 if ( main.frame.carteCPU[1] != null )
38 main.frame.retro1.paintIcon( this, g, 300, 5 );
39 if ( main.frame.carteCPU[2] != null )
40 main.frame.retro1.paintIcon( this, g, 370, 5 );
41 if ( main.frame.carteInMano[0] != null )
42 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
43 if ( main.frame.carteInMano[1] != null )
44 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
45 if ( main.frame.carteInMano[2] != null )
46 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
47 if ( main.frame.giocata[0] != null )
48 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
49 if ( main.frame.giocata[1] != null )
50 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
51 }
52}
53
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/1-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/1-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/1-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/1-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/10-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/10-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/10-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/10-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/2-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/2-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/2-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/2-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/3-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/3-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/3-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/3-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/4-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/4-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/4-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/4-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/5-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/5-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/5-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/5-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/6-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/6-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/6-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/6-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/7-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/7-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/7-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/7-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/8-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/8-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/8-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/8-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/9-1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/9-2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/9-3.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/9-4.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/carte.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/retro1.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.1/0.1.1/src/img/retro2.jpg b/JBriscola/all_versions/0.1/0.1.1/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.1/0.1.1/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/Frame.java b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Frame.java
new file mode 100755
index 0000000..31aa39b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Frame.java
@@ -0,0 +1,242 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.awt.*;
26import java.awt.event.*;
27
28public class Frame extends JFrame {
29 public static boolean mazzo;
30 public static Main main;
31 public static Pannello pannello;
32 public static JPanel pannello2;
33 public static JButton button;
34 public static JMenuBar barraMenu;
35 public static JMenu file, puntoInterrogativo;
36 public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti;
37 public static ImageIcon retro1, retro2, ultimaCarta;
38 public static ImageIcon[] giocata = new ImageIcon[2];
39 public static ImageIcon[] carteInMano = new ImageIcon[3];
40 public static ImageIcon[] carteCPU = new ImageIcon[3];
41 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
42 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
43 public Frame() {
44 super( "Tronto's JBriscola " + main.version );
45 mazzo = true;
46 main = new Main();
47 pannello = new Pannello();
48 pannello2 = new JPanel( new FlowLayout() );
49 button = new JButton( main.stringaBottonePrendi );
50 button.addActionListener( new ActionListener() {
51 public void actionPerformed( ActionEvent e ) {
52 if ( giocata[0] != null && giocata[1] != null )
53 main.mano++;
54 try {
55 main.chiPrende();
56 } catch ( Exception ex ) {
57 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
58 }
59 if ( main.mano == 16 )
60 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
61 if ( main.mano == 17 ) {
62 mazzo = false;
63 ultimaCarta = null;
64 pannello.repaint();
65 Frame.this.repaint();
66 }
67 if ( main.mano == 20 ) {
68 String titolo = "";
69 String suonoFinale = "";
70 if ( main.punteggio > main.punteggioCPU ) {
71 titolo = main.stringaVinto;
72 suonoFinale = "sounds/perso.wav";
73 }
74 if ( main.punteggio < main.punteggioCPU ) {
75 titolo = main.stringaPerso;
76 suonoFinale = "sounds/vinto.wav";
77 }
78 if ( main.punteggio == main.punteggioCPU ) {
79 titolo = main.stringaPareggio;
80 suonoFinale = "sounds/pareggio.wav";
81 }
82 if ( main.sound ) {
83 try {
84 File suono = new File( ClassLoader.getSystemResource( suonoFinale ).toURI() );
85 AudioFileFormat aff = AudioSystem.getAudioFileFormat( suono );
86 AudioInputStream ais = AudioSystem.getAudioInputStream( suono );
87 AudioFormat af = aff.getFormat();
88 DataLine.Info info = new DataLine.Info(
89 Clip.class,
90 ais.getFormat(),
91 ( (int) ais.getFrameLength() *
92 af.getFrameSize() ) );
93 Clip ol = ( Clip ) AudioSystem.getLine( info );
94 ol.open(ais);
95 ol.loop( 0 );
96 } catch ( Exception ex ) {
97 System.err.println( e );
98 }
99 }
100 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
101 }
102 }
103 } );
104 barraMenu = new JMenuBar();
105 file = new JMenu( "File" );
106 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
107 nuovaPartita.addActionListener( new ActionListener() {
108 public void actionPerformed( ActionEvent e ) {
109 if ( main.mano == 20 ) {
110 main.mischia();
111 pannello.repaint();
112 repaint();
113 }
114 else {
115 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 );
116 if ( selezione == JOptionPane.YES_OPTION ) {
117 main.mischia();
118 pannello.repaint();
119 repaint();
120 }
121 }
122 }
123 });
124 opzioni = new JMenuItem( main.stringaOpzioni );
125 opzioni.addActionListener( new ActionListener() {
126 public void actionPerformed( ActionEvent e ) {
127 OptionFrame optionFrame = new OptionFrame();
128 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
129 optionFrame.setResizable( false );
130 optionFrame.setAlwaysOnTop( true );
131 optionFrame.setSize( 300, 150 );
132 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
133 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
134 optionFrame.setVisible( true );
135 }
136 });
137 esci = new JMenuItem( main.stringaEsci );
138 esci.addActionListener( new ActionListener() {
139 public void actionPerformed( ActionEvent e ) {
140 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 );
141 if ( selezione == JOptionPane.YES_OPTION )
142 Frame.this.dispose();
143 }
144 });
145 file.add( nuovaPartita );
146 file.add( opzioni );
147 file.addSeparator();
148 file.add( esci );
149 puntoInterrogativo = new JMenu( "?" );
150 informazioni = new JMenuItem( main.stringaInformazioni );
151 informazioni.addActionListener( new ActionListener() {
152 public void actionPerformed( ActionEvent e ) {
153 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
154 }
155 } );
156 punti = new JMenuItem( main.stringaPunteggio );
157 punti.addActionListener( new ActionListener() {
158 public void actionPerformed( ActionEvent e ) {
159 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
160 }
161 } );
162 puntoInterrogativo.add( punti );
163 puntoInterrogativo.add( informazioni );
164 barraMenu.add( file );
165 barraMenu.add( puntoInterrogativo );
166 setJMenuBar( barraMenu );
167 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
168 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
169 for (int i = 0; i < 10; i++)
170 for (int j = 0; j < 4; j++)
171 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
172 main.mischia();
173 pannello2.add( button );
174 setLayout( new BorderLayout() );
175 add( pannello, BorderLayout.CENTER );
176 add( pannello2, BorderLayout.SOUTH );
177 addMouseListener(
178 new MouseAdapter() {
179 public void mouseClicked ( MouseEvent e ) {
180 if ( mettiCarta( e.getX(), e.getY() ) ) {
181 if ( !main.CPUHaGiocato )
182 main.giocaCPU();
183 }
184 }
185 }
186 );
187 addWindowListener(
188 new WindowAdapter() {
189 public void windowClosing( WindowEvent e ) {
190 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 );
191 if ( selezione == JOptionPane.YES_OPTION )
192 System.exit( 0 );
193 }
194 }
195 );
196 }
197 public boolean mettiCarta( int x, int y ) {
198 if ( !main.toccaAllaCPU && giocata[0] == null ) {
199 if ( main.sound ) {
200 try {
201 double a = Math.random() * 6;
202 int i = (int) a;
203 File suono = new File( ClassLoader.getSystemResource( "sounds/" + i + ".wav" ).toURI() );
204 AudioFileFormat aff = AudioSystem.getAudioFileFormat( suono );
205 AudioInputStream ais = AudioSystem.getAudioInputStream( suono );
206 AudioFormat af = aff.getFormat();
207 DataLine.Info info = new DataLine.Info(
208 Clip.class,
209 ais.getFormat(),
210 ( (int) ais.getFrameLength() *
211 af.getFrameSize() ) );
212 Clip ol = ( Clip ) AudioSystem.getLine( info );
213 ol.open(ais);
214 ol.loop( 0 );
215 } catch ( Exception e ) {
216 System.err.println( e );
217 }
218 }
219 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
220 giocata[0] = carteInMano[0];
221 carteInMano[0] = null;
222 pannello.repaint();
223 return true;
224 }
225 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
226 giocata[0] = carteInMano[1];
227 carteInMano[1] = null;
228 pannello.repaint();
229 return true;
230 }
231 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
232 giocata[0] = carteInMano[2];
233 carteInMano[2] = null;
234 pannello.repaint();
235 return true;
236 }
237 }
238 return false;
239 }
240}
241
242
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/Main.java b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Main.java
new file mode 100755
index 0000000..6e09368
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Main.java
@@ -0,0 +1,1068 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static boolean sound = true;
33 public static Frame frame;
34 public static Color color = new Color( 0, 150, 0 );
35 public static String version = "0.2 beta 1";
36 public static String stringaBottonePrendi = "Prendi/Lascia carte";
37 public static String stringaPrimaGioca = "Prima Gioca!";
38 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
39 public static String stringaVinto = "Hai Vinto!";
40 public static String stringaPerso = "Hai Perso";
41 public static String stringaPareggio = "Pareggio";
42 public static String stringaGiocatore = "Giocatore: ";
43 public static String stringaComputer = "\nComputer: ";
44 public static String stringaNuovaPartita = "Nuova Partita";
45 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
46 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
47 public static String stringaSi = "Si";
48 public static String stringaNo = "No";
49 public static String stringaOpzioni = "Opzioni...";
50 public static String stringaEsci = "Esci";
51 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
52 public static String stringaLingua = "Lingua";
53 public static String stringaAnnulla = "Annulla";
54 public static String stringaIt = "Italiano";
55 public static String stringaLa = "Latino";
56 public static String stringaBL = "Dialetto Bellunese";
57 public static String stringaBV = "Dialetto Basso Veneto";
58 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
59 public static String stringaModificaOpzioni = "Modifica Opzioni";
60 public static String stringaInformazioni = "Informazioni";
61 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";
62 public static String stringaSuono = "Effetti Sonori";
63 public static String stringaPunteggio = "Punteggio";
64 public static String stringaSfondo = "Sfondo";
65 public static String lang, soundString;
66 public static void main( String args[] ) {
67 settaOpzioni();
68 frame = new Frame();
69 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
70 frame.setResizable( false );
71 frame.setSize( 600, 600 );
72 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
73 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
74
75 frame.setVisible( true );
76 }
77 public void mischia() {
78 mano = 0;
79 punteggio = 0;
80 punteggioCPU = 0;
81 cartaDaPescare = 6;
82 ImageIcon aux;
83 frame.mazzo = true;
84 toccaAllaCPU = false;
85 CPUHaGiocato = false;
86 haGiocatoPrima = true;
87 for ( int i = 0, k = 0; i < 10; i++ )
88 for ( int j = 0; j < 4; j++, k++ )
89 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
90 for ( int i = 0; i < 391; i++ ) {
91 double a = Math.random() * 40;
92 int x = (int) a;
93 double b = Math.random() * 40;
94 int y = (int) b;
95 aux = frame.arrayCarteMescolate[x];
96 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
97 frame.arrayCarteMescolate[y] = aux;
98 }
99 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
100 semeBriscola = auxChar[auxChar.length-5] - 49;
101 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
102 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
103 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
104 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
105 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
106 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
107 frame.ultimaCarta = frame.arrayCarteMescolate[39];
108 frame.giocata[0] = null;
109 frame.giocata[1] = null;
110 }
111 public void giocaCPU() {
112 if ( mano < 16 ) {
113 if ( frame.giocata[0] == null ) {
114 if ( vaiPunti() );
115 else if ( vaiLiscio() );
116 else if ( vaiTaglio() );
117 else if ( vaiBriscolaAlta() );
118 else if ( vaiCarico() );
119 else if ( vaiTre() );
120 else if ( vaiAsso() );
121 else;
122 }
123 else {
124 if ( haLisciato() ) {
125 if ( vaiSopra() );
126 else if ( vaiLiscio() );
127 else if ( vaiPunti() );
128 else if ( vaiTaglio() );
129 else if ( vaiTre() );
130 else if ( vaiBriscolaAlta() );
131 else if ( vaiCarico() );
132 else if ( vaiAsso() );
133 } else if ( haMessoPunti() ) {
134 if ( vaiSopra() );
135 else if ( vaiLiscio() );
136 else if ( vaiTaglio() );
137 else if ( vaiPunti() );
138 else if ( vaiTre() );
139 else if ( vaiBriscolaAlta() );
140 else if ( vaiCarico() );
141 else if ( vaiAsso() );
142 } else if ( haTagliato() ) {
143 if ( vaiLiscio() );
144 else if ( vaiPunti() );
145 else if ( vaiTaglio() );
146 else if ( vaiTre() );
147 else if ( vaiBriscolaAlta() );
148 else if ( vaiCarico() );
149 else if ( vaiAsso() );
150 } else if ( haMessoBriscolaAlta() ) {
151 if ( vaiLiscio() );
152 else if ( vaiPunti() );
153 else if ( vaiTre() );
154 else if ( vaiTaglio() );
155 else if ( vaiBriscolaAlta() );
156 else if ( vaiCarico() );
157 else if ( vaiAsso() );
158 } else if ( haMessoTre() ) {
159 if ( vaiAsso() );
160 else if ( vaiLiscio() );
161 else if ( vaiPunti() );
162 else if ( vaiTaglio() );
163 else if ( vaiBriscolaAlta() );
164 else if ( vaiCarico() );
165 } else if ( haMessoAsso() ) {
166 if ( vaiLiscio() );
167 else if ( vaiPunti() );
168 else if ( vaiTaglio() );
169 else if ( vaiBriscolaAlta() );
170 else if ( vaiCarico() );
171 else if ( vaiTre() );
172 } else if ( haCaricato() ) {
173 if ( vaiSopra() );
174 else if ( vaiTre() );
175 else if ( vaiBriscolaAlta() );
176 else if ( vaiAsso() );
177 else if ( vaiTaglio() );
178 else if ( vaiLiscio() );
179 else if ( vaiPunti() );
180 else if ( vaiCarico() );
181 }
182 }
183 }
184 else if ( mano == 16 ) {
185 if ( frame.giocata[0] == null ) {
186 char aux[];
187 aux = frame.ultimaCarta.toString().toCharArray();
188 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
189 if ( vaiCarico() );
190 else if ( vaiPunti() );
191 else if ( vaiLiscio() );
192 else if ( vaiTaglio() );
193 else if ( vaiBriscolaAlta() );
194 else if ( vaiTre() );
195 else if ( vaiAsso() );
196 else;
197 } else {
198 if ( vaiPunti() );
199 else if ( vaiLiscio() );
200 else if ( vaiTaglio() );
201 else if ( vaiBriscolaAlta() );
202 else if ( vaiCarico() );
203 else if ( vaiTre() );
204 else if ( vaiAsso() );
205 else;
206 }
207 }
208 else {
209 char aux[];
210 aux = frame.ultimaCarta.toString().toCharArray();
211 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
212 if ( haCaricato() ) {
213 if ( vaiSopra() );
214 else if ( vaiLiscio() );
215 else if ( vaiPunti() );
216 else if ( vaiTre() );
217 else if ( vaiTaglio() );
218 else if ( vaiBriscolaAlta() );
219 else if ( vaiAsso() );
220 else if ( vaiCarico() );
221 }
222 } else {
223 if ( haLisciato() ) {
224 if ( vaiSopra() );
225 else if ( vaiLiscio() );
226 else if ( vaiPunti() );
227 else if ( vaiTaglio() );
228 else if ( vaiTre() );
229 else if ( vaiBriscolaAlta() );
230 else if ( vaiCarico() );
231 else if ( vaiAsso() );
232 } else if ( haMessoPunti() ) {
233 if ( vaiSopra() );
234 else if ( vaiLiscio() );
235 else if ( vaiTaglio() );
236 else if ( vaiPunti() );
237 else if ( vaiTre() );
238 else if ( vaiBriscolaAlta() );
239 else if ( vaiCarico() );
240 else if ( vaiAsso() );
241 } else if ( haTagliato() ) {
242 if ( vaiLiscio() );
243 else if ( vaiPunti() );
244 else if ( vaiTaglio() );
245 else if ( vaiTre() );
246 else if ( vaiBriscolaAlta() );
247 else if ( vaiCarico() );
248 else if ( vaiAsso() );
249 } else if ( haMessoBriscolaAlta() ) {
250 if ( vaiLiscio() );
251 else if ( vaiPunti() );
252 else if ( vaiTre() );
253 else if ( vaiTaglio() );
254 else if ( vaiBriscolaAlta() );
255 else if ( vaiCarico() );
256 else if ( vaiAsso() );
257 } else if ( haMessoTre() ) {
258 if ( vaiAsso() );
259 else if ( vaiLiscio() );
260 else if ( vaiPunti() );
261 else if ( vaiTaglio() );
262 else if ( vaiBriscolaAlta() );
263 else if ( vaiCarico() );
264 } else if ( haMessoAsso() ) {
265 if ( vaiLiscio() );
266 else if ( vaiPunti() );
267 else if ( vaiTaglio() );
268 else if ( vaiBriscolaAlta() );
269 else if ( vaiCarico() );
270 else if ( vaiTre() );
271 } else if ( haCaricato() ) {
272 if ( vaiSopra() );
273 else if ( vaiTre() );
274 else if ( vaiBriscolaAlta() );
275 else if ( vaiAsso() );
276 else if ( vaiTaglio() );
277 else if ( vaiLiscio() );
278 else if ( vaiPunti() );
279 else if ( vaiCarico() );
280 }
281 }
282 }
283 } else if ( mano == 17 ) {
284 if ( frame.giocata[0] == null ) {
285 if ( hoAsso() ) {
286 if ( vaiTre() );
287 else if ( vaiBriscolaAlta() );
288 else if ( vaiTaglio() );
289 else if ( vaiLiscio() );
290 else if ( vaiPunti() );
291 else if ( vaiAsso() );
292 else if ( vaiCarico() );
293 } else {
294 if ( vaiLiscio() );
295 else if ( vaiPunti() );
296 else if ( vaiTaglio() );
297 else if ( vaiBriscolaAlta() );
298 else if ( vaiCarico() );
299 else if ( vaiTre() );
300 }
301 }
302 else {
303 if ( haLisciato() ) {
304 if ( vaiSopra() );
305 else if ( vaiLiscio() );
306 else if ( vaiPunti() );
307 else if ( vaiTaglio() );
308 else if ( vaiTre() );
309 else if ( vaiBriscolaAlta() );
310 else if ( vaiCarico() );
311 else if ( vaiAsso() );
312 } else if ( haMessoPunti() ) {
313 if ( vaiSopra() );
314 else if ( vaiLiscio() );
315 else if ( vaiTaglio() );
316 else if ( vaiPunti() );
317 else if ( vaiTre() );
318 else if ( vaiBriscolaAlta() );
319 else if ( vaiCarico() );
320 else if ( vaiAsso() );
321 } else if ( haTagliato() ) {
322 if ( vaiLiscio() );
323 else if ( vaiPunti() );
324 else if ( vaiTaglio() );
325 else if ( vaiTre() );
326 else if ( vaiBriscolaAlta() );
327 else if ( vaiCarico() );
328 else if ( vaiAsso() );
329 } else if ( haMessoBriscolaAlta() ) {
330 if ( vaiLiscio() );
331 else if ( vaiPunti() );
332 else if ( vaiTre() );
333 else if ( vaiTaglio() );
334 else if ( vaiBriscolaAlta() );
335 else if ( vaiCarico() );
336 else if ( vaiAsso() );
337 } else if ( haMessoTre() ) {
338 if ( vaiAsso() );
339 else if ( vaiLiscio() );
340 else if ( vaiPunti() );
341 else if ( vaiTaglio() );
342 else if ( vaiBriscolaAlta() );
343 else if ( vaiCarico() );
344 } else if ( haMessoAsso() ) {
345 if ( vaiLiscio() );
346 else if ( vaiPunti() );
347 else if ( vaiTaglio() );
348 else if ( vaiBriscolaAlta() );
349 else if ( vaiCarico() );
350 else if ( vaiTre() );
351 } else if ( haCaricato() ) {
352 if ( vaiSopra() );
353 else if ( vaiTre() );
354 else if ( vaiBriscolaAlta() );
355 else if ( vaiAsso() );
356 else if ( vaiTaglio() );
357 else if ( vaiLiscio() );
358 else if ( vaiPunti() );
359 else if ( vaiCarico() );
360 }
361 }
362 } else if ( mano == 18 ) {
363 if ( frame.giocata[0] == null ) {
364 if ( vaiAsso() );
365 else if ( vaiCarico() );
366 else if ( vaiBriscolaAlta() );
367 else if ( vaiTaglio() );
368 else if ( vaiPunti() );
369 else if ( vaiLiscio() );
370 else if ( vaiTre() );
371 }
372 else {
373 if ( haLisciato() ) {
374 if ( vaiSopra() );
375 else if ( vaiLiscio() );
376 else if ( vaiPunti() );
377 else if ( vaiTaglio() );
378 else if ( vaiTre() );
379 else if ( vaiBriscolaAlta() );
380 else if ( vaiCarico() );
381 else if ( vaiAsso() );
382 } else if ( haMessoPunti() ) {
383 if ( vaiSopra() );
384 else if ( vaiLiscio() );
385 else if ( vaiTaglio() );
386 else if ( vaiPunti() );
387 else if ( vaiTre() );
388 else if ( vaiBriscolaAlta() );
389 else if ( vaiCarico() );
390 else if ( vaiAsso() );
391 } else if ( haTagliato() ) {
392 if ( vaiLiscio() );
393 else if ( vaiPunti() );
394 else if ( vaiTaglio() );
395 else if ( vaiTre() );
396 else if ( vaiBriscolaAlta() );
397 else if ( vaiCarico() );
398 else if ( vaiAsso() );
399 } else if ( haMessoBriscolaAlta() ) {
400 if ( vaiLiscio() );
401 else if ( vaiPunti() );
402 else if ( vaiTre() );
403 else if ( vaiTaglio() );
404 else if ( vaiBriscolaAlta() );
405 else if ( vaiCarico() );
406 else if ( vaiAsso() );
407 } else if ( haMessoTre() ) {
408 if ( vaiAsso() );
409 else if ( vaiLiscio() );
410 else if ( vaiPunti() );
411 else if ( vaiTaglio() );
412 else if ( vaiBriscolaAlta() );
413 else if ( vaiCarico() );
414 } else if ( haMessoAsso() ) {
415 if ( vaiLiscio() );
416 else if ( vaiPunti() );
417 else if ( vaiTaglio() );
418 else if ( vaiBriscolaAlta() );
419 else if ( vaiCarico() );
420 else if ( vaiTre() );
421 } else if ( haCaricato() ) {
422 if ( vaiSopra() );
423 else if ( vaiTre() );
424 else if ( vaiBriscolaAlta() );
425 else if ( vaiAsso() );
426 else if ( vaiTaglio() );
427 else if ( vaiLiscio() );
428 else if ( vaiPunti() );
429 else if ( vaiCarico() );
430 }
431 }
432 } else {
433 if ( vaiTre() );
434 else if ( vaiBriscolaAlta() );
435 else if ( vaiAsso() );
436 else if ( vaiTaglio() );
437 else if ( vaiLiscio() );
438 else if ( vaiPunti() );
439 else if ( vaiCarico() );
440 }
441 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
442 frame.carteCPU[cartaDaGiocare] = null;
443 frame.pannello.repaint();
444 CPUHaGiocato = true;
445 if ( frame.giocata[0] == null )
446 toccaAllaCPU = false;
447 }
448 public void chiPrende() {
449 char aux[], auxCPU[];
450 aux = frame.giocata[0].toString().toCharArray();
451 auxCPU = frame.giocata[1].toString().toCharArray();
452 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
453 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
454 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
455 }
456 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
457 int a, b;
458 switch ( prima ) {
459 case 0:
460 a = 10;
461 break;
462 case 1:
463 a = 12;
464 break;
465 case 3:
466 a = 11;
467 break;
468 default:
469 a = prima;
470 break;
471 }
472 switch ( seconda ) {
473 case 0:
474 b = 10;
475 break;
476 case 1:
477 b = 12;
478 break;
479 case 3:
480 b = 11;
481 break;
482 default:
483 b = seconda;
484 break;
485 }
486 return a > b;
487 }
488 public void giocatorePrende( boolean giocatore ) {
489 if ( giocatore ) {
490 toccaAllaCPU = CPUHaGiocato = false;
491 haGiocatoPrima = true;
492 }
493 else {
494 toccaAllaCPU = true;
495 CPUHaGiocato = haGiocatoPrima = false;
496 }
497 daiPunti( giocatore );
498 if ( toccaAllaCPU )
499 giocaCPU();
500 }
501 public void daiPunti( boolean giocatore ) {
502 char aux[], auxCPU[];
503 aux = frame.giocata[0].toString().toCharArray();
504 auxCPU = frame.giocata[1].toString().toCharArray();
505 int punti = 0;
506 switch( aux[aux.length-7] - 48 ) {
507 case 0:
508 punti += 4;
509 break;
510 case 1:
511 punti += 11;
512 break;
513 case 3:
514 punti += 10;
515 break;
516 case 8:
517 punti += 2;
518 break;
519 case 9:
520 punti += 3;
521 break;
522 default:
523 break;
524 }
525 switch( auxCPU[auxCPU.length-7] - 48 ) {
526 case 0:
527 punti += 4;
528 break;
529 case 1:
530 punti += 11;
531 break;
532 case 3:
533 punti += 10;
534 break;
535 case 8:
536 punti += 2;
537 break;
538 case 9:
539 punti += 3;
540 break;
541 default:
542 break;
543 }
544 frame.giocata[0] = frame.giocata[1] = null;
545 if ( giocatore ) {
546 punteggio += punti;
547 if ( mano < 18 ) {
548 if ( frame.carteInMano[0] == null )
549 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
550 if ( frame.carteInMano[1] == null )
551 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
552 if ( frame.carteInMano[2] == null )
553 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
554 cartaDaPescare++;
555 if ( frame.carteCPU[0] == null )
556 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
557 if ( frame.carteCPU[1] == null )
558 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
559 if ( frame.carteCPU[2] == null )
560 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
561 cartaDaPescare++;
562 }
563 }
564 else {
565 punteggioCPU += punti;
566 if ( mano < 18 ) {
567 if ( frame.carteCPU[0] == null )
568 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
569 if ( frame.carteCPU[1] == null )
570 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
571 if ( frame.carteCPU[2] == null )
572 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
573 cartaDaPescare++;
574 if ( frame.carteInMano[0] == null )
575 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
576 if ( frame.carteInMano[1] == null )
577 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
578 if ( frame.carteInMano[2] == null )
579 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
580 cartaDaPescare++;
581 }
582 }
583 frame.pannello.repaint();
584 frame.repaint();
585 }
586 public boolean haLisciato() {
587 char auxCPU[];
588 auxCPU = frame.giocata[0].toString().toCharArray();
589 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
590 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
591 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
592 }
593 public boolean haMessoPunti() {
594 char auxCPU[];
595 auxCPU = frame.giocata[0].toString().toCharArray();
596 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
597 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
598 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
599 }
600 public boolean haTagliato() {
601 char auxCPU[];
602 auxCPU = frame.giocata[0].toString().toCharArray();
603 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
604 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
605 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
606 }
607 public boolean haMessoBriscolaAlta() {
608 char auxCPU[];
609 auxCPU = frame.giocata[0].toString().toCharArray();
610 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
611 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
612 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
613 }
614 public boolean haMessoTre() {
615 char auxCPU[];
616 auxCPU = frame.giocata[0].toString().toCharArray();
617 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
618 (auxCPU[auxCPU.length-7] - 48 == 3) );
619 }
620 public boolean haMessoAsso() {
621 char auxCPU[];
622 auxCPU = frame.giocata[0].toString().toCharArray();
623 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
624 (auxCPU[auxCPU.length-7] - 48 == 1) );
625 }
626 public boolean haCaricato() {
627 char auxCPU[];
628 auxCPU = frame.giocata[0].toString().toCharArray();
629 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
630 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
631 }
632 public boolean vaiLiscio() {
633 char auxCPU[];
634 for ( int i = 0; i < 3; i++ ) {
635 if ( frame.carteCPU[i] != null ) {
636 auxCPU = frame.carteCPU[i].toString().toCharArray();
637 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
638 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
639 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
640 cartaDaGiocare = i;
641 return true;
642 }
643 }
644 }
645 return false;
646 }
647 public boolean vaiPunti() {
648 char[] auxCPU;
649 for ( int i = 0; i < 3; i++ ) {
650 if ( frame.carteCPU[i] != null ) {
651 auxCPU = frame.carteCPU[i].toString().toCharArray();
652 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
653 cartaDaGiocare = i;
654 return true;
655 }
656 }
657 }
658 for ( int i = 0; i < 3; i++ ) {
659 if ( frame.carteCPU[i] != null ) {
660 auxCPU = frame.carteCPU[i].toString().toCharArray();
661 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
662 cartaDaGiocare = i;
663 return true;
664 }
665 }
666 }
667 for ( int i = 0; i < 3; i++ ) {
668 if ( frame.carteCPU[i] != null ) {
669 auxCPU = frame.carteCPU[i].toString().toCharArray();
670 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
671 cartaDaGiocare = i;
672 return true;
673 }
674 }
675 }
676 return false;
677 }
678 public boolean vaiTaglio() {
679 char auxCPU[];
680 for ( int i = 0; i < 3; i++ ) {
681 if ( frame.carteCPU[i] != null ) {
682 auxCPU = frame.carteCPU[i].toString().toCharArray();
683 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
684 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
685 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
686 cartaDaGiocare = i;
687 return true;
688 }
689 }
690 }
691 return false;
692 }
693 public boolean vaiBriscolaAlta() {
694 char[] auxCPU;
695 for ( int i = 0; i < 3; i++ ) {
696 if ( frame.carteCPU[i] != null ) {
697 auxCPU = frame.carteCPU[i].toString().toCharArray();
698 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
699 cartaDaGiocare = i;
700 return true;
701 }
702 }
703 }
704 for ( int i = 0; i < 3; i++ ) {
705 if ( frame.carteCPU[i] != null ) {
706 auxCPU = frame.carteCPU[i].toString().toCharArray();
707 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
708 cartaDaGiocare = i;
709 return true;
710 }
711 }
712 }
713 for ( int i = 0; i < 3; i++ ) {
714 if ( frame.carteCPU[i] != null ) {
715 auxCPU = frame.carteCPU[i].toString().toCharArray();
716 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
717 cartaDaGiocare = i;
718 return true;
719 }
720 }
721 }
722 return false;
723 }
724 public boolean vaiTre() {
725 char auxCPU[];
726 for ( int i = 0; i < 3; i++ ) {
727 if ( frame.carteCPU[i] != null ) {
728 auxCPU = frame.carteCPU[i].toString().toCharArray();
729 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
730 cartaDaGiocare = i;
731 return true;
732 }
733 }
734 }
735 return false;
736 }
737 public boolean vaiAsso() {
738 char auxCPU[];
739 for ( int i = 0; i < 3; i++ ) {
740 if ( frame.carteCPU[i] != null ) {
741 auxCPU = frame.carteCPU[i].toString().toCharArray();
742 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
743 cartaDaGiocare = i;
744 return true;
745 }
746 }
747 }
748 return false;
749 }
750 public boolean vaiCarico() {
751 char[] auxCPU;
752 for ( int i = 0; i < 3; i++ ) {
753 if ( frame.carteCPU[i] != null ) {
754 auxCPU = frame.carteCPU[i].toString().toCharArray();
755 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
756 cartaDaGiocare = i;
757 return true;
758 }
759 }
760 }
761 for ( int i = 0; i < 3; i++ ) {
762 if ( frame.carteCPU[i] != null ) {
763 auxCPU = frame.carteCPU[i].toString().toCharArray();
764 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
765 cartaDaGiocare = i;
766 return true;
767 }
768 }
769 }
770 return false;
771 }
772 public boolean vaiSopra() {
773 if ( frame.giocata[0] == null )
774 return false;
775 int a = -1;
776 int b = -1;
777 int c = -1;
778 boolean laPrimaPuoAndareSopra = false;
779 boolean laSecondaPuoAndareSopra = false;
780 boolean laTerzaPuoAndareSopra = false;
781 char[] auxCPU1 = new char[1024];
782 char[] auxCPU2 = new char[1024];
783 char[] auxCPU3 = new char[1024];
784 char[] aux = frame.giocata[0].toString().toCharArray();
785 if ( aux[aux.length-7] - 48 == 1 )
786 return false;
787 if ( frame.carteCPU[0] != null ) {
788 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
789 a = auxCPU1[auxCPU1.length-7] - 48;
790 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
791 laPrimaPuoAndareSopra = true;
792 }
793 if ( frame.carteCPU[1] != null ) {
794 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
795 b = auxCPU2[auxCPU2.length-7] - 48;
796 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
797 laSecondaPuoAndareSopra = true;
798 }
799 if ( frame.carteCPU[2] != null ) {
800 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
801 c = auxCPU3[auxCPU3.length-7] - 48;
802 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
803 laTerzaPuoAndareSopra = true;
804 }
805 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
806 return false;
807 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
808 cartaDaGiocare = 0;
809 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
810 cartaDaGiocare = 1;
811 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
812 cartaDaGiocare = 2;
813 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
814 if ( laPrimaEPiuAlta( a, b ) )
815 cartaDaGiocare = 0;
816 else
817 cartaDaGiocare = 1;
818 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
819 if ( laPrimaEPiuAlta( b, c ) )
820 cartaDaGiocare = 1;
821 else
822 cartaDaGiocare = 2;
823 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
824 if ( laPrimaEPiuAlta( a, c ) )
825 cartaDaGiocare = 0;
826 else
827 cartaDaGiocare = 2;
828 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
829 if ( laPrimaEPiuAlta( a, b ) )
830 if ( laPrimaEPiuAlta( a, c ) )
831 cartaDaGiocare = 0;
832 else
833 cartaDaGiocare = 2;
834 else
835 if ( laPrimaEPiuAlta( b, c ) )
836 cartaDaGiocare = 1;
837 else
838 cartaDaGiocare = 2;
839 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
840 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
841 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
842 return false;
843 return true;
844 }
845 public boolean hoCarico() {
846 char auxCPU[];
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) &&
851 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
852 return true;
853 }
854 }
855 }
856 return false;
857 }
858 public boolean hoAsso() {
859 char auxCPU[];
860 for ( int i = 0; i < 3; i++ ) {
861 if ( frame.carteCPU[i] != null ) {
862 auxCPU = frame.carteCPU[i].toString().toCharArray();
863 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
864 return true;
865 }
866 }
867 }
868 return false;
869 }
870 public boolean hoTre() {
871 char auxCPU[];
872 for ( int i = 0; i < 3; i++ ) {
873 if ( frame.carteCPU[i] != null ) {
874 auxCPU = frame.carteCPU[i].toString().toCharArray();
875 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
876 return true;
877 }
878 }
879 }
880 return false;
881 }
882 public boolean hoBriscolaAlta() {
883 char auxCPU[];
884 for ( int i = 0; i < 3; i++ ) {
885 if ( frame.carteCPU[i] != null ) {
886 auxCPU = frame.carteCPU[i].toString().toCharArray();
887 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
888 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
889 return true;
890 }
891 }
892 }
893 return false;
894 }
895 public boolean hoTaglio() {
896 char auxCPU[];
897 for ( int i = 0; i < 3; i++ ) {
898 if ( frame.carteCPU[i] != null ) {
899 auxCPU = frame.carteCPU[i].toString().toCharArray();
900 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
901 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
902 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
903 return true;
904 }
905 }
906 }
907 return false;
908 }
909 public static void settaOpzioni() {
910 lang = "it";
911 soundString = "suono=si";
912 int r = 0;
913 int g = 150;
914 int b = 0;
915 Scanner scanner = null;
916 File file = new File( "JBriscolaConfig.txt" );
917 if ( file.exists() ) {
918 try {
919 scanner = new Scanner( file );
920 } catch ( FileNotFoundException e ) { }
921 try {
922 lang = scanner.next();
923 soundString = scanner.next();
924 r = scanner.nextInt();
925 g = scanner.nextInt();
926 b = scanner.nextInt();
927 } catch ( NoSuchElementException e ) { }
928 }
929 else {
930 lang = "it";
931 soundString = "suono=si";
932 r = 0;
933 g = 150;
934 b = 0;
935 }
936 if ( lang.equals( "it" ) ) {
937 stringaBottonePrendi = "Prendi/Lascia carte";
938 stringaPrimaGioca = "Prima Gioca!";
939 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
940 stringaVinto = "Hai Vinto!";
941 stringaPerso = "Hai Perso";
942 stringaPareggio = "Pareggio";
943 stringaGiocatore = "Giocatore: ";
944 stringaComputer = "\nComputer: ";
945 stringaNuovaPartita = "Nuova Partita";
946 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
947 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
948 stringaSi = "Si";
949 stringaNo = "No";
950 stringaOpzioni = "Opzioni...";
951 stringaEsci = "Esci";
952 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
953 stringaLingua = "Lingua";
954 stringaAnnulla = "Annulla";
955 stringaIt = "Italiano";
956 stringaLa = "Latino";
957 stringaBL = "Dialetto Bellunese";
958 stringaBV = "Dialetto Basso Veneto";
959 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
960 stringaModificaOpzioni = "Modifica Opzioni";
961 stringaInformazioni = "Informazioni";
962 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";
963 stringaSuono = "Effetti sonori";
964 stringaPunteggio = "Punteggio";
965 stringaSfondo = "Sfondo";
966 }
967 else if ( lang.equals( "la" ) ) {
968 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
969 stringaPrimaGioca = "ANTE CHARTAM PONE!";
970 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
971 stringaVinto = "VICISTI!";
972 stringaPerso = "PERDIDISTI";
973 stringaPareggio = "AEQVATIO!";
974 stringaGiocatore = "LVSOR: ";
975 stringaComputer = "\nCOMPVTER: ";
976 stringaNuovaPartita = "NOVA LVSO";
977 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
978 stringaVuoiDavveroUscire = "EXIRE?";
979 stringaSi = "ID VOLO";
980 stringaNo = "NOLO";
981 stringaOpzioni = "OPTIONES...";
982 stringaEsci = "EXIRE";
983 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
984 stringaLingua = "LINGVA";
985 stringaAnnulla = "ABROGA";
986 stringaIt = "ITALICA";
987 stringaLa = "LATINA";
988 stringaBL = "BELLUNI";
989 stringaBV = "VENETIAE";
990 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
991 stringaModificaOpzioni = "OPTIONES NOVARE";
992 stringaInformazioni = "INFORMATIONES";
993 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";
994 stringaSuono = "SONUS";
995 stringaPunteggio = "NUMERI";
996 stringaSfondo = "COLOR";
997 }
998 if ( lang.equals( "bl" ) ) {
999 stringaBottonePrendi = "Cio' su/lasa le carte";
1000 stringaPrimaGioca = "Prima Duga!";
1001 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1002 stringaVinto = "Te ha vint!";
1003 stringaPerso = "Te ha pers";
1004 stringaPareggio = "Pari";
1005 stringaGiocatore = "Dugador: ";
1006 stringaComputer = "\nComputer: ";
1007 stringaNuovaPartita = "Taca n'altra partida";
1008 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1009 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1010 stringaSi = "Si";
1011 stringaNo = "No";
1012 stringaOpzioni = "Opzioni...";
1013 stringaEsci = "Stusa su";
1014 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1015 stringaLingua = "Lengua";
1016 stringaAnnulla = "Annulla";
1017 stringaIt = "Italian";
1018 stringaLa = "Latin";
1019 stringaBL = "Dialeto de Belun";
1020 stringaBV = "Dialeto de la basa";
1021 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
1022 stringaModificaOpzioni = "Modifica Opzioni";
1023 stringaInformazioni = "Informazioni";
1024 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";
1025 stringaSuono = "Efeti sonori";
1026 stringaPunteggio = "Varda i punti";
1027 stringaSfondo = "Sfondo";
1028 }
1029 if ( lang.equals( "bv" ) ) {
1030 stringaBottonePrendi = "Ciapa su/lasa e carte";
1031 stringaPrimaGioca = "Prima Zuga!";
1032 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1033 stringaVinto = "Ti ga vinto!";
1034 stringaPerso = "Ti ga perso";
1035 stringaPareggio = "Pari";
1036 stringaGiocatore = "Zugador: ";
1037 stringaComputer = "\nComputer: ";
1038 stringaNuovaPartita = "N'altra Partida";
1039 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1040 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1041 stringaSi = "Si";
1042 stringaNo = "No";
1043 stringaOpzioni = "Opzioni...";
1044 stringaEsci = "Stusa su";
1045 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1046 stringaLingua = "Lengua";
1047 stringaAnnulla = "Annulla";
1048 stringaIt = "Italian";
1049 stringaLa = "Latin";
1050 stringaBL = "Dialeto Belumat";
1051 stringaBV = "Dialeto Veneto";
1052 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
1053 stringaModificaOpzioni = "Modifica Opzioni";
1054 stringaInformazioni = "Informasioni";
1055 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";
1056 stringaSuono = "Efeti sonori";
1057 stringaPunteggio = "Varda i punti";
1058 stringaSfondo = "Sfondo";
1059 }
1060 sound = ( soundString.equals( "suono=si" ) );
1061 color = new Color( r, g, b );
1062 if ( frame != null ) {
1063 frame.pannello.repaint();
1064 frame.pannello2.repaint();
1065 frame.repaint();
1066 }
1067 }
1068}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2 Beta 1/src/OptionFrame.java
new file mode 100755
index 0000000..a93899f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/OptionFrame.java
@@ -0,0 +1,129 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono;
34 public static JPanel[] pannello = new JPanel[5];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 formatter.format( lang );
69 formatter.format( "\n" );
70 formatter.format( suonosiono );
71 formatter.format( "\n" );
72 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
73 formatter.close();
74 main.settaOpzioni();
75 OptionFrame.this.dispose();
76 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
77 }
78 });
79 annulla = new JButton( main.stringaAnnulla );
80 annulla.addActionListener( new ActionListener() {
81 public void actionPerformed( ActionEvent e ) {
82 OptionFrame.this.dispose();
83 }
84 });
85 scegliColore = new JButton( " " );
86 scegliColore.setBackground( main.color );
87 scegliColore.addActionListener( new ActionListener() {
88 public void actionPerformed( ActionEvent e ) {
89 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
90 if ( colore != null )
91 main.color = colore;
92 OptionFrame.scegliColore.setBackground( main.color );
93 }
94 } );
95 lingua = new JLabel( main.stringaLingua );
96 sfondo = new JLabel( main.stringaSfondo );
97 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
98 selezionaLingua = new JComboBox( lingueDaSelezionare );
99 int linguaPreselezionata = 0;
100 if ( main.lang.equals( "it" ) )
101 linguaPreselezionata = 0;
102 else if ( main.lang.equals( "la" ) )
103 linguaPreselezionata = 1;
104 else if ( main.lang.equals( "bl" ) )
105 linguaPreselezionata = 2;
106 else if ( main.lang.equals( "bv" ) )
107 linguaPreselezionata = 3;
108 selezionaLingua.setSelectedIndex( linguaPreselezionata );
109 suono = new JCheckBox( main.stringaSuono );
110 suono.setSelected( main.sound );
111 pannello[0] = new JPanel( new GridLayout( 3, 1 ) );
112 pannello[1] = new JPanel( new FlowLayout() );
113 pannello[2] = new JPanel( new FlowLayout() );
114 pannello[3] = new JPanel( new FlowLayout() );
115 pannello[4] = new JPanel( new FlowLayout() );
116 pannello[4].add( ok );
117 pannello[4].add( annulla );
118 pannello[3].add( sfondo );
119 pannello[3].add( scegliColore );
120 pannello[2].add( suono );
121 pannello[1].add( lingua );
122 pannello[1].add( selezionaLingua );
123 pannello[0].add( pannello[1] );
124 pannello[0].add( pannello[2] );
125 pannello[0].add( pannello[3] );
126 add( pannello[0], BorderLayout.CENTER );
127 add( pannello[4], BorderLayout.SOUTH );
128 }
129}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/Pannello.java b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Pannello.java
new file mode 100755
index 0000000..24c6596
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/Pannello.java
@@ -0,0 +1,54 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public static Color color;
28 public Pannello() { }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 setBackground( main.color );
32 if ( main.frame.ultimaCarta != null )
33 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
34 if ( main.frame.mazzo )
35 main.frame.retro2.paintIcon( this, g, 17, 256 );
36 if ( main.frame.carteCPU[0] != null )
37 main.frame.retro1.paintIcon( this, g, 230, 5 );
38 if ( main.frame.carteCPU[1] != null )
39 main.frame.retro1.paintIcon( this, g, 300, 5 );
40 if ( main.frame.carteCPU[2] != null )
41 main.frame.retro1.paintIcon( this, g, 370, 5 );
42 if ( main.frame.carteInMano[0] != null )
43 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
44 if ( main.frame.carteInMano[1] != null )
45 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
46 if ( main.frame.carteInMano[2] != null )
47 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
48 if ( main.frame.giocata[0] != null )
49 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
50 if ( main.frame.giocata[1] != null )
51 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
52 }
53}
54
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 1/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/Frame.java b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Frame.java
new file mode 100755
index 0000000..c7b6c36
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Frame.java
@@ -0,0 +1,243 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.awt.*;
26import java.awt.event.*;
27
28public class Frame extends JFrame {
29 public static boolean mazzo;
30 public static Main main;
31 public static Pannello pannello;
32 public static JPanel pannello2;
33 public static JButton button;
34 public static JMenuBar barraMenu;
35 public static JMenu file, puntoInterrogativo;
36 public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti;
37 public static ImageIcon retro1, retro2, ultimaCarta;
38 public static ImageIcon[] giocata = new ImageIcon[2];
39 public static ImageIcon[] carteInMano = new ImageIcon[3];
40 public static ImageIcon[] carteCPU = new ImageIcon[3];
41 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
42 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
43 public Frame() {
44 super( "Tronto's JBriscola " + main.version );
45 mazzo = true;
46 main = new Main();
47 pannello = new Pannello();
48 pannello2 = new JPanel( new FlowLayout() );
49 button = new JButton( main.stringaBottonePrendi );
50 button.addActionListener( new ActionListener() {
51 public void actionPerformed( ActionEvent e ) {
52 if ( giocata[0] != null && giocata[1] != null )
53 main.mano++;
54 try {
55 main.chiPrende();
56 } catch ( Exception ex ) {
57 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
58 }
59 if ( main.mano == 16 )
60 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
61 if ( main.mano == 17 ) {
62 mazzo = false;
63 ultimaCarta = null;
64 pannello.repaint();
65 Frame.this.repaint();
66 }
67 if ( main.mano == 20 ) {
68 String titolo = "";
69 String suonoFinale = "";
70 if ( main.punteggio > main.punteggioCPU ) {
71 titolo = main.stringaVinto;
72 suonoFinale = "sounds/perso.wav";
73 }
74 if ( main.punteggio < main.punteggioCPU ) {
75 titolo = main.stringaPerso;
76 suonoFinale = "sounds/vinto.wav";
77 }
78 if ( main.punteggio == main.punteggioCPU ) {
79 titolo = main.stringaPareggio;
80 suonoFinale = "sounds/pareggio.wav";
81 }
82 if ( main.sound ) {
83 try {
84 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
85 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
86 AudioFormat af = aff.getFormat();
87 DataLine.Info info = new DataLine.Info(
88 Clip.class,
89 ais.getFormat(),
90 ( (int) ais.getFrameLength() *
91 af.getFrameSize() ) );
92 Clip ol = ( Clip ) AudioSystem.getLine( info );
93 ol.open(ais);
94 ol.loop( 0 );
95 } catch ( Exception ex ) {
96 System.err.println( e );
97 }
98 }
99 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
100 }
101 }
102 } );
103 barraMenu = new JMenuBar();
104 file = new JMenu( "File" );
105 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
106 nuovaPartita.addActionListener( new ActionListener() {
107 public void actionPerformed( ActionEvent e ) {
108 if ( main.mano == 20 ) {
109 main.mischia();
110 pannello.repaint();
111 repaint();
112 }
113 else {
114 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 );
115 if ( selezione == JOptionPane.YES_OPTION ) {
116 main.mischia();
117 pannello.repaint();
118 repaint();
119 }
120 }
121 }
122 });
123 opzioni = new JMenuItem( main.stringaOpzioni );
124 opzioni.addActionListener( new ActionListener() {
125 public void actionPerformed( ActionEvent e ) {
126 OptionFrame optionFrame = new OptionFrame();
127 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
128 optionFrame.setResizable( false );
129 optionFrame.setAlwaysOnTop( true );
130 optionFrame.setSize( 300, 150 );
131 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
132 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
133 optionFrame.setVisible( true );
134 }
135 });
136 esci = new JMenuItem( main.stringaEsci );
137 esci.addActionListener( new ActionListener() {
138 public void actionPerformed( ActionEvent e ) {
139 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 );
140 if ( selezione == JOptionPane.YES_OPTION )
141 Frame.this.dispose();
142 }
143 });
144 file.add( nuovaPartita );
145 file.add( opzioni );
146 file.addSeparator();
147 file.add( esci );
148 puntoInterrogativo = new JMenu( "?" );
149 informazioni = new JMenuItem( main.stringaInformazioni );
150 informazioni.addActionListener( new ActionListener() {
151 public void actionPerformed( ActionEvent e ) {
152 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
153 }
154 } );
155 punti = new JMenuItem( main.stringaPunteggio );
156 punti.addActionListener( new ActionListener() {
157 public void actionPerformed( ActionEvent e ) {
158 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
159 }
160 } );
161 puntoInterrogativo.add( punti );
162 puntoInterrogativo.add( informazioni );
163 barraMenu.add( file );
164 barraMenu.add( puntoInterrogativo );
165 setJMenuBar( barraMenu );
166 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
167 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
168 for (int i = 0; i < 10; i++)
169 for (int j = 0; j < 4; j++)
170 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
171 main.mischia();
172 pannello2.add( button );
173 setLayout( new BorderLayout() );
174 add( pannello, BorderLayout.CENTER );
175 add( pannello2, BorderLayout.SOUTH );
176 addMouseListener(
177 new MouseAdapter() {
178 public void mouseClicked ( MouseEvent e ) {
179 if ( mettiCarta( e.getX(), e.getY() ) ) {
180 if ( !main.CPUHaGiocato )
181 main.giocaCPU();
182 }
183 }
184 }
185 );
186 addWindowListener(
187 new WindowAdapter() {
188 public void windowClosing( WindowEvent e ) {
189 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 );
190 if ( selezione == JOptionPane.YES_OPTION )
191 System.exit( 0 );
192 }
193 }
194 );
195 }
196 public boolean mettiCarta( int x, int y ) {
197 if ( !main.toccaAllaCPU && giocata[0] == null ) {
198 if ( main.sound &&
199 ( ( x > 230 && x < 290 && y > 340 && y < 566 ) ||
200 ( x > 300 && x < 360 && y > 340 && y < 566 ) ||
201 ( x > 370 && x < 430 && y > 340 && y < 566 ) ) ) {
202 try {
203 double a = Math.random() * 6;
204 int i = (int) a;
205 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
206 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
207 AudioFormat af = aff.getFormat();
208 DataLine.Info info = new DataLine.Info(
209 Clip.class,
210 ais.getFormat(),
211 ( (int) ais.getFrameLength() *
212 af.getFrameSize() ) );
213 Clip ol = ( Clip ) AudioSystem.getLine( info );
214 ol.open(ais);
215 ol.loop( 0 );
216 } catch ( Exception e ) {
217 System.err.println( e );
218 }
219 }
220 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
221 giocata[0] = carteInMano[0];
222 carteInMano[0] = null;
223 pannello.repaint();
224 return true;
225 }
226 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
227 giocata[0] = carteInMano[1];
228 carteInMano[1] = null;
229 pannello.repaint();
230 return true;
231 }
232 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
233 giocata[0] = carteInMano[2];
234 carteInMano[2] = null;
235 pannello.repaint();
236 return true;
237 }
238 }
239 return false;
240 }
241}
242
243
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/Main.java b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Main.java
new file mode 100755
index 0000000..344fa20
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Main.java
@@ -0,0 +1,1069 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static boolean sound = true;
33 public static Frame frame;
34 public static Color color = new Color( 0, 150, 0 );
35 public static String version = "0.2 Beta 2";
36 public static String stringaBottonePrendi = "Prendi/Lascia carte";
37 public static String stringaPrimaGioca = "Prima Gioca!";
38 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
39 public static String stringaVinto = "Hai Vinto!";
40 public static String stringaPerso = "Hai Perso";
41 public static String stringaPareggio = "Pareggio";
42 public static String stringaGiocatore = "Giocatore: ";
43 public static String stringaComputer = "\nComputer: ";
44 public static String stringaNuovaPartita = "Nuova Partita";
45 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
46 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
47 public static String stringaSi = "Si";
48 public static String stringaNo = "No";
49 public static String stringaOpzioni = "Opzioni...";
50 public static String stringaEsci = "Esci";
51 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
52 public static String stringaLingua = "Lingua";
53 public static String stringaAnnulla = "Annulla";
54 public static String stringaIt = "Italiano";
55 public static String stringaLa = "Latino";
56 public static String stringaBL = "Dialetto Bellunese";
57 public static String stringaBV = "Dialetto Basso Veneto";
58 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
59 public static String stringaModificaOpzioni = "Modifica Opzioni";
60 public static String stringaInformazioni = "Informazioni";
61 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";
62 public static String stringaSuono = "Effetti Sonori";
63 public static String stringaPunteggio = "Punteggio";
64 public static String stringaSfondo = "Sfondo";
65 public static String lang, soundString;
66 public static File[] suoni = new File[6];
67 public static File suonoVinto, suonoPerso, suonoPareggio;
68 public static void main( String args[] ) {
69 settaOpzioni();
70 frame = new Frame();
71 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
72 frame.setResizable( false );
73 frame.setSize( 600, 600 );
74 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
75 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
76 frame.setVisible( true );
77 }
78 public void mischia() {
79 mano = 0;
80 punteggio = 0;
81 punteggioCPU = 0;
82 cartaDaPescare = 6;
83 ImageIcon aux;
84 frame.mazzo = true;
85 toccaAllaCPU = false;
86 CPUHaGiocato = false;
87 haGiocatoPrima = true;
88 for ( int i = 0, k = 0; i < 10; i++ )
89 for ( int j = 0; j < 4; j++, k++ )
90 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
91 for ( int i = 0; i < 391; i++ ) {
92 double a = Math.random() * 40;
93 int x = (int) a;
94 double b = Math.random() * 40;
95 int y = (int) b;
96 aux = frame.arrayCarteMescolate[x];
97 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
98 frame.arrayCarteMescolate[y] = aux;
99 }
100 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
101 semeBriscola = auxChar[auxChar.length-5] - 49;
102 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
103 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
104 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
105 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
106 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
107 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
108 frame.ultimaCarta = frame.arrayCarteMescolate[39];
109 frame.giocata[0] = null;
110 frame.giocata[1] = null;
111 }
112 public void giocaCPU() {
113 if ( mano < 16 ) {
114 if ( frame.giocata[0] == null ) {
115 if ( vaiPunti() );
116 else if ( vaiLiscio() );
117 else if ( vaiTaglio() );
118 else if ( vaiBriscolaAlta() );
119 else if ( vaiCarico() );
120 else if ( vaiTre() );
121 else if ( vaiAsso() );
122 else;
123 }
124 else {
125 if ( haLisciato() ) {
126 if ( vaiSopra() );
127 else if ( vaiLiscio() );
128 else if ( vaiPunti() );
129 else if ( vaiTaglio() );
130 else if ( vaiTre() );
131 else if ( vaiBriscolaAlta() );
132 else if ( vaiCarico() );
133 else if ( vaiAsso() );
134 } else if ( haMessoPunti() ) {
135 if ( vaiSopra() );
136 else if ( vaiLiscio() );
137 else if ( vaiTaglio() );
138 else if ( vaiPunti() );
139 else if ( vaiTre() );
140 else if ( vaiBriscolaAlta() );
141 else if ( vaiCarico() );
142 else if ( vaiAsso() );
143 } else if ( haTagliato() ) {
144 if ( vaiLiscio() );
145 else if ( vaiPunti() );
146 else if ( vaiTaglio() );
147 else if ( vaiTre() );
148 else if ( vaiBriscolaAlta() );
149 else if ( vaiCarico() );
150 else if ( vaiAsso() );
151 } else if ( haMessoBriscolaAlta() ) {
152 if ( vaiLiscio() );
153 else if ( vaiPunti() );
154 else if ( vaiTre() );
155 else if ( vaiTaglio() );
156 else if ( vaiBriscolaAlta() );
157 else if ( vaiCarico() );
158 else if ( vaiAsso() );
159 } else if ( haMessoTre() ) {
160 if ( vaiAsso() );
161 else if ( vaiLiscio() );
162 else if ( vaiPunti() );
163 else if ( vaiTaglio() );
164 else if ( vaiBriscolaAlta() );
165 else if ( vaiCarico() );
166 } else if ( haMessoAsso() ) {
167 if ( vaiLiscio() );
168 else if ( vaiPunti() );
169 else if ( vaiTaglio() );
170 else if ( vaiBriscolaAlta() );
171 else if ( vaiCarico() );
172 else if ( vaiTre() );
173 } else if ( haCaricato() ) {
174 if ( vaiSopra() );
175 else if ( vaiTre() );
176 else if ( vaiBriscolaAlta() );
177 else if ( vaiAsso() );
178 else if ( vaiTaglio() );
179 else if ( vaiLiscio() );
180 else if ( vaiPunti() );
181 else if ( vaiCarico() );
182 }
183 }
184 }
185 else if ( mano == 16 ) {
186 if ( frame.giocata[0] == null ) {
187 char aux[];
188 aux = frame.ultimaCarta.toString().toCharArray();
189 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
190 if ( vaiCarico() );
191 else if ( vaiPunti() );
192 else if ( vaiLiscio() );
193 else if ( vaiTaglio() );
194 else if ( vaiBriscolaAlta() );
195 else if ( vaiTre() );
196 else if ( vaiAsso() );
197 else;
198 } else {
199 if ( vaiPunti() );
200 else if ( vaiLiscio() );
201 else if ( vaiTaglio() );
202 else if ( vaiBriscolaAlta() );
203 else if ( vaiCarico() );
204 else if ( vaiTre() );
205 else if ( vaiAsso() );
206 else;
207 }
208 }
209 else {
210 char aux[];
211 aux = frame.ultimaCarta.toString().toCharArray();
212 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
213 if ( haCaricato() ) {
214 if ( vaiSopra() );
215 else if ( vaiLiscio() );
216 else if ( vaiPunti() );
217 else if ( vaiTre() );
218 else if ( vaiTaglio() );
219 else if ( vaiBriscolaAlta() );
220 else if ( vaiAsso() );
221 else if ( vaiCarico() );
222 }
223 } else {
224 if ( haLisciato() ) {
225 if ( vaiSopra() );
226 else if ( vaiLiscio() );
227 else if ( vaiPunti() );
228 else if ( vaiTaglio() );
229 else if ( vaiTre() );
230 else if ( vaiBriscolaAlta() );
231 else if ( vaiCarico() );
232 else if ( vaiAsso() );
233 } else if ( haMessoPunti() ) {
234 if ( vaiSopra() );
235 else if ( vaiLiscio() );
236 else if ( vaiTaglio() );
237 else if ( vaiPunti() );
238 else if ( vaiTre() );
239 else if ( vaiBriscolaAlta() );
240 else if ( vaiCarico() );
241 else if ( vaiAsso() );
242 } else if ( haTagliato() ) {
243 if ( vaiLiscio() );
244 else if ( vaiPunti() );
245 else if ( vaiTaglio() );
246 else if ( vaiTre() );
247 else if ( vaiBriscolaAlta() );
248 else if ( vaiCarico() );
249 else if ( vaiAsso() );
250 } else if ( haMessoBriscolaAlta() ) {
251 if ( vaiLiscio() );
252 else if ( vaiPunti() );
253 else if ( vaiTre() );
254 else if ( vaiTaglio() );
255 else if ( vaiBriscolaAlta() );
256 else if ( vaiCarico() );
257 else if ( vaiAsso() );
258 } else if ( haMessoTre() ) {
259 if ( vaiAsso() );
260 else if ( vaiLiscio() );
261 else if ( vaiPunti() );
262 else if ( vaiTaglio() );
263 else if ( vaiBriscolaAlta() );
264 else if ( vaiCarico() );
265 } else if ( haMessoAsso() ) {
266 if ( vaiLiscio() );
267 else if ( vaiPunti() );
268 else if ( vaiTaglio() );
269 else if ( vaiBriscolaAlta() );
270 else if ( vaiCarico() );
271 else if ( vaiTre() );
272 } else if ( haCaricato() ) {
273 if ( vaiSopra() );
274 else if ( vaiTre() );
275 else if ( vaiBriscolaAlta() );
276 else if ( vaiAsso() );
277 else if ( vaiTaglio() );
278 else if ( vaiLiscio() );
279 else if ( vaiPunti() );
280 else if ( vaiCarico() );
281 }
282 }
283 }
284 } else if ( mano == 17 ) {
285 if ( frame.giocata[0] == null ) {
286 if ( hoAsso() ) {
287 if ( vaiTre() );
288 else if ( vaiBriscolaAlta() );
289 else if ( vaiTaglio() );
290 else if ( vaiLiscio() );
291 else if ( vaiPunti() );
292 else if ( vaiAsso() );
293 else if ( vaiCarico() );
294 } else {
295 if ( vaiLiscio() );
296 else if ( vaiPunti() );
297 else if ( vaiTaglio() );
298 else if ( vaiBriscolaAlta() );
299 else if ( vaiCarico() );
300 else if ( vaiTre() );
301 }
302 }
303 else {
304 if ( haLisciato() ) {
305 if ( vaiSopra() );
306 else if ( vaiLiscio() );
307 else if ( vaiPunti() );
308 else if ( vaiTaglio() );
309 else if ( vaiTre() );
310 else if ( vaiBriscolaAlta() );
311 else if ( vaiCarico() );
312 else if ( vaiAsso() );
313 } else if ( haMessoPunti() ) {
314 if ( vaiSopra() );
315 else if ( vaiLiscio() );
316 else if ( vaiTaglio() );
317 else if ( vaiPunti() );
318 else if ( vaiTre() );
319 else if ( vaiBriscolaAlta() );
320 else if ( vaiCarico() );
321 else if ( vaiAsso() );
322 } else if ( haTagliato() ) {
323 if ( vaiLiscio() );
324 else if ( vaiPunti() );
325 else if ( vaiTaglio() );
326 else if ( vaiTre() );
327 else if ( vaiBriscolaAlta() );
328 else if ( vaiCarico() );
329 else if ( vaiAsso() );
330 } else if ( haMessoBriscolaAlta() ) {
331 if ( vaiLiscio() );
332 else if ( vaiPunti() );
333 else if ( vaiTre() );
334 else if ( vaiTaglio() );
335 else if ( vaiBriscolaAlta() );
336 else if ( vaiCarico() );
337 else if ( vaiAsso() );
338 } else if ( haMessoTre() ) {
339 if ( vaiAsso() );
340 else if ( vaiLiscio() );
341 else if ( vaiPunti() );
342 else if ( vaiTaglio() );
343 else if ( vaiBriscolaAlta() );
344 else if ( vaiCarico() );
345 } else if ( haMessoAsso() ) {
346 if ( vaiLiscio() );
347 else if ( vaiPunti() );
348 else if ( vaiTaglio() );
349 else if ( vaiBriscolaAlta() );
350 else if ( vaiCarico() );
351 else if ( vaiTre() );
352 } else if ( haCaricato() ) {
353 if ( vaiSopra() );
354 else if ( vaiTre() );
355 else if ( vaiBriscolaAlta() );
356 else if ( vaiAsso() );
357 else if ( vaiTaglio() );
358 else if ( vaiLiscio() );
359 else if ( vaiPunti() );
360 else if ( vaiCarico() );
361 }
362 }
363 } else if ( mano == 18 ) {
364 if ( frame.giocata[0] == null ) {
365 if ( vaiAsso() );
366 else if ( vaiCarico() );
367 else if ( vaiBriscolaAlta() );
368 else if ( vaiTaglio() );
369 else if ( vaiPunti() );
370 else if ( vaiLiscio() );
371 else if ( vaiTre() );
372 }
373 else {
374 if ( haLisciato() ) {
375 if ( vaiSopra() );
376 else if ( vaiLiscio() );
377 else if ( vaiPunti() );
378 else if ( vaiTaglio() );
379 else if ( vaiTre() );
380 else if ( vaiBriscolaAlta() );
381 else if ( vaiCarico() );
382 else if ( vaiAsso() );
383 } else if ( haMessoPunti() ) {
384 if ( vaiSopra() );
385 else if ( vaiLiscio() );
386 else if ( vaiTaglio() );
387 else if ( vaiPunti() );
388 else if ( vaiTre() );
389 else if ( vaiBriscolaAlta() );
390 else if ( vaiCarico() );
391 else if ( vaiAsso() );
392 } else if ( haTagliato() ) {
393 if ( vaiLiscio() );
394 else if ( vaiPunti() );
395 else if ( vaiTaglio() );
396 else if ( vaiTre() );
397 else if ( vaiBriscolaAlta() );
398 else if ( vaiCarico() );
399 else if ( vaiAsso() );
400 } else if ( haMessoBriscolaAlta() ) {
401 if ( vaiLiscio() );
402 else if ( vaiPunti() );
403 else if ( vaiTre() );
404 else if ( vaiTaglio() );
405 else if ( vaiBriscolaAlta() );
406 else if ( vaiCarico() );
407 else if ( vaiAsso() );
408 } else if ( haMessoTre() ) {
409 if ( vaiAsso() );
410 else if ( vaiLiscio() );
411 else if ( vaiPunti() );
412 else if ( vaiTaglio() );
413 else if ( vaiBriscolaAlta() );
414 else if ( vaiCarico() );
415 } else if ( haMessoAsso() ) {
416 if ( vaiLiscio() );
417 else if ( vaiPunti() );
418 else if ( vaiTaglio() );
419 else if ( vaiBriscolaAlta() );
420 else if ( vaiCarico() );
421 else if ( vaiTre() );
422 } else if ( haCaricato() ) {
423 if ( vaiSopra() );
424 else if ( vaiTre() );
425 else if ( vaiBriscolaAlta() );
426 else if ( vaiAsso() );
427 else if ( vaiTaglio() );
428 else if ( vaiLiscio() );
429 else if ( vaiPunti() );
430 else if ( vaiCarico() );
431 }
432 }
433 } else {
434 if ( vaiTre() );
435 else if ( vaiBriscolaAlta() );
436 else if ( vaiAsso() );
437 else if ( vaiTaglio() );
438 else if ( vaiLiscio() );
439 else if ( vaiPunti() );
440 else if ( vaiCarico() );
441 }
442 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
443 frame.carteCPU[cartaDaGiocare] = null;
444 frame.pannello.repaint();
445 CPUHaGiocato = true;
446 if ( frame.giocata[0] == null )
447 toccaAllaCPU = false;
448 }
449 public void chiPrende() {
450 char aux[], auxCPU[];
451 aux = frame.giocata[0].toString().toCharArray();
452 auxCPU = frame.giocata[1].toString().toCharArray();
453 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
454 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
455 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
456 }
457 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
458 int a, b;
459 switch ( prima ) {
460 case 0:
461 a = 10;
462 break;
463 case 1:
464 a = 12;
465 break;
466 case 3:
467 a = 11;
468 break;
469 default:
470 a = prima;
471 break;
472 }
473 switch ( seconda ) {
474 case 0:
475 b = 10;
476 break;
477 case 1:
478 b = 12;
479 break;
480 case 3:
481 b = 11;
482 break;
483 default:
484 b = seconda;
485 break;
486 }
487 return a > b;
488 }
489 public void giocatorePrende( boolean giocatore ) {
490 if ( giocatore ) {
491 toccaAllaCPU = CPUHaGiocato = false;
492 haGiocatoPrima = true;
493 }
494 else {
495 toccaAllaCPU = true;
496 CPUHaGiocato = haGiocatoPrima = false;
497 }
498 daiPunti( giocatore );
499 if ( toccaAllaCPU )
500 giocaCPU();
501 }
502 public void daiPunti( boolean giocatore ) {
503 char aux[], auxCPU[];
504 aux = frame.giocata[0].toString().toCharArray();
505 auxCPU = frame.giocata[1].toString().toCharArray();
506 int punti = 0;
507 switch( aux[aux.length-7] - 48 ) {
508 case 0:
509 punti += 4;
510 break;
511 case 1:
512 punti += 11;
513 break;
514 case 3:
515 punti += 10;
516 break;
517 case 8:
518 punti += 2;
519 break;
520 case 9:
521 punti += 3;
522 break;
523 default:
524 break;
525 }
526 switch( auxCPU[auxCPU.length-7] - 48 ) {
527 case 0:
528 punti += 4;
529 break;
530 case 1:
531 punti += 11;
532 break;
533 case 3:
534 punti += 10;
535 break;
536 case 8:
537 punti += 2;
538 break;
539 case 9:
540 punti += 3;
541 break;
542 default:
543 break;
544 }
545 frame.giocata[0] = frame.giocata[1] = null;
546 if ( giocatore ) {
547 punteggio += punti;
548 if ( mano < 18 ) {
549 if ( frame.carteInMano[0] == null )
550 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
551 if ( frame.carteInMano[1] == null )
552 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
553 if ( frame.carteInMano[2] == null )
554 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
555 cartaDaPescare++;
556 if ( frame.carteCPU[0] == null )
557 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
558 if ( frame.carteCPU[1] == null )
559 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
560 if ( frame.carteCPU[2] == null )
561 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
562 cartaDaPescare++;
563 }
564 }
565 else {
566 punteggioCPU += punti;
567 if ( mano < 18 ) {
568 if ( frame.carteCPU[0] == null )
569 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
570 if ( frame.carteCPU[1] == null )
571 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
572 if ( frame.carteCPU[2] == null )
573 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
574 cartaDaPescare++;
575 if ( frame.carteInMano[0] == null )
576 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
577 if ( frame.carteInMano[1] == null )
578 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
579 if ( frame.carteInMano[2] == null )
580 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
581 cartaDaPescare++;
582 }
583 }
584 frame.pannello.repaint();
585 frame.repaint();
586 }
587 public boolean haLisciato() {
588 char auxCPU[];
589 auxCPU = frame.giocata[0].toString().toCharArray();
590 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
591 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
592 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
593 }
594 public boolean haMessoPunti() {
595 char auxCPU[];
596 auxCPU = frame.giocata[0].toString().toCharArray();
597 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
598 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
599 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
600 }
601 public boolean haTagliato() {
602 char auxCPU[];
603 auxCPU = frame.giocata[0].toString().toCharArray();
604 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
605 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
606 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
607 }
608 public boolean haMessoBriscolaAlta() {
609 char auxCPU[];
610 auxCPU = frame.giocata[0].toString().toCharArray();
611 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
612 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
613 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
614 }
615 public boolean haMessoTre() {
616 char auxCPU[];
617 auxCPU = frame.giocata[0].toString().toCharArray();
618 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
619 (auxCPU[auxCPU.length-7] - 48 == 3) );
620 }
621 public boolean haMessoAsso() {
622 char auxCPU[];
623 auxCPU = frame.giocata[0].toString().toCharArray();
624 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
625 (auxCPU[auxCPU.length-7] - 48 == 1) );
626 }
627 public boolean haCaricato() {
628 char auxCPU[];
629 auxCPU = frame.giocata[0].toString().toCharArray();
630 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
631 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
632 }
633 public boolean vaiLiscio() {
634 char auxCPU[];
635 for ( int i = 0; i < 3; i++ ) {
636 if ( frame.carteCPU[i] != null ) {
637 auxCPU = frame.carteCPU[i].toString().toCharArray();
638 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
639 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
640 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
641 cartaDaGiocare = i;
642 return true;
643 }
644 }
645 }
646 return false;
647 }
648 public boolean vaiPunti() {
649 char[] auxCPU;
650 for ( int i = 0; i < 3; i++ ) {
651 if ( frame.carteCPU[i] != null ) {
652 auxCPU = frame.carteCPU[i].toString().toCharArray();
653 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
654 cartaDaGiocare = i;
655 return true;
656 }
657 }
658 }
659 for ( int i = 0; i < 3; i++ ) {
660 if ( frame.carteCPU[i] != null ) {
661 auxCPU = frame.carteCPU[i].toString().toCharArray();
662 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
663 cartaDaGiocare = i;
664 return true;
665 }
666 }
667 }
668 for ( int i = 0; i < 3; i++ ) {
669 if ( frame.carteCPU[i] != null ) {
670 auxCPU = frame.carteCPU[i].toString().toCharArray();
671 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
672 cartaDaGiocare = i;
673 return true;
674 }
675 }
676 }
677 return false;
678 }
679 public boolean vaiTaglio() {
680 char auxCPU[];
681 for ( int i = 0; i < 3; i++ ) {
682 if ( frame.carteCPU[i] != null ) {
683 auxCPU = frame.carteCPU[i].toString().toCharArray();
684 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
685 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
686 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
687 cartaDaGiocare = i;
688 return true;
689 }
690 }
691 }
692 return false;
693 }
694 public boolean vaiBriscolaAlta() {
695 char[] auxCPU;
696 for ( int i = 0; i < 3; i++ ) {
697 if ( frame.carteCPU[i] != null ) {
698 auxCPU = frame.carteCPU[i].toString().toCharArray();
699 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
700 cartaDaGiocare = i;
701 return true;
702 }
703 }
704 }
705 for ( int i = 0; i < 3; i++ ) {
706 if ( frame.carteCPU[i] != null ) {
707 auxCPU = frame.carteCPU[i].toString().toCharArray();
708 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
709 cartaDaGiocare = i;
710 return true;
711 }
712 }
713 }
714 for ( int i = 0; i < 3; i++ ) {
715 if ( frame.carteCPU[i] != null ) {
716 auxCPU = frame.carteCPU[i].toString().toCharArray();
717 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
718 cartaDaGiocare = i;
719 return true;
720 }
721 }
722 }
723 return false;
724 }
725 public boolean vaiTre() {
726 char auxCPU[];
727 for ( int i = 0; i < 3; i++ ) {
728 if ( frame.carteCPU[i] != null ) {
729 auxCPU = frame.carteCPU[i].toString().toCharArray();
730 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
731 cartaDaGiocare = i;
732 return true;
733 }
734 }
735 }
736 return false;
737 }
738 public boolean vaiAsso() {
739 char auxCPU[];
740 for ( int i = 0; i < 3; i++ ) {
741 if ( frame.carteCPU[i] != null ) {
742 auxCPU = frame.carteCPU[i].toString().toCharArray();
743 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
744 cartaDaGiocare = i;
745 return true;
746 }
747 }
748 }
749 return false;
750 }
751 public boolean vaiCarico() {
752 char[] auxCPU;
753 for ( int i = 0; i < 3; i++ ) {
754 if ( frame.carteCPU[i] != null ) {
755 auxCPU = frame.carteCPU[i].toString().toCharArray();
756 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
757 cartaDaGiocare = i;
758 return true;
759 }
760 }
761 }
762 for ( int i = 0; i < 3; i++ ) {
763 if ( frame.carteCPU[i] != null ) {
764 auxCPU = frame.carteCPU[i].toString().toCharArray();
765 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
766 cartaDaGiocare = i;
767 return true;
768 }
769 }
770 }
771 return false;
772 }
773 public boolean vaiSopra() {
774 if ( frame.giocata[0] == null )
775 return false;
776 int a = -1;
777 int b = -1;
778 int c = -1;
779 boolean laPrimaPuoAndareSopra = false;
780 boolean laSecondaPuoAndareSopra = false;
781 boolean laTerzaPuoAndareSopra = false;
782 char[] auxCPU1 = new char[1024];
783 char[] auxCPU2 = new char[1024];
784 char[] auxCPU3 = new char[1024];
785 char[] aux = frame.giocata[0].toString().toCharArray();
786 if ( aux[aux.length-7] - 48 == 1 )
787 return false;
788 if ( frame.carteCPU[0] != null ) {
789 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
790 a = auxCPU1[auxCPU1.length-7] - 48;
791 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
792 laPrimaPuoAndareSopra = true;
793 }
794 if ( frame.carteCPU[1] != null ) {
795 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
796 b = auxCPU2[auxCPU2.length-7] - 48;
797 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
798 laSecondaPuoAndareSopra = true;
799 }
800 if ( frame.carteCPU[2] != null ) {
801 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
802 c = auxCPU3[auxCPU3.length-7] - 48;
803 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
804 laTerzaPuoAndareSopra = true;
805 }
806 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
807 return false;
808 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
809 cartaDaGiocare = 0;
810 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
811 cartaDaGiocare = 1;
812 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
813 cartaDaGiocare = 2;
814 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
815 if ( laPrimaEPiuAlta( a, b ) )
816 cartaDaGiocare = 0;
817 else
818 cartaDaGiocare = 1;
819 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
820 if ( laPrimaEPiuAlta( b, c ) )
821 cartaDaGiocare = 1;
822 else
823 cartaDaGiocare = 2;
824 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
825 if ( laPrimaEPiuAlta( a, c ) )
826 cartaDaGiocare = 0;
827 else
828 cartaDaGiocare = 2;
829 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
830 if ( laPrimaEPiuAlta( a, b ) )
831 if ( laPrimaEPiuAlta( a, c ) )
832 cartaDaGiocare = 0;
833 else
834 cartaDaGiocare = 2;
835 else
836 if ( laPrimaEPiuAlta( b, c ) )
837 cartaDaGiocare = 1;
838 else
839 cartaDaGiocare = 2;
840 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
841 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
842 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
843 return false;
844 return true;
845 }
846 public boolean hoCarico() {
847 char auxCPU[];
848 for ( int i = 0; i < 3; i++ ) {
849 if ( frame.carteCPU[i] != null ) {
850 auxCPU = frame.carteCPU[i].toString().toCharArray();
851 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
852 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
853 return true;
854 }
855 }
856 }
857 return false;
858 }
859 public boolean hoAsso() {
860 char auxCPU[];
861 for ( int i = 0; i < 3; i++ ) {
862 if ( frame.carteCPU[i] != null ) {
863 auxCPU = frame.carteCPU[i].toString().toCharArray();
864 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
865 return true;
866 }
867 }
868 }
869 return false;
870 }
871 public boolean hoTre() {
872 char auxCPU[];
873 for ( int i = 0; i < 3; i++ ) {
874 if ( frame.carteCPU[i] != null ) {
875 auxCPU = frame.carteCPU[i].toString().toCharArray();
876 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
877 return true;
878 }
879 }
880 }
881 return false;
882 }
883 public boolean hoBriscolaAlta() {
884 char auxCPU[];
885 for ( int i = 0; i < 3; i++ ) {
886 if ( frame.carteCPU[i] != null ) {
887 auxCPU = frame.carteCPU[i].toString().toCharArray();
888 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
889 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
890 return true;
891 }
892 }
893 }
894 return false;
895 }
896 public boolean hoTaglio() {
897 char auxCPU[];
898 for ( int i = 0; i < 3; i++ ) {
899 if ( frame.carteCPU[i] != null ) {
900 auxCPU = frame.carteCPU[i].toString().toCharArray();
901 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
902 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
903 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
904 return true;
905 }
906 }
907 }
908 return false;
909 }
910 public static void settaOpzioni() {
911 lang = "it";
912 soundString = "suono=si";
913 int r = 0;
914 int g = 150;
915 int b = 0;
916 Scanner scanner = null;
917 File file = new File( "JBriscolaConfig.txt" );
918 if ( file.exists() ) {
919 try {
920 scanner = new Scanner( file );
921 } catch ( FileNotFoundException e ) { }
922 try {
923 lang = scanner.next();
924 soundString = scanner.next();
925 r = scanner.nextInt();
926 g = scanner.nextInt();
927 b = scanner.nextInt();
928 } catch ( NoSuchElementException e ) { }
929 }
930 else {
931 lang = "it";
932 soundString = "suono=si";
933 r = 0;
934 g = 150;
935 b = 0;
936 }
937 if ( lang.equals( "it" ) ) {
938 stringaBottonePrendi = "Prendi/Lascia carte";
939 stringaPrimaGioca = "Prima Gioca!";
940 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
941 stringaVinto = "Hai Vinto!";
942 stringaPerso = "Hai Perso";
943 stringaPareggio = "Pareggio";
944 stringaGiocatore = "Giocatore: ";
945 stringaComputer = "\nComputer: ";
946 stringaNuovaPartita = "Nuova Partita";
947 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
948 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
949 stringaSi = "Si";
950 stringaNo = "No";
951 stringaOpzioni = "Opzioni...";
952 stringaEsci = "Esci";
953 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
954 stringaLingua = "Lingua";
955 stringaAnnulla = "Annulla";
956 stringaIt = "Italiano";
957 stringaLa = "Latino";
958 stringaBL = "Dialetto Bellunese";
959 stringaBV = "Dialetto Basso Veneto";
960 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
961 stringaModificaOpzioni = "Modifica Opzioni";
962 stringaInformazioni = "Informazioni";
963 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";
964 stringaSuono = "Effetti sonori";
965 stringaPunteggio = "Punteggio";
966 stringaSfondo = "Sfondo";
967 }
968 else if ( lang.equals( "la" ) ) {
969 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
970 stringaPrimaGioca = "ANTE CHARTAM PONE!";
971 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
972 stringaVinto = "VICISTI!";
973 stringaPerso = "PERDIDISTI";
974 stringaPareggio = "AEQVATIO!";
975 stringaGiocatore = "LVSOR: ";
976 stringaComputer = "\nCOMPVTER: ";
977 stringaNuovaPartita = "NOVA LVSO";
978 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
979 stringaVuoiDavveroUscire = "EXIRE?";
980 stringaSi = "ID VOLO";
981 stringaNo = "NOLO";
982 stringaOpzioni = "OPTIONES...";
983 stringaEsci = "EXIRE";
984 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
985 stringaLingua = "LINGVA";
986 stringaAnnulla = "ABROGA";
987 stringaIt = "ITALICA";
988 stringaLa = "LATINA";
989 stringaBL = "BELLUNI";
990 stringaBV = "VENETIAE";
991 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
992 stringaModificaOpzioni = "OPTIONES NOVARE";
993 stringaInformazioni = "INFORMATIONES";
994 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";
995 stringaSuono = "SONUS";
996 stringaPunteggio = "NUMERI";
997 stringaSfondo = "COLOR";
998 }
999 if ( lang.equals( "bl" ) ) {
1000 stringaBottonePrendi = "Cio' su/lasa le carte";
1001 stringaPrimaGioca = "Prima Duga!";
1002 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1003 stringaVinto = "Te ha vint!";
1004 stringaPerso = "Te ha pers";
1005 stringaPareggio = "Pari";
1006 stringaGiocatore = "Dugador: ";
1007 stringaComputer = "\nComputer: ";
1008 stringaNuovaPartita = "Taca n'altra partida";
1009 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1010 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1011 stringaSi = "Si";
1012 stringaNo = "No";
1013 stringaOpzioni = "Opzioni...";
1014 stringaEsci = "Stusa su";
1015 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1016 stringaLingua = "Lengua";
1017 stringaAnnulla = "Annulla";
1018 stringaIt = "Italian";
1019 stringaLa = "Latin";
1020 stringaBL = "Dialeto de Belun";
1021 stringaBV = "Dialeto de la basa";
1022 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
1023 stringaModificaOpzioni = "Modifica Opzioni";
1024 stringaInformazioni = "Informazioni";
1025 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";
1026 stringaSuono = "Efeti sonori";
1027 stringaPunteggio = "Varda i punti";
1028 stringaSfondo = "Sfondo";
1029 }
1030 if ( lang.equals( "bv" ) ) {
1031 stringaBottonePrendi = "Ciapa su/lasa e carte";
1032 stringaPrimaGioca = "Prima Zuga!";
1033 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1034 stringaVinto = "Ti ga vinto!";
1035 stringaPerso = "Ti ga perso";
1036 stringaPareggio = "Pari";
1037 stringaGiocatore = "Zugador: ";
1038 stringaComputer = "\nComputer: ";
1039 stringaNuovaPartita = "N'altra Partida";
1040 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1041 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1042 stringaSi = "Si";
1043 stringaNo = "No";
1044 stringaOpzioni = "Opzioni...";
1045 stringaEsci = "Stusa su";
1046 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1047 stringaLingua = "Lengua";
1048 stringaAnnulla = "Annulla";
1049 stringaIt = "Italian";
1050 stringaLa = "Latin";
1051 stringaBL = "Dialeto Belumat";
1052 stringaBV = "Dialeto Veneto";
1053 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
1054 stringaModificaOpzioni = "Modifica Opzioni";
1055 stringaInformazioni = "Informasioni";
1056 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";
1057 stringaSuono = "Efeti sonori";
1058 stringaPunteggio = "Varda i punti";
1059 stringaSfondo = "Sfondo";
1060 }
1061 sound = ( soundString.equals( "suono=si" ) );
1062 color = new Color( r, g, b );
1063 if ( frame != null ) {
1064 frame.pannello.repaint();
1065 frame.pannello2.repaint();
1066 frame.repaint();
1067 }
1068 }
1069}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2 Beta 2/src/OptionFrame.java
new file mode 100755
index 0000000..a93899f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/OptionFrame.java
@@ -0,0 +1,129 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono;
34 public static JPanel[] pannello = new JPanel[5];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 formatter.format( lang );
69 formatter.format( "\n" );
70 formatter.format( suonosiono );
71 formatter.format( "\n" );
72 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
73 formatter.close();
74 main.settaOpzioni();
75 OptionFrame.this.dispose();
76 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
77 }
78 });
79 annulla = new JButton( main.stringaAnnulla );
80 annulla.addActionListener( new ActionListener() {
81 public void actionPerformed( ActionEvent e ) {
82 OptionFrame.this.dispose();
83 }
84 });
85 scegliColore = new JButton( " " );
86 scegliColore.setBackground( main.color );
87 scegliColore.addActionListener( new ActionListener() {
88 public void actionPerformed( ActionEvent e ) {
89 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
90 if ( colore != null )
91 main.color = colore;
92 OptionFrame.scegliColore.setBackground( main.color );
93 }
94 } );
95 lingua = new JLabel( main.stringaLingua );
96 sfondo = new JLabel( main.stringaSfondo );
97 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
98 selezionaLingua = new JComboBox( lingueDaSelezionare );
99 int linguaPreselezionata = 0;
100 if ( main.lang.equals( "it" ) )
101 linguaPreselezionata = 0;
102 else if ( main.lang.equals( "la" ) )
103 linguaPreselezionata = 1;
104 else if ( main.lang.equals( "bl" ) )
105 linguaPreselezionata = 2;
106 else if ( main.lang.equals( "bv" ) )
107 linguaPreselezionata = 3;
108 selezionaLingua.setSelectedIndex( linguaPreselezionata );
109 suono = new JCheckBox( main.stringaSuono );
110 suono.setSelected( main.sound );
111 pannello[0] = new JPanel( new GridLayout( 3, 1 ) );
112 pannello[1] = new JPanel( new FlowLayout() );
113 pannello[2] = new JPanel( new FlowLayout() );
114 pannello[3] = new JPanel( new FlowLayout() );
115 pannello[4] = new JPanel( new FlowLayout() );
116 pannello[4].add( ok );
117 pannello[4].add( annulla );
118 pannello[3].add( sfondo );
119 pannello[3].add( scegliColore );
120 pannello[2].add( suono );
121 pannello[1].add( lingua );
122 pannello[1].add( selezionaLingua );
123 pannello[0].add( pannello[1] );
124 pannello[0].add( pannello[2] );
125 pannello[0].add( pannello[3] );
126 add( pannello[0], BorderLayout.CENTER );
127 add( pannello[4], BorderLayout.SOUTH );
128 }
129}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/Pannello.java b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Pannello.java
new file mode 100755
index 0000000..24c6596
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/Pannello.java
@@ -0,0 +1,54 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public static Color color;
28 public Pannello() { }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 setBackground( main.color );
32 if ( main.frame.ultimaCarta != null )
33 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
34 if ( main.frame.mazzo )
35 main.frame.retro2.paintIcon( this, g, 17, 256 );
36 if ( main.frame.carteCPU[0] != null )
37 main.frame.retro1.paintIcon( this, g, 230, 5 );
38 if ( main.frame.carteCPU[1] != null )
39 main.frame.retro1.paintIcon( this, g, 300, 5 );
40 if ( main.frame.carteCPU[2] != null )
41 main.frame.retro1.paintIcon( this, g, 370, 5 );
42 if ( main.frame.carteInMano[0] != null )
43 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
44 if ( main.frame.carteInMano[1] != null )
45 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
46 if ( main.frame.carteInMano[2] != null )
47 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
48 if ( main.frame.giocata[0] != null )
49 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
50 if ( main.frame.giocata[1] != null )
51 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
52 }
53}
54
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 2/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/Frame.java b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Frame.java
new file mode 100755
index 0000000..7c5efbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Frame.java
@@ -0,0 +1,306 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.awt.*;
26import java.awt.event.*;
27
28public class Frame extends JFrame {
29 public static boolean mazzo;
30 public static Main main;
31 public static Pannello pannello;
32 public static JPanel pannello2;
33 public static JButton button;
34 public static JMenuBar barraMenu;
35 public static JMenu file, puntoInterrogativo;
36 public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti;
37 public static ImageIcon retro1, retro2, ultimaCarta;
38 public static ImageIcon[] giocata = new ImageIcon[2];
39 public static ImageIcon[] carteInMano = new ImageIcon[3];
40 public static ImageIcon[] carteCPU = new ImageIcon[3];
41 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
42 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
43 public Frame() {
44 super( "Tronto's JBriscola " + main.version );
45 mazzo = true;
46 main = new Main();
47 pannello = new Pannello();
48 pannello2 = new JPanel( new FlowLayout() );
49 button = new JButton( main.stringaBottonePrendi );
50 button.addActionListener( new ActionListener() {
51 public void actionPerformed( ActionEvent e ) {
52 if ( giocata[0] != null && giocata[1] != null )
53 main.mano++;
54 try {
55 main.chiPrende();
56 } catch ( Exception ex ) {
57 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
58 }
59 if ( main.mano == 16 )
60 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
61 if ( main.mano == 17 ) {
62 mazzo = false;
63 ultimaCarta = null;
64 pannello.repaint();
65 Frame.this.repaint();
66 }
67 if ( main.mano == 20 ) {
68 String titolo = "";
69 String suonoFinale = "";
70 if ( main.punteggio > main.punteggioCPU ) {
71 titolo = main.stringaVinto;
72 suonoFinale = "sounds/perso.wav";
73 }
74 if ( main.punteggio < main.punteggioCPU ) {
75 titolo = main.stringaPerso;
76 suonoFinale = "sounds/vinto.wav";
77 }
78 if ( main.punteggio == main.punteggioCPU ) {
79 titolo = main.stringaPareggio;
80 suonoFinale = "sounds/pareggio.wav";
81 }
82 if ( main.sound ) {
83 try {
84 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
85 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
86 AudioFormat af = aff.getFormat();
87 DataLine.Info info = new DataLine.Info(
88 Clip.class,
89 ais.getFormat(),
90 ( (int) ais.getFrameLength() *
91 af.getFrameSize() ) );
92 Clip ol = ( Clip ) AudioSystem.getLine( info );
93 ol.open(ais);
94 ol.loop( 0 );
95 } catch ( Exception ex ) {
96 System.err.println( e );
97 }
98 }
99 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
100 }
101 }
102 } );
103 button.addKeyListener( new KeyAdapter() {
104 public void keyReleased( KeyEvent key ) {
105 switch ( key.getKeyCode() ) {
106 case KeyEvent.VK_1:
107 if ( mettiCarta( 231, 500 ) ) {
108 if ( !main.CPUHaGiocato )
109 main.giocaCPU();
110 }
111 break;
112 case KeyEvent.VK_2:
113 if ( mettiCarta( 301, 500 ) ) {
114 if ( !main.CPUHaGiocato )
115 main.giocaCPU();
116 }
117 break;
118 case KeyEvent.VK_3:
119 if ( mettiCarta( 371, 500 ) ) {
120 if ( !main.CPUHaGiocato )
121 main.giocaCPU();
122 }
123 break;
124 case KeyEvent.VK_F1:
125 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.stringaTasti, JOptionPane.INFORMATION_MESSAGE );
126 break;
127 case KeyEvent.VK_F2:
128 if ( main.mano == 20 ) {
129 main.mischia();
130 pannello.repaint();
131 repaint();
132 }
133 else {
134 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 );
135 if ( selezione == JOptionPane.YES_OPTION ) {
136 main.mischia();
137 pannello.repaint();
138 repaint();
139 }
140 }
141 break;
142 case KeyEvent.VK_F3:
143 OptionFrame optionFrame = new OptionFrame();
144 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
145 optionFrame.setResizable( false );
146 optionFrame.setAlwaysOnTop( true );
147 optionFrame.setSize( 300, 150 );
148 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
149 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
150 optionFrame.setVisible( true );
151 break;
152 case KeyEvent.VK_F4:
153 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
154 break;
155 case KeyEvent.VK_F5:
156 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
157 break;
158 case KeyEvent.VK_Q:
159 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 );
160 if ( selezione == JOptionPane.YES_OPTION )
161 Frame.this.dispose();
162 break;
163 }
164 }
165 });
166 barraMenu = new JMenuBar();
167 file = new JMenu( "File" );
168 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
169 nuovaPartita.addActionListener( new ActionListener() {
170 public void actionPerformed( ActionEvent e ) {
171 if ( main.mano == 20 ) {
172 main.mischia();
173 pannello.repaint();
174 repaint();
175 }
176 else {
177 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 );
178 if ( selezione == JOptionPane.YES_OPTION ) {
179 main.mischia();
180 pannello.repaint();
181 repaint();
182 }
183 }
184 }
185 });
186 opzioni = new JMenuItem( main.stringaOpzioni );
187 opzioni.addActionListener( new ActionListener() {
188 public void actionPerformed( ActionEvent e ) {
189 OptionFrame optionFrame = new OptionFrame();
190 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
191 optionFrame.setResizable( false );
192 optionFrame.setAlwaysOnTop( true );
193 optionFrame.setSize( 300, 150 );
194 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
195 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
196 optionFrame.setVisible( true );
197 }
198 });
199 esci = new JMenuItem( main.stringaEsci );
200 esci.addActionListener( new ActionListener() {
201 public void actionPerformed( ActionEvent e ) {
202 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 );
203 if ( selezione == JOptionPane.YES_OPTION )
204 Frame.this.dispose();
205 }
206 });
207 file.add( nuovaPartita );
208 file.add( opzioni );
209 file.addSeparator();
210 file.add( esci );
211 puntoInterrogativo = new JMenu( "?" );
212 informazioni = new JMenuItem( main.stringaInformazioni );
213 informazioni.addActionListener( new ActionListener() {
214 public void actionPerformed( ActionEvent e ) {
215 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
216 }
217 } );
218 punti = new JMenuItem( main.stringaPunteggio );
219 punti.addActionListener( new ActionListener() {
220 public void actionPerformed( ActionEvent e ) {
221 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
222 }
223 } );
224 puntoInterrogativo.add( punti );
225 puntoInterrogativo.add( informazioni );
226 barraMenu.add( file );
227 barraMenu.add( puntoInterrogativo );
228 setJMenuBar( barraMenu );
229 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
230 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
231 for (int i = 0; i < 10; i++)
232 for (int j = 0; j < 4; j++)
233 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
234 main.mischia();
235 pannello2.add( button );
236 setLayout( new BorderLayout() );
237 add( pannello, BorderLayout.CENTER );
238 add( pannello2, BorderLayout.SOUTH );
239 addMouseListener(
240 new MouseAdapter() {
241 public void mouseClicked ( MouseEvent e ) {
242 if ( mettiCarta( e.getX(), e.getY() ) ) {
243 if ( !main.CPUHaGiocato )
244 main.giocaCPU();
245 }
246 }
247 }
248 );
249 addWindowListener(
250 new WindowAdapter() {
251 public void windowClosing( WindowEvent e ) {
252 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 );
253 if ( selezione == JOptionPane.YES_OPTION )
254 System.exit( 0 );
255 }
256 }
257 );
258 }
259 public boolean mettiCarta( int x, int y ) {
260 if ( !main.toccaAllaCPU && giocata[0] == null ) {
261 if ( main.sound &&
262 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
263 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
264 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
265 try {
266 double a = Math.random() * 6;
267 int i = (int) a;
268 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
269 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
270 AudioFormat af = aff.getFormat();
271 DataLine.Info info = new DataLine.Info(
272 Clip.class,
273 ais.getFormat(),
274 ( (int) ais.getFrameLength() *
275 af.getFrameSize() ) );
276 Clip ol = ( Clip ) AudioSystem.getLine( info );
277 ol.open(ais);
278 ol.loop( 0 );
279 } catch ( Exception e ) {
280 System.err.println( e );
281 }
282 }
283 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
284 giocata[0] = carteInMano[0];
285 carteInMano[0] = null;
286 pannello.repaint();
287 return true;
288 }
289 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
290 giocata[0] = carteInMano[1];
291 carteInMano[1] = null;
292 pannello.repaint();
293 return true;
294 }
295 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
296 giocata[0] = carteInMano[2];
297 carteInMano[2] = null;
298 pannello.repaint();
299 return true;
300 }
301 }
302 return false;
303 }
304}
305
306
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/Main.java b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Main.java
new file mode 100755
index 0000000..0994b6a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Main.java
@@ -0,0 +1,1080 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static boolean sound = true;
33 public static Frame frame;
34 public static Color color = new Color( 0, 150, 0 );
35 public static String version = "0.2 Beta 3";
36 public static String stringaBottonePrendi = "Prendi/Lascia carte";
37 public static String stringaPrimaGioca = "Prima Gioca!";
38 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
39 public static String stringaVinto = "Hai Vinto!";
40 public static String stringaPerso = "Hai Perso";
41 public static String stringaPareggio = "Pareggio";
42 public static String stringaGiocatore = "Giocatore: ";
43 public static String stringaComputer = "\nComputer: ";
44 public static String stringaNuovaPartita = "Nuova Partita";
45 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
46 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
47 public static String stringaSi = "Si";
48 public static String stringaNo = "No";
49 public static String stringaOpzioni = "Opzioni...";
50 public static String stringaEsci = "Esci";
51 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
52 public static String stringaLingua = "Lingua";
53 public static String stringaAnnulla = "Annulla";
54 public static String stringaIt = "Italiano";
55 public static String stringaLa = "Latino";
56 public static String stringaBL = "Dialetto Bellunese";
57 public static String stringaBV = "Dialetto Basso Veneto";
58 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
59 public static String stringaModificaOpzioni = "Modifica Opzioni";
60 public static String stringaInformazioni = "Informazioni";
61 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";
62 public static String stringaSuono = "Effetti Sonori";
63 public static String stringaPunteggio = "Punteggio";
64 public static String stringaSfondo = "Sfondo";
65 public static String stringaTasti = "Tasti rapidi";
66 public static String stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 Nuova partita\nF3 Opzioni\nF4 Visualizza Punteggio\nF5 Informazioni\nq Esci";
67 public static String lang, soundString;
68 public static File[] suoni = new File[6];
69 public static File suonoVinto, suonoPerso, suonoPareggio;
70 public static void main( String args[] ) {
71 settaOpzioni();
72 frame = new Frame();
73 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
74 frame.setResizable( false );
75 frame.setSize( 600, 600 );
76 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
77 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
78 frame.setVisible( true );
79 }
80 public void mischia() {
81 mano = 0;
82 punteggio = 0;
83 punteggioCPU = 0;
84 cartaDaPescare = 6;
85 ImageIcon aux;
86 frame.mazzo = true;
87 toccaAllaCPU = false;
88 CPUHaGiocato = false;
89 haGiocatoPrima = true;
90 for ( int i = 0, k = 0; i < 10; i++ )
91 for ( int j = 0; j < 4; j++, k++ )
92 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
93 for ( int i = 0; i < 391; i++ ) {
94 double a = Math.random() * 40;
95 int x = (int) a;
96 double b = Math.random() * 40;
97 int y = (int) b;
98 aux = frame.arrayCarteMescolate[x];
99 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
100 frame.arrayCarteMescolate[y] = aux;
101 }
102 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
103 semeBriscola = auxChar[auxChar.length-5] - 49;
104 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
105 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
106 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
107 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
108 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
109 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
110 frame.ultimaCarta = frame.arrayCarteMescolate[39];
111 frame.giocata[0] = null;
112 frame.giocata[1] = null;
113 }
114 public void giocaCPU() {
115 if ( mano < 16 ) {
116 if ( frame.giocata[0] == null ) {
117 if ( vaiPunti() );
118 else if ( vaiLiscio() );
119 else if ( vaiTaglio() );
120 else if ( vaiBriscolaAlta() );
121 else if ( vaiCarico() );
122 else if ( vaiTre() );
123 else if ( vaiAsso() );
124 else;
125 }
126 else {
127 if ( haLisciato() ) {
128 if ( vaiSopra() );
129 else if ( vaiLiscio() );
130 else if ( vaiPunti() );
131 else if ( vaiTaglio() );
132 else if ( vaiTre() );
133 else if ( vaiBriscolaAlta() );
134 else if ( vaiCarico() );
135 else if ( vaiAsso() );
136 } else if ( haMessoPunti() ) {
137 if ( vaiSopra() );
138 else if ( vaiLiscio() );
139 else if ( vaiTaglio() );
140 else if ( vaiPunti() );
141 else if ( vaiTre() );
142 else if ( vaiBriscolaAlta() );
143 else if ( vaiCarico() );
144 else if ( vaiAsso() );
145 } else if ( haTagliato() ) {
146 if ( vaiLiscio() );
147 else if ( vaiPunti() );
148 else if ( vaiTaglio() );
149 else if ( vaiTre() );
150 else if ( vaiBriscolaAlta() );
151 else if ( vaiCarico() );
152 else if ( vaiAsso() );
153 } else if ( haMessoBriscolaAlta() ) {
154 if ( vaiLiscio() );
155 else if ( vaiPunti() );
156 else if ( vaiTre() );
157 else if ( vaiTaglio() );
158 else if ( vaiBriscolaAlta() );
159 else if ( vaiCarico() );
160 else if ( vaiAsso() );
161 } else if ( haMessoTre() ) {
162 if ( vaiAsso() );
163 else if ( vaiLiscio() );
164 else if ( vaiPunti() );
165 else if ( vaiTaglio() );
166 else if ( vaiBriscolaAlta() );
167 else if ( vaiCarico() );
168 } else if ( haMessoAsso() ) {
169 if ( vaiLiscio() );
170 else if ( vaiPunti() );
171 else if ( vaiTaglio() );
172 else if ( vaiBriscolaAlta() );
173 else if ( vaiCarico() );
174 else if ( vaiTre() );
175 } else if ( haCaricato() ) {
176 if ( vaiSopra() );
177 else if ( vaiTre() );
178 else if ( vaiBriscolaAlta() );
179 else if ( vaiAsso() );
180 else if ( vaiTaglio() );
181 else if ( vaiLiscio() );
182 else if ( vaiPunti() );
183 else if ( vaiCarico() );
184 }
185 }
186 }
187 else if ( mano == 16 ) {
188 if ( frame.giocata[0] == null ) {
189 char aux[];
190 aux = frame.ultimaCarta.toString().toCharArray();
191 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
192 if ( vaiCarico() );
193 else if ( vaiPunti() );
194 else if ( vaiLiscio() );
195 else if ( vaiTaglio() );
196 else if ( vaiBriscolaAlta() );
197 else if ( vaiTre() );
198 else if ( vaiAsso() );
199 else;
200 } else {
201 if ( vaiPunti() );
202 else if ( vaiLiscio() );
203 else if ( vaiTaglio() );
204 else if ( vaiBriscolaAlta() );
205 else if ( vaiCarico() );
206 else if ( vaiTre() );
207 else if ( vaiAsso() );
208 else;
209 }
210 }
211 else {
212 char aux[];
213 aux = frame.ultimaCarta.toString().toCharArray();
214 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
215 if ( haCaricato() ) {
216 if ( vaiSopra() );
217 else if ( vaiLiscio() );
218 else if ( vaiPunti() );
219 else if ( vaiTre() );
220 else if ( vaiTaglio() );
221 else if ( vaiBriscolaAlta() );
222 else if ( vaiAsso() );
223 else if ( vaiCarico() );
224 }
225 } else {
226 if ( haLisciato() ) {
227 if ( vaiSopra() );
228 else if ( vaiLiscio() );
229 else if ( vaiPunti() );
230 else if ( vaiTaglio() );
231 else if ( vaiTre() );
232 else if ( vaiBriscolaAlta() );
233 else if ( vaiCarico() );
234 else if ( vaiAsso() );
235 } else if ( haMessoPunti() ) {
236 if ( vaiSopra() );
237 else if ( vaiLiscio() );
238 else if ( vaiTaglio() );
239 else if ( vaiPunti() );
240 else if ( vaiTre() );
241 else if ( vaiBriscolaAlta() );
242 else if ( vaiCarico() );
243 else if ( vaiAsso() );
244 } else if ( haTagliato() ) {
245 if ( vaiLiscio() );
246 else if ( vaiPunti() );
247 else if ( vaiTaglio() );
248 else if ( vaiTre() );
249 else if ( vaiBriscolaAlta() );
250 else if ( vaiCarico() );
251 else if ( vaiAsso() );
252 } else if ( haMessoBriscolaAlta() ) {
253 if ( vaiLiscio() );
254 else if ( vaiPunti() );
255 else if ( vaiTre() );
256 else if ( vaiTaglio() );
257 else if ( vaiBriscolaAlta() );
258 else if ( vaiCarico() );
259 else if ( vaiAsso() );
260 } else if ( haMessoTre() ) {
261 if ( vaiAsso() );
262 else if ( vaiLiscio() );
263 else if ( vaiPunti() );
264 else if ( vaiTaglio() );
265 else if ( vaiBriscolaAlta() );
266 else if ( vaiCarico() );
267 } else if ( haMessoAsso() ) {
268 if ( vaiLiscio() );
269 else if ( vaiPunti() );
270 else if ( vaiTaglio() );
271 else if ( vaiBriscolaAlta() );
272 else if ( vaiCarico() );
273 else if ( vaiTre() );
274 } else if ( haCaricato() ) {
275 if ( vaiSopra() );
276 else if ( vaiTre() );
277 else if ( vaiBriscolaAlta() );
278 else if ( vaiAsso() );
279 else if ( vaiTaglio() );
280 else if ( vaiLiscio() );
281 else if ( vaiPunti() );
282 else if ( vaiCarico() );
283 }
284 }
285 }
286 } else if ( mano == 17 ) {
287 if ( frame.giocata[0] == null ) {
288 if ( hoAsso() ) {
289 if ( vaiTre() );
290 else if ( vaiBriscolaAlta() );
291 else if ( vaiTaglio() );
292 else if ( vaiLiscio() );
293 else if ( vaiPunti() );
294 else if ( vaiAsso() );
295 else if ( vaiCarico() );
296 } else {
297 if ( vaiLiscio() );
298 else if ( vaiPunti() );
299 else if ( vaiTaglio() );
300 else if ( vaiBriscolaAlta() );
301 else if ( vaiCarico() );
302 else if ( vaiTre() );
303 }
304 }
305 else {
306 if ( haLisciato() ) {
307 if ( vaiSopra() );
308 else if ( vaiLiscio() );
309 else if ( vaiPunti() );
310 else if ( vaiTaglio() );
311 else if ( vaiTre() );
312 else if ( vaiBriscolaAlta() );
313 else if ( vaiCarico() );
314 else if ( vaiAsso() );
315 } else if ( haMessoPunti() ) {
316 if ( vaiSopra() );
317 else if ( vaiLiscio() );
318 else if ( vaiTaglio() );
319 else if ( vaiPunti() );
320 else if ( vaiTre() );
321 else if ( vaiBriscolaAlta() );
322 else if ( vaiCarico() );
323 else if ( vaiAsso() );
324 } else if ( haTagliato() ) {
325 if ( vaiLiscio() );
326 else if ( vaiPunti() );
327 else if ( vaiTaglio() );
328 else if ( vaiTre() );
329 else if ( vaiBriscolaAlta() );
330 else if ( vaiCarico() );
331 else if ( vaiAsso() );
332 } else if ( haMessoBriscolaAlta() ) {
333 if ( vaiLiscio() );
334 else if ( vaiPunti() );
335 else if ( vaiTre() );
336 else if ( vaiTaglio() );
337 else if ( vaiBriscolaAlta() );
338 else if ( vaiCarico() );
339 else if ( vaiAsso() );
340 } else if ( haMessoTre() ) {
341 if ( vaiAsso() );
342 else if ( vaiLiscio() );
343 else if ( vaiPunti() );
344 else if ( vaiTaglio() );
345 else if ( vaiBriscolaAlta() );
346 else if ( vaiCarico() );
347 } else if ( haMessoAsso() ) {
348 if ( vaiLiscio() );
349 else if ( vaiPunti() );
350 else if ( vaiTaglio() );
351 else if ( vaiBriscolaAlta() );
352 else if ( vaiCarico() );
353 else if ( vaiTre() );
354 } else if ( haCaricato() ) {
355 if ( vaiSopra() );
356 else if ( vaiTre() );
357 else if ( vaiBriscolaAlta() );
358 else if ( vaiAsso() );
359 else if ( vaiTaglio() );
360 else if ( vaiLiscio() );
361 else if ( vaiPunti() );
362 else if ( vaiCarico() );
363 }
364 }
365 } else if ( mano == 18 ) {
366 if ( frame.giocata[0] == null ) {
367 if ( vaiAsso() );
368 else if ( vaiCarico() );
369 else if ( vaiBriscolaAlta() );
370 else if ( vaiTaglio() );
371 else if ( vaiPunti() );
372 else if ( vaiLiscio() );
373 else if ( vaiTre() );
374 }
375 else {
376 if ( haLisciato() ) {
377 if ( vaiSopra() );
378 else if ( vaiLiscio() );
379 else if ( vaiPunti() );
380 else if ( vaiTaglio() );
381 else if ( vaiTre() );
382 else if ( vaiBriscolaAlta() );
383 else if ( vaiCarico() );
384 else if ( vaiAsso() );
385 } else if ( haMessoPunti() ) {
386 if ( vaiSopra() );
387 else if ( vaiLiscio() );
388 else if ( vaiTaglio() );
389 else if ( vaiPunti() );
390 else if ( vaiTre() );
391 else if ( vaiBriscolaAlta() );
392 else if ( vaiCarico() );
393 else if ( vaiAsso() );
394 } else if ( haTagliato() ) {
395 if ( vaiLiscio() );
396 else if ( vaiPunti() );
397 else if ( vaiTaglio() );
398 else if ( vaiTre() );
399 else if ( vaiBriscolaAlta() );
400 else if ( vaiCarico() );
401 else if ( vaiAsso() );
402 } else if ( haMessoBriscolaAlta() ) {
403 if ( vaiLiscio() );
404 else if ( vaiPunti() );
405 else if ( vaiTre() );
406 else if ( vaiTaglio() );
407 else if ( vaiBriscolaAlta() );
408 else if ( vaiCarico() );
409 else if ( vaiAsso() );
410 } else if ( haMessoTre() ) {
411 if ( vaiAsso() );
412 else if ( vaiLiscio() );
413 else if ( vaiPunti() );
414 else if ( vaiTaglio() );
415 else if ( vaiBriscolaAlta() );
416 else if ( vaiCarico() );
417 } else if ( haMessoAsso() ) {
418 if ( vaiLiscio() );
419 else if ( vaiPunti() );
420 else if ( vaiTaglio() );
421 else if ( vaiBriscolaAlta() );
422 else if ( vaiCarico() );
423 else if ( vaiTre() );
424 } else if ( haCaricato() ) {
425 if ( vaiSopra() );
426 else if ( vaiTre() );
427 else if ( vaiBriscolaAlta() );
428 else if ( vaiAsso() );
429 else if ( vaiTaglio() );
430 else if ( vaiLiscio() );
431 else if ( vaiPunti() );
432 else if ( vaiCarico() );
433 }
434 }
435 } else {
436 if ( vaiTre() );
437 else if ( vaiBriscolaAlta() );
438 else if ( vaiAsso() );
439 else if ( vaiTaglio() );
440 else if ( vaiLiscio() );
441 else if ( vaiPunti() );
442 else if ( vaiCarico() );
443 }
444 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
445 frame.carteCPU[cartaDaGiocare] = null;
446 frame.pannello.repaint();
447 CPUHaGiocato = true;
448 if ( frame.giocata[0] == null )
449 toccaAllaCPU = false;
450 }
451 public void chiPrende() {
452 char aux[], auxCPU[];
453 aux = frame.giocata[0].toString().toCharArray();
454 auxCPU = frame.giocata[1].toString().toCharArray();
455 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
456 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
457 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
458 }
459 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
460 int a, b;
461 switch ( prima ) {
462 case 0:
463 a = 10;
464 break;
465 case 1:
466 a = 12;
467 break;
468 case 3:
469 a = 11;
470 break;
471 default:
472 a = prima;
473 break;
474 }
475 switch ( seconda ) {
476 case 0:
477 b = 10;
478 break;
479 case 1:
480 b = 12;
481 break;
482 case 3:
483 b = 11;
484 break;
485 default:
486 b = seconda;
487 break;
488 }
489 return a > b;
490 }
491 public void giocatorePrende( boolean giocatore ) {
492 if ( giocatore ) {
493 toccaAllaCPU = CPUHaGiocato = false;
494 haGiocatoPrima = true;
495 }
496 else {
497 toccaAllaCPU = true;
498 CPUHaGiocato = haGiocatoPrima = false;
499 }
500 daiPunti( giocatore );
501 if ( toccaAllaCPU )
502 giocaCPU();
503 }
504 public void daiPunti( boolean giocatore ) {
505 char aux[], auxCPU[];
506 aux = frame.giocata[0].toString().toCharArray();
507 auxCPU = frame.giocata[1].toString().toCharArray();
508 int punti = 0;
509 switch( aux[aux.length-7] - 48 ) {
510 case 0:
511 punti += 4;
512 break;
513 case 1:
514 punti += 11;
515 break;
516 case 3:
517 punti += 10;
518 break;
519 case 8:
520 punti += 2;
521 break;
522 case 9:
523 punti += 3;
524 break;
525 default:
526 break;
527 }
528 switch( auxCPU[auxCPU.length-7] - 48 ) {
529 case 0:
530 punti += 4;
531 break;
532 case 1:
533 punti += 11;
534 break;
535 case 3:
536 punti += 10;
537 break;
538 case 8:
539 punti += 2;
540 break;
541 case 9:
542 punti += 3;
543 break;
544 default:
545 break;
546 }
547 frame.giocata[0] = frame.giocata[1] = null;
548 if ( giocatore ) {
549 punteggio += punti;
550 if ( mano < 18 ) {
551 if ( frame.carteInMano[0] == null )
552 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
553 if ( frame.carteInMano[1] == null )
554 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
555 if ( frame.carteInMano[2] == null )
556 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
557 cartaDaPescare++;
558 if ( frame.carteCPU[0] == null )
559 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
560 if ( frame.carteCPU[1] == null )
561 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
562 if ( frame.carteCPU[2] == null )
563 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
564 cartaDaPescare++;
565 }
566 }
567 else {
568 punteggioCPU += punti;
569 if ( mano < 18 ) {
570 if ( frame.carteCPU[0] == null )
571 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
572 if ( frame.carteCPU[1] == null )
573 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
574 if ( frame.carteCPU[2] == null )
575 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
576 cartaDaPescare++;
577 if ( frame.carteInMano[0] == null )
578 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
579 if ( frame.carteInMano[1] == null )
580 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
581 if ( frame.carteInMano[2] == null )
582 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
583 cartaDaPescare++;
584 }
585 }
586 frame.pannello.repaint();
587 frame.repaint();
588 }
589 public boolean haLisciato() {
590 char auxCPU[];
591 auxCPU = frame.giocata[0].toString().toCharArray();
592 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
593 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
594 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
595 }
596 public boolean haMessoPunti() {
597 char auxCPU[];
598 auxCPU = frame.giocata[0].toString().toCharArray();
599 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
600 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
601 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
602 }
603 public boolean haTagliato() {
604 char auxCPU[];
605 auxCPU = frame.giocata[0].toString().toCharArray();
606 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
607 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
608 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
609 }
610 public boolean haMessoBriscolaAlta() {
611 char auxCPU[];
612 auxCPU = frame.giocata[0].toString().toCharArray();
613 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
614 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
615 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
616 }
617 public boolean haMessoTre() {
618 char auxCPU[];
619 auxCPU = frame.giocata[0].toString().toCharArray();
620 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
621 (auxCPU[auxCPU.length-7] - 48 == 3) );
622 }
623 public boolean haMessoAsso() {
624 char auxCPU[];
625 auxCPU = frame.giocata[0].toString().toCharArray();
626 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
627 (auxCPU[auxCPU.length-7] - 48 == 1) );
628 }
629 public boolean haCaricato() {
630 char auxCPU[];
631 auxCPU = frame.giocata[0].toString().toCharArray();
632 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
633 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
634 }
635 public boolean vaiLiscio() {
636 char auxCPU[];
637 for ( int i = 0; i < 3; i++ ) {
638 if ( frame.carteCPU[i] != null ) {
639 auxCPU = frame.carteCPU[i].toString().toCharArray();
640 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
641 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
642 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
643 cartaDaGiocare = i;
644 return true;
645 }
646 }
647 }
648 return false;
649 }
650 public boolean vaiPunti() {
651 char[] auxCPU;
652 for ( int i = 0; i < 3; i++ ) {
653 if ( frame.carteCPU[i] != null ) {
654 auxCPU = frame.carteCPU[i].toString().toCharArray();
655 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
656 cartaDaGiocare = i;
657 return true;
658 }
659 }
660 }
661 for ( int i = 0; i < 3; i++ ) {
662 if ( frame.carteCPU[i] != null ) {
663 auxCPU = frame.carteCPU[i].toString().toCharArray();
664 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
665 cartaDaGiocare = i;
666 return true;
667 }
668 }
669 }
670 for ( int i = 0; i < 3; i++ ) {
671 if ( frame.carteCPU[i] != null ) {
672 auxCPU = frame.carteCPU[i].toString().toCharArray();
673 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
674 cartaDaGiocare = i;
675 return true;
676 }
677 }
678 }
679 return false;
680 }
681 public boolean vaiTaglio() {
682 char auxCPU[];
683 for ( int i = 0; i < 3; i++ ) {
684 if ( frame.carteCPU[i] != null ) {
685 auxCPU = frame.carteCPU[i].toString().toCharArray();
686 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
687 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
688 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
689 cartaDaGiocare = i;
690 return true;
691 }
692 }
693 }
694 return false;
695 }
696 public boolean vaiBriscolaAlta() {
697 char[] auxCPU;
698 for ( int i = 0; i < 3; i++ ) {
699 if ( frame.carteCPU[i] != null ) {
700 auxCPU = frame.carteCPU[i].toString().toCharArray();
701 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
702 cartaDaGiocare = i;
703 return true;
704 }
705 }
706 }
707 for ( int i = 0; i < 3; i++ ) {
708 if ( frame.carteCPU[i] != null ) {
709 auxCPU = frame.carteCPU[i].toString().toCharArray();
710 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
711 cartaDaGiocare = i;
712 return true;
713 }
714 }
715 }
716 for ( int i = 0; i < 3; i++ ) {
717 if ( frame.carteCPU[i] != null ) {
718 auxCPU = frame.carteCPU[i].toString().toCharArray();
719 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
720 cartaDaGiocare = i;
721 return true;
722 }
723 }
724 }
725 return false;
726 }
727 public boolean vaiTre() {
728 char auxCPU[];
729 for ( int i = 0; i < 3; i++ ) {
730 if ( frame.carteCPU[i] != null ) {
731 auxCPU = frame.carteCPU[i].toString().toCharArray();
732 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
733 cartaDaGiocare = i;
734 return true;
735 }
736 }
737 }
738 return false;
739 }
740 public boolean vaiAsso() {
741 char auxCPU[];
742 for ( int i = 0; i < 3; i++ ) {
743 if ( frame.carteCPU[i] != null ) {
744 auxCPU = frame.carteCPU[i].toString().toCharArray();
745 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
746 cartaDaGiocare = i;
747 return true;
748 }
749 }
750 }
751 return false;
752 }
753 public boolean vaiCarico() {
754 char[] auxCPU;
755 for ( int i = 0; i < 3; i++ ) {
756 if ( frame.carteCPU[i] != null ) {
757 auxCPU = frame.carteCPU[i].toString().toCharArray();
758 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
759 cartaDaGiocare = i;
760 return true;
761 }
762 }
763 }
764 for ( int i = 0; i < 3; i++ ) {
765 if ( frame.carteCPU[i] != null ) {
766 auxCPU = frame.carteCPU[i].toString().toCharArray();
767 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
768 cartaDaGiocare = i;
769 return true;
770 }
771 }
772 }
773 return false;
774 }
775 public boolean vaiSopra() {
776 if ( frame.giocata[0] == null )
777 return false;
778 int a = -1;
779 int b = -1;
780 int c = -1;
781 boolean laPrimaPuoAndareSopra = false;
782 boolean laSecondaPuoAndareSopra = false;
783 boolean laTerzaPuoAndareSopra = false;
784 char[] auxCPU1 = new char[1024];
785 char[] auxCPU2 = new char[1024];
786 char[] auxCPU3 = new char[1024];
787 char[] aux = frame.giocata[0].toString().toCharArray();
788 if ( aux[aux.length-7] - 48 == 1 )
789 return false;
790 if ( frame.carteCPU[0] != null ) {
791 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
792 a = auxCPU1[auxCPU1.length-7] - 48;
793 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
794 laPrimaPuoAndareSopra = true;
795 }
796 if ( frame.carteCPU[1] != null ) {
797 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
798 b = auxCPU2[auxCPU2.length-7] - 48;
799 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
800 laSecondaPuoAndareSopra = true;
801 }
802 if ( frame.carteCPU[2] != null ) {
803 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
804 c = auxCPU3[auxCPU3.length-7] - 48;
805 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
806 laTerzaPuoAndareSopra = true;
807 }
808 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
809 return false;
810 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
811 cartaDaGiocare = 0;
812 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
813 cartaDaGiocare = 1;
814 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
815 cartaDaGiocare = 2;
816 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
817 if ( laPrimaEPiuAlta( a, b ) )
818 cartaDaGiocare = 0;
819 else
820 cartaDaGiocare = 1;
821 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
822 if ( laPrimaEPiuAlta( b, c ) )
823 cartaDaGiocare = 1;
824 else
825 cartaDaGiocare = 2;
826 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
827 if ( laPrimaEPiuAlta( a, c ) )
828 cartaDaGiocare = 0;
829 else
830 cartaDaGiocare = 2;
831 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
832 if ( laPrimaEPiuAlta( a, b ) )
833 if ( laPrimaEPiuAlta( a, c ) )
834 cartaDaGiocare = 0;
835 else
836 cartaDaGiocare = 2;
837 else
838 if ( laPrimaEPiuAlta( b, c ) )
839 cartaDaGiocare = 1;
840 else
841 cartaDaGiocare = 2;
842 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
843 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
844 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
845 return false;
846 return true;
847 }
848 public boolean hoCarico() {
849 char auxCPU[];
850 for ( int i = 0; i < 3; i++ ) {
851 if ( frame.carteCPU[i] != null ) {
852 auxCPU = frame.carteCPU[i].toString().toCharArray();
853 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
854 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
855 return true;
856 }
857 }
858 }
859 return false;
860 }
861 public boolean hoAsso() {
862 char auxCPU[];
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 return true;
868 }
869 }
870 }
871 return false;
872 }
873 public boolean hoTre() {
874 char auxCPU[];
875 for ( int i = 0; i < 3; i++ ) {
876 if ( frame.carteCPU[i] != null ) {
877 auxCPU = frame.carteCPU[i].toString().toCharArray();
878 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
879 return true;
880 }
881 }
882 }
883 return false;
884 }
885 public boolean hoBriscolaAlta() {
886 char auxCPU[];
887 for ( int i = 0; i < 3; i++ ) {
888 if ( frame.carteCPU[i] != null ) {
889 auxCPU = frame.carteCPU[i].toString().toCharArray();
890 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
891 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
892 return true;
893 }
894 }
895 }
896 return false;
897 }
898 public boolean hoTaglio() {
899 char auxCPU[];
900 for ( int i = 0; i < 3; i++ ) {
901 if ( frame.carteCPU[i] != null ) {
902 auxCPU = frame.carteCPU[i].toString().toCharArray();
903 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
904 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
905 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
906 return true;
907 }
908 }
909 }
910 return false;
911 }
912 public static void settaOpzioni() {
913 lang = "it";
914 soundString = "suono=si";
915 int r = 0;
916 int g = 150;
917 int b = 0;
918 Scanner scanner = null;
919 File file = new File( "JBriscolaConfig.txt" );
920 if ( file.exists() ) {
921 try {
922 scanner = new Scanner( file );
923 } catch ( FileNotFoundException e ) { }
924 try {
925 lang = scanner.next();
926 soundString = scanner.next();
927 r = scanner.nextInt();
928 g = scanner.nextInt();
929 b = scanner.nextInt();
930 } catch ( NoSuchElementException e ) { }
931 }
932 else {
933 lang = "it";
934 soundString = "suono=si";
935 r = 0;
936 g = 150;
937 b = 0;
938 }
939 if ( lang.equals( "it" ) ) {
940 stringaBottonePrendi = "Prendi/Lascia carte";
941 stringaPrimaGioca = "Prima Gioca!";
942 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
943 stringaVinto = "Hai Vinto!";
944 stringaPerso = "Hai Perso";
945 stringaPareggio = "Pareggio";
946 stringaGiocatore = "Giocatore: ";
947 stringaComputer = "\nComputer: ";
948 stringaNuovaPartita = "Nuova Partita";
949 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
950 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
951 stringaSi = "Si";
952 stringaNo = "No";
953 stringaOpzioni = "Opzioni...";
954 stringaEsci = "Esci";
955 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
956 stringaLingua = "Lingua";
957 stringaAnnulla = "Annulla";
958 stringaIt = "Italiano";
959 stringaLa = "Latino";
960 stringaBL = "Dialetto Bellunese";
961 stringaBV = "Dialetto Basso Veneto";
962 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
963 stringaModificaOpzioni = "Modifica Opzioni";
964 stringaInformazioni = "Informazioni";
965 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";
966 stringaSuono = "Effetti sonori";
967 stringaPunteggio = "Punteggio";
968 stringaSfondo = "Sfondo";
969 stringaTasti = "Tasti rapidi";
970 stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 Nuova partita\nF3 Opzioni\nF4 Visualizza Punteggio\nF5 Informazioni\nq Esci";
971 }
972 else if ( lang.equals( "la" ) ) {
973 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
974 stringaPrimaGioca = "ANTE CHARTAM PONE!";
975 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
976 stringaVinto = "VICISTI!";
977 stringaPerso = "PERDIDISTI";
978 stringaPareggio = "AEQVATIO!";
979 stringaGiocatore = "LVSOR: ";
980 stringaComputer = "\nCOMPVTER: ";
981 stringaNuovaPartita = "NOVA LVSO";
982 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
983 stringaVuoiDavveroUscire = "EXIRE?";
984 stringaSi = "ID VOLO";
985 stringaNo = "NOLO";
986 stringaOpzioni = "OPTIONES...";
987 stringaEsci = "EXIRE";
988 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
989 stringaLingua = "LINGVA";
990 stringaAnnulla = "ABROGA";
991 stringaIt = "ITALICA";
992 stringaLa = "LATINA";
993 stringaBL = "BELLUNI";
994 stringaBV = "VENETIAE";
995 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
996 stringaModificaOpzioni = "OPTIONES NOVARE";
997 stringaInformazioni = "INFORMATIONES";
998 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";
999 stringaSuono = "SONVS";
1000 stringaPunteggio = "NVMERI";
1001 stringaSfondo = "COLOR";
1002 stringaTasti = "TASTI RAPIDI";
1003 stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 NOVA LVSO\nF3 OPTIONES\nF4 NVMERI\nF5 INFORMATIONES\nq EXIRE";
1004 }
1005 if ( lang.equals( "bl" ) ) {
1006 stringaBottonePrendi = "Cio' su/lasa le carte";
1007 stringaPrimaGioca = "Prima Duga!";
1008 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1009 stringaVinto = "Te ha vint!";
1010 stringaPerso = "Te ha pers";
1011 stringaPareggio = "Pari";
1012 stringaGiocatore = "Dugador: ";
1013 stringaComputer = "\nComputer: ";
1014 stringaNuovaPartita = "Taca n'altra partida";
1015 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1016 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1017 stringaSi = "Si";
1018 stringaNo = "No";
1019 stringaOpzioni = "Opzioni...";
1020 stringaEsci = "Stusa su";
1021 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1022 stringaLingua = "Lengua";
1023 stringaAnnulla = "Annulla";
1024 stringaIt = "Italian";
1025 stringaLa = "Latin";
1026 stringaBL = "Dialeto de Belun";
1027 stringaBV = "Dialeto de la basa";
1028 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
1029 stringaModificaOpzioni = "Modifica Opzioni";
1030 stringaInformazioni = "Informazioni";
1031 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";
1032 stringaSuono = "Efeti sonori";
1033 stringaPunteggio = "Varda i punti";
1034 stringaSfondo = "Sfondo";
1035 stringaTasti = "Tasti rapidi";
1036 stringaTasti2 = "1 Duga la prima carta\n2 Duga la seconda carta\n3 Duga la terza carta\nF1 Tasti rapidi\nF2 Taca n'altra partida\nF3 Opzioni\nF4 Varda i punti\nF5 Informazioni\nq Stusa su";
1037 }
1038 if ( lang.equals( "bv" ) ) {
1039 stringaBottonePrendi = "Ciapa su/lasa e carte";
1040 stringaPrimaGioca = "Prima Zuga!";
1041 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1042 stringaVinto = "Ti ga vinto!";
1043 stringaPerso = "Ti ga perso";
1044 stringaPareggio = "Pari";
1045 stringaGiocatore = "Zugador: ";
1046 stringaComputer = "\nComputer: ";
1047 stringaNuovaPartita = "N'altra Partida";
1048 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1049 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1050 stringaSi = "Si";
1051 stringaNo = "No";
1052 stringaOpzioni = "Opzioni...";
1053 stringaEsci = "Stusa su";
1054 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1055 stringaLingua = "Lengua";
1056 stringaAnnulla = "Annulla";
1057 stringaIt = "Italian";
1058 stringaLa = "Latin";
1059 stringaBL = "Dialeto Belumat";
1060 stringaBV = "Dialeto Veneto";
1061 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
1062 stringaModificaOpzioni = "Modifica Opzioni";
1063 stringaInformazioni = "Informasioni";
1064 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";
1065 stringaSuono = "Efeti sonori";
1066 stringaPunteggio = "Varda i punti";
1067 stringaSfondo = "Sfondo";
1068 stringaTasti = "Tasti rapidi";
1069 stringaTasti2 = "1 Zuga la prima carta\n2 Zuga la seconda carta\n3 Zuga la terza carta\nF1 Tasti rapidi\nF2 N'altra partida\nF3 Opzioni\nF4 Varda i punti\nF5 Informazioni\nq Stusa su";
1070
1071 }
1072 sound = ( soundString.equals( "suono=si" ) );
1073 color = new Color( r, g, b );
1074 if ( frame != null ) {
1075 frame.pannello.repaint();
1076 frame.pannello2.repaint();
1077 frame.repaint();
1078 }
1079 }
1080}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2 Beta 3/src/OptionFrame.java
new file mode 100755
index 0000000..a93899f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/OptionFrame.java
@@ -0,0 +1,129 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono;
34 public static JPanel[] pannello = new JPanel[5];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 formatter.format( lang );
69 formatter.format( "\n" );
70 formatter.format( suonosiono );
71 formatter.format( "\n" );
72 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
73 formatter.close();
74 main.settaOpzioni();
75 OptionFrame.this.dispose();
76 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
77 }
78 });
79 annulla = new JButton( main.stringaAnnulla );
80 annulla.addActionListener( new ActionListener() {
81 public void actionPerformed( ActionEvent e ) {
82 OptionFrame.this.dispose();
83 }
84 });
85 scegliColore = new JButton( " " );
86 scegliColore.setBackground( main.color );
87 scegliColore.addActionListener( new ActionListener() {
88 public void actionPerformed( ActionEvent e ) {
89 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
90 if ( colore != null )
91 main.color = colore;
92 OptionFrame.scegliColore.setBackground( main.color );
93 }
94 } );
95 lingua = new JLabel( main.stringaLingua );
96 sfondo = new JLabel( main.stringaSfondo );
97 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
98 selezionaLingua = new JComboBox( lingueDaSelezionare );
99 int linguaPreselezionata = 0;
100 if ( main.lang.equals( "it" ) )
101 linguaPreselezionata = 0;
102 else if ( main.lang.equals( "la" ) )
103 linguaPreselezionata = 1;
104 else if ( main.lang.equals( "bl" ) )
105 linguaPreselezionata = 2;
106 else if ( main.lang.equals( "bv" ) )
107 linguaPreselezionata = 3;
108 selezionaLingua.setSelectedIndex( linguaPreselezionata );
109 suono = new JCheckBox( main.stringaSuono );
110 suono.setSelected( main.sound );
111 pannello[0] = new JPanel( new GridLayout( 3, 1 ) );
112 pannello[1] = new JPanel( new FlowLayout() );
113 pannello[2] = new JPanel( new FlowLayout() );
114 pannello[3] = new JPanel( new FlowLayout() );
115 pannello[4] = new JPanel( new FlowLayout() );
116 pannello[4].add( ok );
117 pannello[4].add( annulla );
118 pannello[3].add( sfondo );
119 pannello[3].add( scegliColore );
120 pannello[2].add( suono );
121 pannello[1].add( lingua );
122 pannello[1].add( selezionaLingua );
123 pannello[0].add( pannello[1] );
124 pannello[0].add( pannello[2] );
125 pannello[0].add( pannello[3] );
126 add( pannello[0], BorderLayout.CENTER );
127 add( pannello[4], BorderLayout.SOUTH );
128 }
129}
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/Pannello.java b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Pannello.java
new file mode 100755
index 0000000..24c6596
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/Pannello.java
@@ -0,0 +1,54 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public static Color color;
28 public Pannello() { }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 setBackground( main.color );
32 if ( main.frame.ultimaCarta != null )
33 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
34 if ( main.frame.mazzo )
35 main.frame.retro2.paintIcon( this, g, 17, 256 );
36 if ( main.frame.carteCPU[0] != null )
37 main.frame.retro1.paintIcon( this, g, 230, 5 );
38 if ( main.frame.carteCPU[1] != null )
39 main.frame.retro1.paintIcon( this, g, 300, 5 );
40 if ( main.frame.carteCPU[2] != null )
41 main.frame.retro1.paintIcon( this, g, 370, 5 );
42 if ( main.frame.carteInMano[0] != null )
43 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
44 if ( main.frame.carteInMano[1] != null )
45 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
46 if ( main.frame.carteInMano[2] != null )
47 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
48 if ( main.frame.giocata[0] != null )
49 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
50 if ( main.frame.giocata[1] != null )
51 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
52 }
53}
54
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2 Beta 3/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/Frame.java b/JBriscola/all_versions/0.2/0.2.1/src/Frame.java
new file mode 100755
index 0000000..8379683
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/Frame.java
@@ -0,0 +1,348 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.net.*;
26import java.awt.*;
27import java.awt.event.*;
28
29public class Frame extends JFrame {
30 public static boolean mazzo;
31 public static Main main;
32 public static Pannello pannello;
33 public static JPanel pannello2;
34 public static JButton button;
35 public static JMenuBar barraMenu;
36 public static JMenu file, puntoInterrogativo;
37 public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti, aggiornamenti, tastiRapidi;
38 public static ImageIcon retro1, retro2, ultimaCarta;
39 public static ImageIcon[] giocata = new ImageIcon[2];
40 public static ImageIcon[] carteInMano = new ImageIcon[3];
41 public static ImageIcon[] carteCPU = new ImageIcon[3];
42 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
43 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
44 public Frame() {
45 super( "Tronto's JBriscola " + main.version );
46 mazzo = true;
47 main = new Main();
48 pannello = new Pannello();
49 pannello2 = new JPanel( new FlowLayout() );
50 button = new JButton( main.stringaBottonePrendi );
51 button.addActionListener( new ActionListener() {
52 public void actionPerformed( ActionEvent e ) {
53 if ( giocata[0] != null && giocata[1] != null )
54 main.mano++;
55 try {
56 main.chiPrende();
57 } catch ( Exception ex ) {
58 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
59 }
60 if ( main.mano == 16 )
61 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
62 if ( main.mano == 17 ) {
63 mazzo = false;
64 ultimaCarta = null;
65 pannello.repaint();
66 Frame.this.repaint();
67 }
68 if ( main.mano == 20 ) {
69 String titolo = "";
70 String suonoFinale = "";
71 if ( main.punteggio > main.punteggioCPU ) {
72 titolo = main.stringaVinto;
73 suonoFinale = "sounds/perso.wav";
74 }
75 if ( main.punteggio < main.punteggioCPU ) {
76 titolo = main.stringaPerso;
77 suonoFinale = "sounds/vinto.wav";
78 }
79 if ( main.punteggio == main.punteggioCPU ) {
80 titolo = main.stringaPareggio;
81 suonoFinale = "sounds/pareggio.wav";
82 }
83 if ( main.sound ) {
84 try {
85 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
86 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
87 AudioFormat af = aff.getFormat();
88 DataLine.Info info = new DataLine.Info(
89 Clip.class,
90 ais.getFormat(),
91 ( (int) ais.getFrameLength() *
92 af.getFrameSize() ) );
93 Clip ol = ( Clip ) AudioSystem.getLine( info );
94 ol.open(ais);
95 ol.loop( 0 );
96 } catch ( Exception ex ) {
97 System.err.println( e );
98 }
99 }
100 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
101 }
102 }
103 } );
104 button.addKeyListener( new KeyAdapter() {
105 public void keyReleased( KeyEvent key ) {
106 if ( main.keys ) {
107 switch ( key.getKeyCode() ) {
108 case KeyEvent.VK_1:
109 if ( mettiCarta( 231, 500 ) ) {
110 if ( !main.CPUHaGiocato )
111 main.giocaCPU();
112 }
113 break;
114 case KeyEvent.VK_2:
115 if ( mettiCarta( 301, 500 ) ) {
116 if ( !main.CPUHaGiocato )
117 main.giocaCPU();
118 }
119 break;
120 case KeyEvent.VK_3:
121 if ( mettiCarta( 371, 500 ) ) {
122 if ( !main.CPUHaGiocato )
123 main.giocaCPU();
124 }
125 break;
126 case KeyEvent.VK_F1:
127 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
128 break;
129 case KeyEvent.VK_F2:
130 if ( main.mano == 20 ) {
131 main.mischia();
132 pannello.repaint();
133 repaint();
134 }
135 else {
136 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 );
137 if ( selezione == JOptionPane.YES_OPTION ) {
138 main.mischia();
139 pannello.repaint();
140 repaint();
141 }
142 }
143 break;
144 case KeyEvent.VK_F3:
145 OptionFrame optionFrame = new OptionFrame();
146 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
147 optionFrame.setResizable( false );
148 optionFrame.setAlwaysOnTop( true );
149 optionFrame.setSize( 300, 200 );
150 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
151 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
152 optionFrame.setVisible( true );
153 break;
154 case KeyEvent.VK_F4:
155 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
156 break;
157 case KeyEvent.VK_F5:
158 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
159 break;
160 case KeyEvent.VK_F6:
161 String latest = main.version;
162 try {
163 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
164 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
165 latest = latestIsReader.readLine();
166 } catch ( Exception ex ) {
167 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
168 }
169 if ( latest.equals( main.version ) )
170 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
171 else
172 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
173 break;
174 case KeyEvent.VK_Q:
175 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 );
176 if ( selezione == JOptionPane.YES_OPTION )
177 Frame.this.dispose();
178 break;
179 }
180 }
181 }
182 } );
183 barraMenu = new JMenuBar();
184 file = new JMenu( "File" );
185 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
186 nuovaPartita.addActionListener( new ActionListener() {
187 public void actionPerformed( ActionEvent e ) {
188 if ( main.mano == 20 ) {
189 main.mischia();
190 pannello.repaint();
191 repaint();
192 }
193 else {
194 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 );
195 if ( selezione == JOptionPane.YES_OPTION ) {
196 main.mischia();
197 pannello.repaint();
198 repaint();
199 }
200 }
201 }
202 });
203 opzioni = new JMenuItem( main.stringaOpzioni );
204 opzioni.addActionListener( new ActionListener() {
205 public void actionPerformed( ActionEvent e ) {
206 OptionFrame optionFrame = new OptionFrame();
207 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
208 optionFrame.setResizable( false );
209 optionFrame.setAlwaysOnTop( true );
210 optionFrame.setSize( 300, 200 );
211 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
212 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
213 optionFrame.setVisible( true );
214 }
215 });
216 esci = new JMenuItem( main.stringaEsci );
217 esci.addActionListener( new ActionListener() {
218 public void actionPerformed( ActionEvent e ) {
219 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 );
220 if ( selezione == JOptionPane.YES_OPTION )
221 Frame.this.dispose();
222 }
223 });
224 file.add( nuovaPartita );
225 file.add( opzioni );
226 file.addSeparator();
227 file.add( esci );
228 puntoInterrogativo = new JMenu( "?" );
229 informazioni = new JMenuItem( main.stringaInformazioni );
230 informazioni.addActionListener( new ActionListener() {
231 public void actionPerformed( ActionEvent e ) {
232 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
233 }
234 } );
235 tastiRapidi = new JMenuItem( main.stringaTasti );
236 tastiRapidi.addActionListener( new ActionListener() {
237 public void actionPerformed( ActionEvent e ) {
238 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
239 }
240 } );
241 punti = new JMenuItem( main.stringaPunteggio );
242 punti.addActionListener( new ActionListener() {
243 public void actionPerformed( ActionEvent e ) {
244 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
245 }
246 } );
247 aggiornamenti = new JMenuItem( main.stringaAggiornamenti );
248 aggiornamenti.addActionListener( new ActionListener() {
249 public void actionPerformed( ActionEvent e ) {
250 String latest = main.version;
251 try {
252 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
253 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
254 latest = latestIsReader.readLine();
255 } catch ( Exception ex ) {
256 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
257 }
258 if ( latest.equals( main.version ) )
259 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
260 else
261 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
262 }
263 } );
264 puntoInterrogativo.add( punti );
265 puntoInterrogativo.add( tastiRapidi );
266 puntoInterrogativo.add( informazioni );
267 puntoInterrogativo.add( aggiornamenti );
268 barraMenu.add( file );
269 barraMenu.add( puntoInterrogativo );
270 setJMenuBar( barraMenu );
271 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
272 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
273 for (int i = 0; i < 10; i++)
274 for (int j = 0; j < 4; j++)
275 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
276 main.mischia();
277 pannello2.add( button );
278 setLayout( new BorderLayout() );
279 add( pannello, BorderLayout.CENTER );
280 add( pannello2, BorderLayout.SOUTH );
281 addMouseListener(
282 new MouseAdapter() {
283 public void mouseClicked ( MouseEvent e ) {
284 if ( mettiCarta( e.getX(), e.getY() ) ) {
285 if ( !main.CPUHaGiocato )
286 main.giocaCPU();
287 }
288 }
289 }
290 );
291 addWindowListener(
292 new WindowAdapter() {
293 public void windowClosing( WindowEvent e ) {
294 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 );
295 if ( selezione == JOptionPane.YES_OPTION )
296 System.exit( 0 );
297 }
298 }
299 );
300 }
301 public boolean mettiCarta( int x, int y ) {
302 if ( !main.toccaAllaCPU && giocata[0] == null ) {
303 if ( main.sound &&
304 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
305 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
306 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
307 try {
308 double a = Math.random() * 6;
309 int i = (int) a;
310 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
311 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
312 AudioFormat af = aff.getFormat();
313 DataLine.Info info = new DataLine.Info(
314 Clip.class,
315 ais.getFormat(),
316 ( (int) ais.getFrameLength() *
317 af.getFrameSize() ) );
318 Clip ol = ( Clip ) AudioSystem.getLine( info );
319 ol.open(ais);
320 ol.loop( 0 );
321 } catch ( Exception e ) {
322 System.err.println( e );
323 }
324 }
325 if ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) {
326 giocata[0] = carteInMano[0];
327 carteInMano[0] = null;
328 pannello.repaint();
329 return true;
330 }
331 if ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) {
332 giocata[0] = carteInMano[1];
333 carteInMano[1] = null;
334 pannello.repaint();
335 return true;
336 }
337 if ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) {
338 giocata[0] = carteInMano[2];
339 carteInMano[2] = null;
340 pannello.repaint();
341 return true;
342 }
343 }
344 return false;
345 }
346}
347
348
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/Main.java b/JBriscola/all_versions/0.2/0.2.1/src/Main.java
new file mode 100755
index 0000000..9c0cacf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/Main.java
@@ -0,0 +1,1101 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static boolean sound = true;
33 public static boolean keys = true;
34 public static Frame frame;
35 public static Color color = new Color( 0, 150, 0 );
36 public static String version = "0.2.1";
37 public static String stringaBottonePrendi = "Prendi/Lascia carte";
38 public static String stringaPrimaGioca = "Prima Gioca!";
39 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
40 public static String stringaVinto = "Hai Vinto!";
41 public static String stringaPerso = "Hai Perso";
42 public static String stringaPareggio = "Pareggio";
43 public static String stringaGiocatore = "Giocatore: ";
44 public static String stringaComputer = "\nComputer: ";
45 public static String stringaNuovaPartita = "Nuova Partita";
46 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
47 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
48 public static String stringaSi = "Si";
49 public static String stringaNo = "No";
50 public static String stringaOpzioni = "Opzioni...";
51 public static String stringaEsci = "Esci";
52 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
53 public static String stringaLingua = "Lingua";
54 public static String stringaAnnulla = "Annulla";
55 public static String stringaIt = "Italiano";
56 public static String stringaLa = "Latino";
57 public static String stringaBL = "Dialetto Bellunese";
58 public static String stringaBV = "Dialetto Basso Veneto";
59 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
60 public static String stringaModificaOpzioni = "Modifica Opzioni";
61 public static String stringaInformazioni = "Informazioni";
62 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";
63 public static String stringaSuono = "Effetti Sonori";
64 public static String stringaPunteggio = "Punteggio";
65 public static String stringaSfondo = "Sfondo";
66 public static String stringaTasti = "Tasti rapidi";
67 public static String stringaAggiornamenti = "Cerca aggiornamenti";
68 public static String stringaAggiornamentiSi = "Aggiornamento disponibile: ";
69 public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
70 public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
71 public static String stringaNoInternet = "Errore: nessuna connessione internet";
72 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;
73 public static String lang, soundString, keysString;
74 public static File[] suoni = new File[6];
75 public static File suonoVinto, suonoPerso, suonoPareggio;
76 public static void main( String args[] ) {
77 settaOpzioni();
78 frame = new Frame();
79 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
80 frame.setResizable( false );
81 frame.setSize( 600, 600 );
82 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
83 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
84 frame.setVisible( true );
85 }
86 public void mischia() {
87 mano = 0;
88 punteggio = 0;
89 punteggioCPU = 0;
90 cartaDaPescare = 6;
91 ImageIcon aux;
92 frame.mazzo = true;
93 toccaAllaCPU = false;
94 CPUHaGiocato = false;
95 haGiocatoPrima = true;
96 for ( int i = 0, k = 0; i < 10; i++ )
97 for ( int j = 0; j < 4; j++, k++ )
98 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
99 for ( int i = 0; i < 391; i++ ) {
100 double a = Math.random() * 40;
101 int x = (int) a;
102 double b = Math.random() * 40;
103 int y = (int) b;
104 aux = frame.arrayCarteMescolate[x];
105 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
106 frame.arrayCarteMescolate[y] = aux;
107 }
108 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
109 semeBriscola = auxChar[auxChar.length-5] - 49;
110 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
111 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
112 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
113 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
114 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
115 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
116 frame.ultimaCarta = frame.arrayCarteMescolate[39];
117 frame.giocata[0] = null;
118 frame.giocata[1] = null;
119 }
120 public void giocaCPU() {
121 if ( mano < 16 ) {
122 if ( frame.giocata[0] == null ) {
123 if ( vaiPunti() );
124 else if ( vaiLiscio() );
125 else if ( vaiTaglio() );
126 else if ( vaiBriscolaAlta() );
127 else if ( vaiCarico() );
128 else if ( vaiTre() );
129 else if ( vaiAsso() );
130 else;
131 }
132 else {
133 if ( haLisciato() ) {
134 if ( vaiSopra() );
135 else if ( vaiLiscio() );
136 else if ( vaiPunti() );
137 else if ( vaiTaglio() );
138 else if ( vaiTre() );
139 else if ( vaiBriscolaAlta() );
140 else if ( vaiCarico() );
141 else if ( vaiAsso() );
142 } else if ( haMessoPunti() ) {
143 if ( vaiSopra() );
144 else if ( vaiLiscio() );
145 else if ( vaiTaglio() );
146 else if ( vaiPunti() );
147 else if ( vaiTre() );
148 else if ( vaiBriscolaAlta() );
149 else if ( vaiCarico() );
150 else if ( vaiAsso() );
151 } else if ( haTagliato() ) {
152 if ( vaiLiscio() );
153 else if ( vaiPunti() );
154 else if ( vaiTaglio() );
155 else if ( vaiTre() );
156 else if ( vaiBriscolaAlta() );
157 else if ( vaiCarico() );
158 else if ( vaiAsso() );
159 } else if ( haMessoBriscolaAlta() ) {
160 if ( vaiLiscio() );
161 else if ( vaiPunti() );
162 else if ( vaiTre() );
163 else if ( vaiTaglio() );
164 else if ( vaiBriscolaAlta() );
165 else if ( vaiCarico() );
166 else if ( vaiAsso() );
167 } else if ( haMessoTre() ) {
168 if ( vaiAsso() );
169 else if ( vaiLiscio() );
170 else if ( vaiPunti() );
171 else if ( vaiTaglio() );
172 else if ( vaiBriscolaAlta() );
173 else if ( vaiCarico() );
174 } else if ( haMessoAsso() ) {
175 if ( vaiLiscio() );
176 else if ( vaiPunti() );
177 else if ( vaiTaglio() );
178 else if ( vaiBriscolaAlta() );
179 else if ( vaiCarico() );
180 else if ( vaiTre() );
181 } else if ( haCaricato() ) {
182 if ( vaiSopra() );
183 else if ( vaiTre() );
184 else if ( vaiBriscolaAlta() );
185 else if ( vaiAsso() );
186 else if ( vaiTaglio() );
187 else if ( vaiLiscio() );
188 else if ( vaiPunti() );
189 else if ( vaiCarico() );
190 }
191 }
192 }
193 else if ( mano == 16 ) {
194 if ( frame.giocata[0] == null ) {
195 char aux[];
196 aux = frame.ultimaCarta.toString().toCharArray();
197 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
198 if ( vaiCarico() );
199 else if ( vaiPunti() );
200 else if ( vaiLiscio() );
201 else if ( vaiTaglio() );
202 else if ( vaiBriscolaAlta() );
203 else if ( vaiTre() );
204 else if ( vaiAsso() );
205 else;
206 } else {
207 if ( vaiPunti() );
208 else if ( vaiLiscio() );
209 else if ( vaiTaglio() );
210 else if ( vaiBriscolaAlta() );
211 else if ( vaiCarico() );
212 else if ( vaiTre() );
213 else if ( vaiAsso() );
214 else;
215 }
216 }
217 else {
218 char aux[];
219 aux = frame.ultimaCarta.toString().toCharArray();
220 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
221 if ( haCaricato() ) {
222 if ( vaiSopra() );
223 else if ( vaiLiscio() );
224 else if ( vaiPunti() );
225 else if ( vaiTre() );
226 else if ( vaiTaglio() );
227 else if ( vaiBriscolaAlta() );
228 else if ( vaiAsso() );
229 else if ( vaiCarico() );
230 }
231 } else {
232 if ( haLisciato() ) {
233 if ( vaiSopra() );
234 else if ( vaiLiscio() );
235 else if ( vaiPunti() );
236 else if ( vaiTaglio() );
237 else if ( vaiTre() );
238 else if ( vaiBriscolaAlta() );
239 else if ( vaiCarico() );
240 else if ( vaiAsso() );
241 } else if ( haMessoPunti() ) {
242 if ( vaiSopra() );
243 else if ( vaiLiscio() );
244 else if ( vaiTaglio() );
245 else if ( vaiPunti() );
246 else if ( vaiTre() );
247 else if ( vaiBriscolaAlta() );
248 else if ( vaiCarico() );
249 else if ( vaiAsso() );
250 } else if ( haTagliato() ) {
251 if ( vaiLiscio() );
252 else if ( vaiPunti() );
253 else if ( vaiTaglio() );
254 else if ( vaiTre() );
255 else if ( vaiBriscolaAlta() );
256 else if ( vaiCarico() );
257 else if ( vaiAsso() );
258 } else if ( haMessoBriscolaAlta() ) {
259 if ( vaiLiscio() );
260 else if ( vaiPunti() );
261 else if ( vaiTre() );
262 else if ( vaiTaglio() );
263 else if ( vaiBriscolaAlta() );
264 else if ( vaiCarico() );
265 else if ( vaiAsso() );
266 } else if ( haMessoTre() ) {
267 if ( vaiAsso() );
268 else if ( vaiLiscio() );
269 else if ( vaiPunti() );
270 else if ( vaiTaglio() );
271 else if ( vaiBriscolaAlta() );
272 else if ( vaiCarico() );
273 } else if ( haMessoAsso() ) {
274 if ( vaiLiscio() );
275 else if ( vaiPunti() );
276 else if ( vaiTaglio() );
277 else if ( vaiBriscolaAlta() );
278 else if ( vaiCarico() );
279 else if ( vaiTre() );
280 } else if ( haCaricato() ) {
281 if ( vaiSopra() );
282 else if ( vaiTre() );
283 else if ( vaiBriscolaAlta() );
284 else if ( vaiAsso() );
285 else if ( vaiTaglio() );
286 else if ( vaiLiscio() );
287 else if ( vaiPunti() );
288 else if ( vaiCarico() );
289 }
290 }
291 }
292 } else if ( mano == 17 ) {
293 if ( frame.giocata[0] == null ) {
294 if ( hoAsso() ) {
295 if ( vaiTre() );
296 else if ( vaiBriscolaAlta() );
297 else if ( vaiTaglio() );
298 else if ( vaiLiscio() );
299 else if ( vaiPunti() );
300 else if ( vaiAsso() );
301 else if ( vaiCarico() );
302 } else {
303 if ( vaiLiscio() );
304 else if ( vaiPunti() );
305 else if ( vaiTaglio() );
306 else if ( vaiBriscolaAlta() );
307 else if ( vaiCarico() );
308 else if ( vaiTre() );
309 }
310 }
311 else {
312 if ( haLisciato() ) {
313 if ( vaiSopra() );
314 else if ( vaiLiscio() );
315 else if ( vaiPunti() );
316 else if ( vaiTaglio() );
317 else if ( vaiTre() );
318 else if ( vaiBriscolaAlta() );
319 else if ( vaiCarico() );
320 else if ( vaiAsso() );
321 } else if ( haMessoPunti() ) {
322 if ( vaiSopra() );
323 else if ( vaiLiscio() );
324 else if ( vaiTaglio() );
325 else if ( vaiPunti() );
326 else if ( vaiTre() );
327 else if ( vaiBriscolaAlta() );
328 else if ( vaiCarico() );
329 else if ( vaiAsso() );
330 } else if ( haTagliato() ) {
331 if ( vaiLiscio() );
332 else if ( vaiPunti() );
333 else if ( vaiTaglio() );
334 else if ( vaiTre() );
335 else if ( vaiBriscolaAlta() );
336 else if ( vaiCarico() );
337 else if ( vaiAsso() );
338 } else if ( haMessoBriscolaAlta() ) {
339 if ( vaiLiscio() );
340 else if ( vaiPunti() );
341 else if ( vaiTre() );
342 else if ( vaiTaglio() );
343 else if ( vaiBriscolaAlta() );
344 else if ( vaiCarico() );
345 else if ( vaiAsso() );
346 } else if ( haMessoTre() ) {
347 if ( vaiAsso() );
348 else if ( vaiLiscio() );
349 else if ( vaiPunti() );
350 else if ( vaiTaglio() );
351 else if ( vaiBriscolaAlta() );
352 else if ( vaiCarico() );
353 } else if ( haMessoAsso() ) {
354 if ( vaiLiscio() );
355 else if ( vaiPunti() );
356 else if ( vaiTaglio() );
357 else if ( vaiBriscolaAlta() );
358 else if ( vaiCarico() );
359 else if ( vaiTre() );
360 } else if ( haCaricato() ) {
361 if ( vaiSopra() );
362 else if ( vaiTre() );
363 else if ( vaiBriscolaAlta() );
364 else if ( vaiAsso() );
365 else if ( vaiTaglio() );
366 else if ( vaiLiscio() );
367 else if ( vaiPunti() );
368 else if ( vaiCarico() );
369 }
370 }
371 } else if ( mano == 18 ) {
372 if ( frame.giocata[0] == null ) {
373 if ( vaiAsso() );
374 else if ( vaiCarico() );
375 else if ( vaiBriscolaAlta() );
376 else if ( vaiTaglio() );
377 else if ( vaiPunti() );
378 else if ( vaiLiscio() );
379 else if ( vaiTre() );
380 }
381 else {
382 if ( haLisciato() ) {
383 if ( vaiSopra() );
384 else if ( vaiLiscio() );
385 else if ( vaiPunti() );
386 else if ( vaiTaglio() );
387 else if ( vaiTre() );
388 else if ( vaiBriscolaAlta() );
389 else if ( vaiCarico() );
390 else if ( vaiAsso() );
391 } else if ( haMessoPunti() ) {
392 if ( vaiSopra() );
393 else if ( vaiLiscio() );
394 else if ( vaiTaglio() );
395 else if ( vaiPunti() );
396 else if ( vaiTre() );
397 else if ( vaiBriscolaAlta() );
398 else if ( vaiCarico() );
399 else if ( vaiAsso() );
400 } else if ( haTagliato() ) {
401 if ( vaiLiscio() );
402 else if ( vaiPunti() );
403 else if ( vaiTaglio() );
404 else if ( vaiTre() );
405 else if ( vaiBriscolaAlta() );
406 else if ( vaiCarico() );
407 else if ( vaiAsso() );
408 } else if ( haMessoBriscolaAlta() ) {
409 if ( vaiLiscio() );
410 else if ( vaiPunti() );
411 else if ( vaiTre() );
412 else if ( vaiTaglio() );
413 else if ( vaiBriscolaAlta() );
414 else if ( vaiCarico() );
415 else if ( vaiAsso() );
416 } else if ( haMessoTre() ) {
417 if ( vaiAsso() );
418 else if ( vaiLiscio() );
419 else if ( vaiPunti() );
420 else if ( vaiTaglio() );
421 else if ( vaiBriscolaAlta() );
422 else if ( vaiCarico() );
423 } else if ( haMessoAsso() ) {
424 if ( vaiLiscio() );
425 else if ( vaiPunti() );
426 else if ( vaiTaglio() );
427 else if ( vaiBriscolaAlta() );
428 else if ( vaiCarico() );
429 else if ( vaiTre() );
430 } else if ( haCaricato() ) {
431 if ( vaiSopra() );
432 else if ( vaiTre() );
433 else if ( vaiBriscolaAlta() );
434 else if ( vaiAsso() );
435 else if ( vaiTaglio() );
436 else if ( vaiLiscio() );
437 else if ( vaiPunti() );
438 else if ( vaiCarico() );
439 }
440 }
441 } else {
442 if ( vaiTre() );
443 else if ( vaiBriscolaAlta() );
444 else if ( vaiAsso() );
445 else if ( vaiTaglio() );
446 else if ( vaiLiscio() );
447 else if ( vaiPunti() );
448 else if ( vaiCarico() );
449 }
450 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
451 frame.carteCPU[cartaDaGiocare] = null;
452 frame.pannello.repaint();
453 CPUHaGiocato = true;
454 if ( frame.giocata[0] == null )
455 toccaAllaCPU = false;
456 }
457 public void chiPrende() {
458 char aux[], auxCPU[];
459 aux = frame.giocata[0].toString().toCharArray();
460 auxCPU = frame.giocata[1].toString().toCharArray();
461 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
462 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
463 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
464 }
465 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
466 int a, b;
467 switch ( prima ) {
468 case 0:
469 a = 10;
470 break;
471 case 1:
472 a = 12;
473 break;
474 case 3:
475 a = 11;
476 break;
477 default:
478 a = prima;
479 break;
480 }
481 switch ( seconda ) {
482 case 0:
483 b = 10;
484 break;
485 case 1:
486 b = 12;
487 break;
488 case 3:
489 b = 11;
490 break;
491 default:
492 b = seconda;
493 break;
494 }
495 return a > b;
496 }
497 public void giocatorePrende( boolean giocatore ) {
498 if ( giocatore ) {
499 toccaAllaCPU = CPUHaGiocato = false;
500 haGiocatoPrima = true;
501 }
502 else {
503 toccaAllaCPU = true;
504 CPUHaGiocato = haGiocatoPrima = false;
505 }
506 daiPunti( giocatore );
507 if ( toccaAllaCPU )
508 giocaCPU();
509 }
510 public void daiPunti( boolean giocatore ) {
511 char aux[], auxCPU[];
512 aux = frame.giocata[0].toString().toCharArray();
513 auxCPU = frame.giocata[1].toString().toCharArray();
514 int punti = 0;
515 switch( aux[aux.length-7] - 48 ) {
516 case 0:
517 punti += 4;
518 break;
519 case 1:
520 punti += 11;
521 break;
522 case 3:
523 punti += 10;
524 break;
525 case 8:
526 punti += 2;
527 break;
528 case 9:
529 punti += 3;
530 break;
531 default:
532 break;
533 }
534 switch( auxCPU[auxCPU.length-7] - 48 ) {
535 case 0:
536 punti += 4;
537 break;
538 case 1:
539 punti += 11;
540 break;
541 case 3:
542 punti += 10;
543 break;
544 case 8:
545 punti += 2;
546 break;
547 case 9:
548 punti += 3;
549 break;
550 default:
551 break;
552 }
553 frame.giocata[0] = frame.giocata[1] = null;
554 if ( giocatore ) {
555 punteggio += punti;
556 if ( mano < 18 ) {
557 if ( frame.carteInMano[0] == null )
558 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
559 if ( frame.carteInMano[1] == null )
560 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
561 if ( frame.carteInMano[2] == null )
562 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
563 cartaDaPescare++;
564 if ( frame.carteCPU[0] == null )
565 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
566 if ( frame.carteCPU[1] == null )
567 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
568 if ( frame.carteCPU[2] == null )
569 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
570 cartaDaPescare++;
571 }
572 }
573 else {
574 punteggioCPU += punti;
575 if ( mano < 18 ) {
576 if ( frame.carteCPU[0] == null )
577 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
578 if ( frame.carteCPU[1] == null )
579 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
580 if ( frame.carteCPU[2] == null )
581 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
582 cartaDaPescare++;
583 if ( frame.carteInMano[0] == null )
584 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
585 if ( frame.carteInMano[1] == null )
586 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
587 if ( frame.carteInMano[2] == null )
588 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
589 cartaDaPescare++;
590 }
591 }
592 frame.pannello.repaint();
593 frame.repaint();
594 }
595 public boolean haLisciato() {
596 char auxCPU[];
597 auxCPU = frame.giocata[0].toString().toCharArray();
598 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
599 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
600 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
601 }
602 public boolean haMessoPunti() {
603 char auxCPU[];
604 auxCPU = frame.giocata[0].toString().toCharArray();
605 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
606 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
607 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
608 }
609 public boolean haTagliato() {
610 char auxCPU[];
611 auxCPU = frame.giocata[0].toString().toCharArray();
612 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
613 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
614 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
615 }
616 public boolean haMessoBriscolaAlta() {
617 char auxCPU[];
618 auxCPU = frame.giocata[0].toString().toCharArray();
619 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
620 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
621 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
622 }
623 public boolean haMessoTre() {
624 char auxCPU[];
625 auxCPU = frame.giocata[0].toString().toCharArray();
626 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
627 (auxCPU[auxCPU.length-7] - 48 == 3) );
628 }
629 public boolean haMessoAsso() {
630 char auxCPU[];
631 auxCPU = frame.giocata[0].toString().toCharArray();
632 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
633 (auxCPU[auxCPU.length-7] - 48 == 1) );
634 }
635 public boolean haCaricato() {
636 char auxCPU[];
637 auxCPU = frame.giocata[0].toString().toCharArray();
638 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
639 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
640 }
641 public boolean vaiLiscio() {
642 char auxCPU[];
643 for ( int i = 0; i < 3; i++ ) {
644 if ( frame.carteCPU[i] != null ) {
645 auxCPU = frame.carteCPU[i].toString().toCharArray();
646 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
647 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
648 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
649 cartaDaGiocare = i;
650 return true;
651 }
652 }
653 }
654 return false;
655 }
656 public boolean vaiPunti() {
657 char[] auxCPU;
658 for ( int i = 0; i < 3; i++ ) {
659 if ( frame.carteCPU[i] != null ) {
660 auxCPU = frame.carteCPU[i].toString().toCharArray();
661 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
662 cartaDaGiocare = i;
663 return true;
664 }
665 }
666 }
667 for ( int i = 0; i < 3; i++ ) {
668 if ( frame.carteCPU[i] != null ) {
669 auxCPU = frame.carteCPU[i].toString().toCharArray();
670 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
671 cartaDaGiocare = i;
672 return true;
673 }
674 }
675 }
676 for ( int i = 0; i < 3; i++ ) {
677 if ( frame.carteCPU[i] != null ) {
678 auxCPU = frame.carteCPU[i].toString().toCharArray();
679 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
680 cartaDaGiocare = i;
681 return true;
682 }
683 }
684 }
685 return false;
686 }
687 public boolean vaiTaglio() {
688 char auxCPU[];
689 for ( int i = 0; i < 3; i++ ) {
690 if ( frame.carteCPU[i] != null ) {
691 auxCPU = frame.carteCPU[i].toString().toCharArray();
692 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
693 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
694 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
695 cartaDaGiocare = i;
696 return true;
697 }
698 }
699 }
700 return false;
701 }
702 public boolean vaiBriscolaAlta() {
703 char[] auxCPU;
704 for ( int i = 0; i < 3; i++ ) {
705 if ( frame.carteCPU[i] != null ) {
706 auxCPU = frame.carteCPU[i].toString().toCharArray();
707 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
708 cartaDaGiocare = i;
709 return true;
710 }
711 }
712 }
713 for ( int i = 0; i < 3; i++ ) {
714 if ( frame.carteCPU[i] != null ) {
715 auxCPU = frame.carteCPU[i].toString().toCharArray();
716 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
717 cartaDaGiocare = i;
718 return true;
719 }
720 }
721 }
722 for ( int i = 0; i < 3; i++ ) {
723 if ( frame.carteCPU[i] != null ) {
724 auxCPU = frame.carteCPU[i].toString().toCharArray();
725 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
726 cartaDaGiocare = i;
727 return true;
728 }
729 }
730 }
731 return false;
732 }
733 public boolean vaiTre() {
734 char auxCPU[];
735 for ( int i = 0; i < 3; i++ ) {
736 if ( frame.carteCPU[i] != null ) {
737 auxCPU = frame.carteCPU[i].toString().toCharArray();
738 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
739 cartaDaGiocare = i;
740 return true;
741 }
742 }
743 }
744 return false;
745 }
746 public boolean vaiAsso() {
747 char auxCPU[];
748 for ( int i = 0; i < 3; i++ ) {
749 if ( frame.carteCPU[i] != null ) {
750 auxCPU = frame.carteCPU[i].toString().toCharArray();
751 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
752 cartaDaGiocare = i;
753 return true;
754 }
755 }
756 }
757 return false;
758 }
759 public boolean vaiCarico() {
760 char[] auxCPU;
761 for ( int i = 0; i < 3; i++ ) {
762 if ( frame.carteCPU[i] != null ) {
763 auxCPU = frame.carteCPU[i].toString().toCharArray();
764 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
765 cartaDaGiocare = i;
766 return true;
767 }
768 }
769 }
770 for ( int i = 0; i < 3; i++ ) {
771 if ( frame.carteCPU[i] != null ) {
772 auxCPU = frame.carteCPU[i].toString().toCharArray();
773 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
774 cartaDaGiocare = i;
775 return true;
776 }
777 }
778 }
779 return false;
780 }
781 public boolean vaiSopra() {
782 if ( frame.giocata[0] == null )
783 return false;
784 int a = -1;
785 int b = -1;
786 int c = -1;
787 boolean laPrimaPuoAndareSopra = false;
788 boolean laSecondaPuoAndareSopra = false;
789 boolean laTerzaPuoAndareSopra = false;
790 char[] auxCPU1 = new char[1024];
791 char[] auxCPU2 = new char[1024];
792 char[] auxCPU3 = new char[1024];
793 char[] aux = frame.giocata[0].toString().toCharArray();
794 if ( aux[aux.length-7] - 48 == 1 )
795 return false;
796 if ( frame.carteCPU[0] != null ) {
797 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
798 a = auxCPU1[auxCPU1.length-7] - 48;
799 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
800 laPrimaPuoAndareSopra = true;
801 }
802 if ( frame.carteCPU[1] != null ) {
803 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
804 b = auxCPU2[auxCPU2.length-7] - 48;
805 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
806 laSecondaPuoAndareSopra = true;
807 }
808 if ( frame.carteCPU[2] != null ) {
809 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
810 c = auxCPU3[auxCPU3.length-7] - 48;
811 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
812 laTerzaPuoAndareSopra = true;
813 }
814 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
815 return false;
816 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
817 cartaDaGiocare = 0;
818 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
819 cartaDaGiocare = 1;
820 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
821 cartaDaGiocare = 2;
822 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
823 if ( laPrimaEPiuAlta( a, b ) )
824 cartaDaGiocare = 0;
825 else
826 cartaDaGiocare = 1;
827 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
828 if ( laPrimaEPiuAlta( b, c ) )
829 cartaDaGiocare = 1;
830 else
831 cartaDaGiocare = 2;
832 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
833 if ( laPrimaEPiuAlta( a, c ) )
834 cartaDaGiocare = 0;
835 else
836 cartaDaGiocare = 2;
837 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
838 if ( laPrimaEPiuAlta( a, b ) )
839 if ( laPrimaEPiuAlta( a, c ) )
840 cartaDaGiocare = 0;
841 else
842 cartaDaGiocare = 2;
843 else
844 if ( laPrimaEPiuAlta( b, c ) )
845 cartaDaGiocare = 1;
846 else
847 cartaDaGiocare = 2;
848 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
849 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
850 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
851 return false;
852 return true;
853 }
854 public boolean hoCarico() {
855 char auxCPU[];
856 for ( int i = 0; i < 3; i++ ) {
857 if ( frame.carteCPU[i] != null ) {
858 auxCPU = frame.carteCPU[i].toString().toCharArray();
859 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
860 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
861 return true;
862 }
863 }
864 }
865 return false;
866 }
867 public boolean hoAsso() {
868 char auxCPU[];
869 for ( int i = 0; i < 3; i++ ) {
870 if ( frame.carteCPU[i] != null ) {
871 auxCPU = frame.carteCPU[i].toString().toCharArray();
872 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
873 return true;
874 }
875 }
876 }
877 return false;
878 }
879 public boolean hoTre() {
880 char auxCPU[];
881 for ( int i = 0; i < 3; i++ ) {
882 if ( frame.carteCPU[i] != null ) {
883 auxCPU = frame.carteCPU[i].toString().toCharArray();
884 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
885 return true;
886 }
887 }
888 }
889 return false;
890 }
891 public boolean hoBriscolaAlta() {
892 char auxCPU[];
893 for ( int i = 0; i < 3; i++ ) {
894 if ( frame.carteCPU[i] != null ) {
895 auxCPU = frame.carteCPU[i].toString().toCharArray();
896 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
897 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
898 return true;
899 }
900 }
901 }
902 return false;
903 }
904 public boolean hoTaglio() {
905 char auxCPU[];
906 for ( int i = 0; i < 3; i++ ) {
907 if ( frame.carteCPU[i] != null ) {
908 auxCPU = frame.carteCPU[i].toString().toCharArray();
909 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
910 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
911 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
912 return true;
913 }
914 }
915 }
916 return false;
917 }
918 public static void settaOpzioni() {
919 lang = "it";
920 soundString = "suono=si";
921 keysString = "tasti=si";
922 int r = 0;
923 int g = 150;
924 int b = 0;
925 Scanner scanner = null;
926 File file = new File( "JBriscolaConfig.txt" );
927 if ( file.exists() ) {
928 try {
929 scanner = new Scanner( file );
930 } catch ( FileNotFoundException e ) { }
931 try {
932 lang = scanner.next();
933 soundString = scanner.next();
934 keysString = scanner.next();
935 r = scanner.nextInt();
936 g = scanner.nextInt();
937 b = scanner.nextInt();
938 } catch ( NoSuchElementException e ) { }
939 }
940 if ( lang.equals( "it" ) ) {
941 stringaBottonePrendi = "Prendi/Lascia carte";
942 stringaPrimaGioca = "Prima Gioca!";
943 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
944 stringaVinto = "Hai Vinto!";
945 stringaPerso = "Hai Perso";
946 stringaPareggio = "Pareggio";
947 stringaGiocatore = "Giocatore: ";
948 stringaComputer = "\nComputer: ";
949 stringaNuovaPartita = "Nuova Partita";
950 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
951 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
952 stringaSi = "Si";
953 stringaNo = "No";
954 stringaOpzioni = "Opzioni...";
955 stringaEsci = "Esci";
956 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
957 stringaLingua = "Lingua";
958 stringaAnnulla = "Annulla";
959 stringaIt = "Italiano";
960 stringaLa = "Latino";
961 stringaBL = "Dialetto Bellunese";
962 stringaBV = "Dialetto Basso Veneto";
963 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
964 stringaModificaOpzioni = "Modifica Opzioni";
965 stringaInformazioni = "Informazioni";
966 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";
967 stringaSuono = "Effetti sonori";
968 stringaPunteggio = "Punteggio";
969 stringaSfondo = "Sfondo";
970 stringaTasti = "Tasti rapidi";
971 stringaAggiornamenti = "Cerca aggiornamenti";
972 stringaAggiornamentiSi = "Aggiornamento disponibile: ";
973 stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
974 stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
975 stringaNoInternet = "Errore: nessuna connessione internet";
976 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;
977 }
978 else if ( lang.equals( "la" ) ) {
979 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
980 stringaPrimaGioca = "ANTE CHARTAM PONE!";
981 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
982 stringaVinto = "VICISTI!";
983 stringaPerso = "PERDIDISTI";
984 stringaPareggio = "AEQVATIO!";
985 stringaGiocatore = "LVSOR: ";
986 stringaComputer = "\nCOMPVTER: ";
987 stringaNuovaPartita = "NOVA LVSO";
988 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
989 stringaVuoiDavveroUscire = "EXIRE?";
990 stringaSi = "ID VOLO";
991 stringaNo = "NOLO";
992 stringaOpzioni = "OPTIONES...";
993 stringaEsci = "EXIRE";
994 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
995 stringaLingua = "LINGVA";
996 stringaAnnulla = "ABROGA";
997 stringaIt = "ITALICA";
998 stringaLa = "LATINA";
999 stringaBL = "BELLUNI";
1000 stringaBV = "VENETIAE";
1001 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
1002 stringaModificaOpzioni = "OPTIONES NOVARE";
1003 stringaInformazioni = "INFORMATIONES";
1004 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";
1005 stringaSuono = "SONVS";
1006 stringaPunteggio = "NVMERI";
1007 stringaSfondo = "COLOR";
1008 stringaTasti = "TASTI RAPIDI";
1009 stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE";
1010 stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST";
1011 stringaAggiornamentiSi = "VERSIO RECENTIOR EST: ";
1012 stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST";
1013 stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html";
1014 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;
1015 }
1016 if ( lang.equals( "bl" ) ) {
1017 stringaBottonePrendi = "Cio' su/lasa le carte";
1018 stringaPrimaGioca = "Prima Duga!";
1019 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1020 stringaVinto = "Te ha vint!";
1021 stringaPerso = "Te ha pers";
1022 stringaPareggio = "Pari";
1023 stringaGiocatore = "Dugador: ";
1024 stringaComputer = "\nComputer: ";
1025 stringaNuovaPartita = "Taca n'altra partida";
1026 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1027 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1028 stringaSi = "Si";
1029 stringaNo = "No";
1030 stringaOpzioni = "Opzioni...";
1031 stringaEsci = "Stusa su";
1032 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1033 stringaLingua = "Lengua";
1034 stringaAnnulla = "Annulla";
1035 stringaIt = "Italian";
1036 stringaLa = "Latin";
1037 stringaBL = "Dialeto de Belun";
1038 stringaBV = "Dialeto de la basa";
1039 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
1040 stringaModificaOpzioni = "Modifica Opzioni";
1041 stringaInformazioni = "Informazioni";
1042 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";
1043 stringaSuono = "Efeti sonori";
1044 stringaPunteggio = "Varda i punti";
1045 stringaSfondo = "Sfondo";
1046 stringaTasti = "Tasti rapidi";
1047 stringaAggiornamenti = "Varda se ghe ne' na version pi nova";
1048 stringaAggiornamentiSi = "Ghe ne' na version pi nova: ";
1049 stringaAggiornamentiNo = "No ghe ne na version pi nova";
1050 stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1051 stringaNoInternet = "Erore: no te se su internet";
1052 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;
1053 }
1054 if ( lang.equals( "bv" ) ) {
1055 stringaBottonePrendi = "Ciapa su/lasa e carte";
1056 stringaPrimaGioca = "Prima Zuga!";
1057 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1058 stringaVinto = "Ti ga vinto!";
1059 stringaPerso = "Ti ga perso";
1060 stringaPareggio = "Pari";
1061 stringaGiocatore = "Zugador: ";
1062 stringaComputer = "\nComputer: ";
1063 stringaNuovaPartita = "N'altra Partida";
1064 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1065 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1066 stringaSi = "Si";
1067 stringaNo = "No";
1068 stringaOpzioni = "Opzioni...";
1069 stringaEsci = "Stusa su";
1070 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1071 stringaLingua = "Lengua";
1072 stringaAnnulla = "Annulla";
1073 stringaIt = "Italian";
1074 stringaLa = "Latin";
1075 stringaBL = "Dialeto Belumat";
1076 stringaBV = "Dialeto Veneto";
1077 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
1078 stringaModificaOpzioni = "Modifica Opzioni";
1079 stringaInformazioni = "Informasioni";
1080 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";
1081 stringaSuono = "Efeti sonori";
1082 stringaPunteggio = "Varda i punti";
1083 stringaSfondo = "Sfondo";
1084 stringaTasti = "Tasti rapidi";
1085 stringaAggiornamenti = "Varda se xe ne' na versione pi nova";
1086 stringaAggiornamentiSi = "Ghe xe na versione pi nova: ";
1087 stringaAggiornamentiNo = "No ghe xe na versione pi nova";
1088 stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1089 stringaNoInternet = "Erore: no ti xe su internet";
1090 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;
1091 }
1092 sound = ( soundString.equals( "suono=si" ) );
1093 keys = ( keysString.equals( "tasti=si" ) );
1094 color = new Color( r, g, b );
1095 if ( frame != null ) {
1096 frame.pannello.repaint();
1097 frame.pannello2.repaint();
1098 frame.repaint();
1099 }
1100 }
1101}
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
new file mode 100755
index 0000000..f41606e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
@@ -0,0 +1,140 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono, tastiRapidi;
34 public static JPanel[] pannello = new JPanel[6];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono, tastisiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 if ( tastiRapidi.isSelected() )
69 tastisiono = "tasti=si";
70 else
71 tastisiono = "tasti=no";
72 formatter.format( lang );
73 formatter.format( "\n" );
74 formatter.format( suonosiono );
75 formatter.format( "\n" );
76 formatter.format( tastisiono );
77 formatter.format( "\n" );
78 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
79 formatter.close();
80 main.settaOpzioni();
81 OptionFrame.this.dispose();
82 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
83 }
84 });
85 annulla = new JButton( main.stringaAnnulla );
86 annulla.addActionListener( new ActionListener() {
87 public void actionPerformed( ActionEvent e ) {
88 OptionFrame.this.dispose();
89 }
90 });
91 scegliColore = new JButton( " " );
92 scegliColore.setBackground( main.color );
93 scegliColore.addActionListener( new ActionListener() {
94 public void actionPerformed( ActionEvent e ) {
95 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
96 if ( colore != null )
97 main.color = colore;
98 OptionFrame.scegliColore.setBackground( main.color );
99 }
100 } );
101 lingua = new JLabel( main.stringaLingua );
102 sfondo = new JLabel( main.stringaSfondo );
103 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
104 selezionaLingua = new JComboBox( lingueDaSelezionare );
105 int linguaPreselezionata = 0;
106 if ( main.lang.equals( "it" ) )
107 linguaPreselezionata = 0;
108 else if ( main.lang.equals( "la" ) )
109 linguaPreselezionata = 1;
110 else if ( main.lang.equals( "bl" ) )
111 linguaPreselezionata = 2;
112 else if ( main.lang.equals( "bv" ) )
113 linguaPreselezionata = 3;
114 selezionaLingua.setSelectedIndex( linguaPreselezionata );
115 suono = new JCheckBox( main.stringaSuono );
116 suono.setSelected( main.sound );
117 tastiRapidi = new JCheckBox( main.stringaTasti );
118 tastiRapidi.setSelected( main.keys );
119 pannello[0] = new JPanel( new GridLayout( 4, 1 ) );
120 pannello[1] = new JPanel( new FlowLayout() );
121 pannello[2] = new JPanel( new FlowLayout() );
122 pannello[3] = new JPanel( new FlowLayout() );
123 pannello[4] = new JPanel( new FlowLayout() );
124 pannello[5] = new JPanel( new FlowLayout() );
125 pannello[5].add( ok );
126 pannello[5].add( annulla );
127 pannello[4].add( sfondo );
128 pannello[4].add( scegliColore );
129 pannello[3].add( tastiRapidi );
130 pannello[2].add( suono );
131 pannello[1].add( lingua );
132 pannello[1].add( selezionaLingua );
133 pannello[0].add( pannello[1] );
134 pannello[0].add( pannello[2] );
135 pannello[0].add( pannello[3] );
136 pannello[0].add( pannello[4] );
137 add( pannello[0], BorderLayout.CENTER );
138 add( pannello[5], BorderLayout.SOUTH );
139 }
140}
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/Pannello.java b/JBriscola/all_versions/0.2/0.2.1/src/Pannello.java
new file mode 100755
index 0000000..24c6596
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/Pannello.java
@@ -0,0 +1,54 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public static Color color;
28 public Pannello() { }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 setBackground( main.color );
32 if ( main.frame.ultimaCarta != null )
33 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
34 if ( main.frame.mazzo )
35 main.frame.retro2.paintIcon( this, g, 17, 256 );
36 if ( main.frame.carteCPU[0] != null )
37 main.frame.retro1.paintIcon( this, g, 230, 5 );
38 if ( main.frame.carteCPU[1] != null )
39 main.frame.retro1.paintIcon( this, g, 300, 5 );
40 if ( main.frame.carteCPU[2] != null )
41 main.frame.retro1.paintIcon( this, g, 370, 5 );
42 if ( main.frame.carteInMano[0] != null )
43 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
44 if ( main.frame.carteInMano[1] != null )
45 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
46 if ( main.frame.carteInMano[2] != null )
47 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
48 if ( main.frame.giocata[0] != null )
49 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
50 if ( main.frame.giocata[1] != null )
51 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
52 }
53}
54
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2.1/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2.1/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/sounds/vinto.wav
Binary files differ
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/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.net.*;
26import java.awt.*;
27import java.awt.event.*;
28
29public 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/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public 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/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public 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/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25/* Questa classe dispone semplicemente le carte
26 * sulla finestra e imposta la sfondo. */
27public 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
diff --git a/JBriscola/all_versions/0.2/0.2/src/Frame.java b/JBriscola/all_versions/0.2/0.2/src/Frame.java
new file mode 100755
index 0000000..7ae52fe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/Frame.java
@@ -0,0 +1,308 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.awt.*;
26import java.awt.event.*;
27
28public class Frame extends JFrame {
29 public static boolean mazzo;
30 public static Main main;
31 public static Pannello pannello;
32 public static JPanel pannello2;
33 public static JButton button;
34 public static JMenuBar barraMenu;
35 public static JMenu file, puntoInterrogativo;
36 public static JMenuItem nuovaPartita, opzioni, esci, informazioni, punti;
37 public static ImageIcon retro1, retro2, ultimaCarta;
38 public static ImageIcon[] giocata = new ImageIcon[2];
39 public static ImageIcon[] carteInMano = new ImageIcon[3];
40 public static ImageIcon[] carteCPU = new ImageIcon[3];
41 public static ImageIcon[] arrayCarteMescolate = new ImageIcon[40];
42 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
43 public Frame() {
44 super( "Tronto's JBriscola " + main.version );
45 mazzo = true;
46 main = new Main();
47 pannello = new Pannello();
48 pannello2 = new JPanel( new FlowLayout() );
49 button = new JButton( main.stringaBottonePrendi );
50 button.addActionListener( new ActionListener() {
51 public void actionPerformed( ActionEvent e ) {
52 if ( giocata[0] != null && giocata[1] != null )
53 main.mano++;
54 try {
55 main.chiPrende();
56 } catch ( Exception ex ) {
57 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
58 }
59 if ( main.mano == 16 )
60 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
61 if ( main.mano == 17 ) {
62 mazzo = false;
63 ultimaCarta = null;
64 pannello.repaint();
65 Frame.this.repaint();
66 }
67 if ( main.mano == 20 ) {
68 String titolo = "";
69 String suonoFinale = "";
70 if ( main.punteggio > main.punteggioCPU ) {
71 titolo = main.stringaVinto;
72 suonoFinale = "sounds/perso.wav";
73 }
74 if ( main.punteggio < main.punteggioCPU ) {
75 titolo = main.stringaPerso;
76 suonoFinale = "sounds/vinto.wav";
77 }
78 if ( main.punteggio == main.punteggioCPU ) {
79 titolo = main.stringaPareggio;
80 suonoFinale = "sounds/pareggio.wav";
81 }
82 if ( main.sound ) {
83 try {
84 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
85 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
86 AudioFormat af = aff.getFormat();
87 DataLine.Info info = new DataLine.Info(
88 Clip.class,
89 ais.getFormat(),
90 ( (int) ais.getFrameLength() *
91 af.getFrameSize() ) );
92 Clip ol = ( Clip ) AudioSystem.getLine( info );
93 ol.open(ais);
94 ol.loop( 0 );
95 } catch ( Exception ex ) {
96 System.err.println( e );
97 }
98 }
99 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.PLAIN_MESSAGE );
100 }
101 }
102 } );
103 button.addKeyListener( new KeyAdapter() {
104 public void keyReleased( KeyEvent key ) {
105 if ( main.keys ) {
106 switch ( key.getKeyCode() ) {
107 case KeyEvent.VK_1:
108 if ( mettiCarta( 231, 500 ) ) {
109 if ( !main.CPUHaGiocato )
110 main.giocaCPU();
111 }
112 break;
113 case KeyEvent.VK_2:
114 if ( mettiCarta( 301, 500 ) ) {
115 if ( !main.CPUHaGiocato )
116 main.giocaCPU();
117 }
118 break;
119 case KeyEvent.VK_3:
120 if ( mettiCarta( 371, 500 ) ) {
121 if ( !main.CPUHaGiocato )
122 main.giocaCPU();
123 }
124 break;
125 case KeyEvent.VK_F1:
126 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.stringaTasti, JOptionPane.INFORMATION_MESSAGE );
127 break;
128 case KeyEvent.VK_F2:
129 if ( main.mano == 20 ) {
130 main.mischia();
131 pannello.repaint();
132 repaint();
133 }
134 else {
135 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 );
136 if ( selezione == JOptionPane.YES_OPTION ) {
137 main.mischia();
138 pannello.repaint();
139 repaint();
140 }
141 }
142 break;
143 case KeyEvent.VK_F3:
144 OptionFrame optionFrame = new OptionFrame();
145 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
146 optionFrame.setResizable( false );
147 optionFrame.setAlwaysOnTop( true );
148 optionFrame.setSize( 300, 200 );
149 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
150 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
151 optionFrame.setVisible( true );
152 break;
153 case KeyEvent.VK_F4:
154 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
155 break;
156 case KeyEvent.VK_F5:
157 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
158 break;
159 case KeyEvent.VK_Q:
160 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 );
161 if ( selezione == JOptionPane.YES_OPTION )
162 Frame.this.dispose();
163 break;
164 }
165 }
166 }
167 } );
168 barraMenu = new JMenuBar();
169 file = new JMenu( "File" );
170 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
171 nuovaPartita.addActionListener( new ActionListener() {
172 public void actionPerformed( ActionEvent e ) {
173 if ( main.mano == 20 ) {
174 main.mischia();
175 pannello.repaint();
176 repaint();
177 }
178 else {
179 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 );
180 if ( selezione == JOptionPane.YES_OPTION ) {
181 main.mischia();
182 pannello.repaint();
183 repaint();
184 }
185 }
186 }
187 });
188 opzioni = new JMenuItem( main.stringaOpzioni );
189 opzioni.addActionListener( new ActionListener() {
190 public void actionPerformed( ActionEvent e ) {
191 OptionFrame optionFrame = new OptionFrame();
192 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
193 optionFrame.setResizable( false );
194 optionFrame.setAlwaysOnTop( true );
195 optionFrame.setSize( 300, 200 );
196 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2,
197 (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
198 optionFrame.setVisible( true );
199 }
200 });
201 esci = new JMenuItem( main.stringaEsci );
202 esci.addActionListener( new ActionListener() {
203 public void actionPerformed( ActionEvent e ) {
204 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 );
205 if ( selezione == JOptionPane.YES_OPTION )
206 Frame.this.dispose();
207 }
208 });
209 file.add( nuovaPartita );
210 file.add( opzioni );
211 file.addSeparator();
212 file.add( esci );
213 puntoInterrogativo = new JMenu( "?" );
214 informazioni = new JMenuItem( main.stringaInformazioni );
215 informazioni.addActionListener( new ActionListener() {
216 public void actionPerformed( ActionEvent e ) {
217 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
218 }
219 } );
220 punti = new JMenuItem( main.stringaPunteggio );
221 punti.addActionListener( new ActionListener() {
222 public void actionPerformed( ActionEvent e ) {
223 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + "\n" + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.PLAIN_MESSAGE );
224 }
225 } );
226 puntoInterrogativo.add( punti );
227 puntoInterrogativo.add( informazioni );
228 barraMenu.add( file );
229 barraMenu.add( puntoInterrogativo );
230 setJMenuBar( barraMenu );
231 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
232 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
233 for (int i = 0; i < 10; i++)
234 for (int j = 0; j < 4; j++)
235 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
236 main.mischia();
237 pannello2.add( button );
238 setLayout( new BorderLayout() );
239 add( pannello, BorderLayout.CENTER );
240 add( pannello2, BorderLayout.SOUTH );
241 addMouseListener(
242 new MouseAdapter() {
243 public void mouseClicked ( MouseEvent e ) {
244 if ( mettiCarta( e.getX(), e.getY() ) ) {
245 if ( !main.CPUHaGiocato )
246 main.giocaCPU();
247 }
248 }
249 }
250 );
251 addWindowListener(
252 new WindowAdapter() {
253 public void windowClosing( WindowEvent e ) {
254 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 );
255 if ( selezione == JOptionPane.YES_OPTION )
256 System.exit( 0 );
257 }
258 }
259 );
260 }
261 public boolean mettiCarta( int x, int y ) {
262 if ( !main.toccaAllaCPU && giocata[0] == null ) {
263 if ( main.sound &&
264 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
265 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
266 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
267 try {
268 double a = Math.random() * 6;
269 int i = (int) a;
270 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
271 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
272 AudioFormat af = aff.getFormat();
273 DataLine.Info info = new DataLine.Info(
274 Clip.class,
275 ais.getFormat(),
276 ( (int) ais.getFrameLength() *
277 af.getFrameSize() ) );
278 Clip ol = ( Clip ) AudioSystem.getLine( info );
279 ol.open(ais);
280 ol.loop( 0 );
281 } catch ( Exception e ) {
282 System.err.println( e );
283 }
284 }
285 if ( x > 230 && x < 290 && y > 340 && y < 566 ) {
286 giocata[0] = carteInMano[0];
287 carteInMano[0] = null;
288 pannello.repaint();
289 return true;
290 }
291 if ( x > 300 && x < 360 && y > 340 && y < 566 ) {
292 giocata[0] = carteInMano[1];
293 carteInMano[1] = null;
294 pannello.repaint();
295 return true;
296 }
297 if ( x > 370 && x < 430 && y > 340 && y < 566 ) {
298 giocata[0] = carteInMano[2];
299 carteInMano[2] = null;
300 pannello.repaint();
301 return true;
302 }
303 }
304 return false;
305 }
306}
307
308
diff --git a/JBriscola/all_versions/0.2/0.2/src/Main.java b/JBriscola/all_versions/0.2/0.2/src/Main.java
new file mode 100755
index 0000000..e0587e1
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/Main.java
@@ -0,0 +1,1077 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
29 public static boolean toccaAllaCPU = false;
30 public static boolean CPUHaGiocato = false;
31 public static boolean haGiocatoPrima = true;
32 public static boolean sound = true;
33 public static boolean keys = true;
34 public static Frame frame;
35 public static Color color = new Color( 0, 150, 0 );
36 public static String version = "0.2";
37 public static String stringaBottonePrendi = "Prendi/Lascia carte";
38 public static String stringaPrimaGioca = "Prima Gioca!";
39 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
40 public static String stringaVinto = "Hai Vinto!";
41 public static String stringaPerso = "Hai Perso";
42 public static String stringaPareggio = "Pareggio";
43 public static String stringaGiocatore = "Giocatore: ";
44 public static String stringaComputer = "\nComputer: ";
45 public static String stringaNuovaPartita = "Nuova Partita";
46 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
47 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
48 public static String stringaSi = "Si";
49 public static String stringaNo = "No";
50 public static String stringaOpzioni = "Opzioni...";
51 public static String stringaEsci = "Esci";
52 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
53 public static String stringaLingua = "Lingua";
54 public static String stringaAnnulla = "Annulla";
55 public static String stringaIt = "Italiano";
56 public static String stringaLa = "Latino";
57 public static String stringaBL = "Dialetto Bellunese";
58 public static String stringaBV = "Dialetto Basso Veneto";
59 public static String stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua.\nAlcune parti saranno comunque tradotte prima.";
60 public static String stringaModificaOpzioni = "Modifica Opzioni";
61 public static String stringaInformazioni = "Informazioni";
62 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";
63 public static String stringaSuono = "Effetti Sonori";
64 public static String stringaPunteggio = "Punteggio";
65 public static String stringaSfondo = "Sfondo";
66 public static String stringaTasti = "Tasti rapidi";
67 public static String stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 Nuova partita\nF3 Opzioni\nF4 Visualizza Punteggio\nF5 Informazioni\nq Esci";
68 public static String lang, soundString, keysString;
69 public static File[] suoni = new File[6];
70 public static File suonoVinto, suonoPerso, suonoPareggio;
71 public static void main( String args[] ) {
72 settaOpzioni();
73 frame = new Frame();
74 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
75 frame.setResizable( false );
76 frame.setSize( 600, 600 );
77 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2,
78 (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
79 frame.setVisible( true );
80 }
81 public void mischia() {
82 mano = 0;
83 punteggio = 0;
84 punteggioCPU = 0;
85 cartaDaPescare = 6;
86 ImageIcon aux;
87 frame.mazzo = true;
88 toccaAllaCPU = false;
89 CPUHaGiocato = false;
90 haGiocatoPrima = true;
91 for ( int i = 0, k = 0; i < 10; i++ )
92 for ( int j = 0; j < 4; j++, k++ )
93 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
94 for ( int i = 0; i < 391; i++ ) {
95 double a = Math.random() * 40;
96 int x = (int) a;
97 double b = Math.random() * 40;
98 int y = (int) b;
99 aux = frame.arrayCarteMescolate[x];
100 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
101 frame.arrayCarteMescolate[y] = aux;
102 }
103 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
104 semeBriscola = auxChar[auxChar.length-5] - 49;
105 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
106 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
107 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
108 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
109 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
110 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
111 frame.ultimaCarta = frame.arrayCarteMescolate[39];
112 frame.giocata[0] = null;
113 frame.giocata[1] = null;
114 }
115 public void giocaCPU() {
116 if ( mano < 16 ) {
117 if ( frame.giocata[0] == null ) {
118 if ( vaiPunti() );
119 else if ( vaiLiscio() );
120 else if ( vaiTaglio() );
121 else if ( vaiBriscolaAlta() );
122 else if ( vaiCarico() );
123 else if ( vaiTre() );
124 else if ( vaiAsso() );
125 else;
126 }
127 else {
128 if ( haLisciato() ) {
129 if ( vaiSopra() );
130 else if ( vaiLiscio() );
131 else if ( vaiPunti() );
132 else if ( vaiTaglio() );
133 else if ( vaiTre() );
134 else if ( vaiBriscolaAlta() );
135 else if ( vaiCarico() );
136 else if ( vaiAsso() );
137 } else if ( haMessoPunti() ) {
138 if ( vaiSopra() );
139 else if ( vaiLiscio() );
140 else if ( vaiTaglio() );
141 else if ( vaiPunti() );
142 else if ( vaiTre() );
143 else if ( vaiBriscolaAlta() );
144 else if ( vaiCarico() );
145 else if ( vaiAsso() );
146 } else if ( haTagliato() ) {
147 if ( vaiLiscio() );
148 else if ( vaiPunti() );
149 else if ( vaiTaglio() );
150 else if ( vaiTre() );
151 else if ( vaiBriscolaAlta() );
152 else if ( vaiCarico() );
153 else if ( vaiAsso() );
154 } else if ( haMessoBriscolaAlta() ) {
155 if ( vaiLiscio() );
156 else if ( vaiPunti() );
157 else if ( vaiTre() );
158 else if ( vaiTaglio() );
159 else if ( vaiBriscolaAlta() );
160 else if ( vaiCarico() );
161 else if ( vaiAsso() );
162 } else if ( haMessoTre() ) {
163 if ( vaiAsso() );
164 else if ( vaiLiscio() );
165 else if ( vaiPunti() );
166 else if ( vaiTaglio() );
167 else if ( vaiBriscolaAlta() );
168 else if ( vaiCarico() );
169 } else if ( haMessoAsso() ) {
170 if ( vaiLiscio() );
171 else if ( vaiPunti() );
172 else if ( vaiTaglio() );
173 else if ( vaiBriscolaAlta() );
174 else if ( vaiCarico() );
175 else if ( vaiTre() );
176 } else if ( haCaricato() ) {
177 if ( vaiSopra() );
178 else if ( vaiTre() );
179 else if ( vaiBriscolaAlta() );
180 else if ( vaiAsso() );
181 else if ( vaiTaglio() );
182 else if ( vaiLiscio() );
183 else if ( vaiPunti() );
184 else if ( vaiCarico() );
185 }
186 }
187 }
188 else if ( mano == 16 ) {
189 if ( frame.giocata[0] == null ) {
190 char aux[];
191 aux = frame.ultimaCarta.toString().toCharArray();
192 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
193 if ( vaiCarico() );
194 else if ( vaiPunti() );
195 else if ( vaiLiscio() );
196 else if ( vaiTaglio() );
197 else if ( vaiBriscolaAlta() );
198 else if ( vaiTre() );
199 else if ( vaiAsso() );
200 else;
201 } else {
202 if ( vaiPunti() );
203 else if ( vaiLiscio() );
204 else if ( vaiTaglio() );
205 else if ( vaiBriscolaAlta() );
206 else if ( vaiCarico() );
207 else if ( vaiTre() );
208 else if ( vaiAsso() );
209 else;
210 }
211 }
212 else {
213 char aux[];
214 aux = frame.ultimaCarta.toString().toCharArray();
215 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
216 if ( haCaricato() ) {
217 if ( vaiSopra() );
218 else if ( vaiLiscio() );
219 else if ( vaiPunti() );
220 else if ( vaiTre() );
221 else if ( vaiTaglio() );
222 else if ( vaiBriscolaAlta() );
223 else if ( vaiAsso() );
224 else if ( vaiCarico() );
225 }
226 } else {
227 if ( haLisciato() ) {
228 if ( vaiSopra() );
229 else if ( vaiLiscio() );
230 else if ( vaiPunti() );
231 else if ( vaiTaglio() );
232 else if ( vaiTre() );
233 else if ( vaiBriscolaAlta() );
234 else if ( vaiCarico() );
235 else if ( vaiAsso() );
236 } else if ( haMessoPunti() ) {
237 if ( vaiSopra() );
238 else if ( vaiLiscio() );
239 else if ( vaiTaglio() );
240 else if ( vaiPunti() );
241 else if ( vaiTre() );
242 else if ( vaiBriscolaAlta() );
243 else if ( vaiCarico() );
244 else if ( vaiAsso() );
245 } else if ( haTagliato() ) {
246 if ( vaiLiscio() );
247 else if ( vaiPunti() );
248 else if ( vaiTaglio() );
249 else if ( vaiTre() );
250 else if ( vaiBriscolaAlta() );
251 else if ( vaiCarico() );
252 else if ( vaiAsso() );
253 } else if ( haMessoBriscolaAlta() ) {
254 if ( vaiLiscio() );
255 else if ( vaiPunti() );
256 else if ( vaiTre() );
257 else if ( vaiTaglio() );
258 else if ( vaiBriscolaAlta() );
259 else if ( vaiCarico() );
260 else if ( vaiAsso() );
261 } else if ( haMessoTre() ) {
262 if ( vaiAsso() );
263 else if ( vaiLiscio() );
264 else if ( vaiPunti() );
265 else if ( vaiTaglio() );
266 else if ( vaiBriscolaAlta() );
267 else if ( vaiCarico() );
268 } else if ( haMessoAsso() ) {
269 if ( vaiLiscio() );
270 else if ( vaiPunti() );
271 else if ( vaiTaglio() );
272 else if ( vaiBriscolaAlta() );
273 else if ( vaiCarico() );
274 else if ( vaiTre() );
275 } else if ( haCaricato() ) {
276 if ( vaiSopra() );
277 else if ( vaiTre() );
278 else if ( vaiBriscolaAlta() );
279 else if ( vaiAsso() );
280 else if ( vaiTaglio() );
281 else if ( vaiLiscio() );
282 else if ( vaiPunti() );
283 else if ( vaiCarico() );
284 }
285 }
286 }
287 } else if ( mano == 17 ) {
288 if ( frame.giocata[0] == null ) {
289 if ( hoAsso() ) {
290 if ( vaiTre() );
291 else if ( vaiBriscolaAlta() );
292 else if ( vaiTaglio() );
293 else if ( vaiLiscio() );
294 else if ( vaiPunti() );
295 else if ( vaiAsso() );
296 else if ( vaiCarico() );
297 } else {
298 if ( vaiLiscio() );
299 else if ( vaiPunti() );
300 else if ( vaiTaglio() );
301 else if ( vaiBriscolaAlta() );
302 else if ( vaiCarico() );
303 else if ( vaiTre() );
304 }
305 }
306 else {
307 if ( haLisciato() ) {
308 if ( vaiSopra() );
309 else if ( vaiLiscio() );
310 else if ( vaiPunti() );
311 else if ( vaiTaglio() );
312 else if ( vaiTre() );
313 else if ( vaiBriscolaAlta() );
314 else if ( vaiCarico() );
315 else if ( vaiAsso() );
316 } else if ( haMessoPunti() ) {
317 if ( vaiSopra() );
318 else if ( vaiLiscio() );
319 else if ( vaiTaglio() );
320 else if ( vaiPunti() );
321 else if ( vaiTre() );
322 else if ( vaiBriscolaAlta() );
323 else if ( vaiCarico() );
324 else if ( vaiAsso() );
325 } else if ( haTagliato() ) {
326 if ( vaiLiscio() );
327 else if ( vaiPunti() );
328 else if ( vaiTaglio() );
329 else if ( vaiTre() );
330 else if ( vaiBriscolaAlta() );
331 else if ( vaiCarico() );
332 else if ( vaiAsso() );
333 } else if ( haMessoBriscolaAlta() ) {
334 if ( vaiLiscio() );
335 else if ( vaiPunti() );
336 else if ( vaiTre() );
337 else if ( vaiTaglio() );
338 else if ( vaiBriscolaAlta() );
339 else if ( vaiCarico() );
340 else if ( vaiAsso() );
341 } else if ( haMessoTre() ) {
342 if ( vaiAsso() );
343 else if ( vaiLiscio() );
344 else if ( vaiPunti() );
345 else if ( vaiTaglio() );
346 else if ( vaiBriscolaAlta() );
347 else if ( vaiCarico() );
348 } else if ( haMessoAsso() ) {
349 if ( vaiLiscio() );
350 else if ( vaiPunti() );
351 else if ( vaiTaglio() );
352 else if ( vaiBriscolaAlta() );
353 else if ( vaiCarico() );
354 else if ( vaiTre() );
355 } else if ( haCaricato() ) {
356 if ( vaiSopra() );
357 else if ( vaiTre() );
358 else if ( vaiBriscolaAlta() );
359 else if ( vaiAsso() );
360 else if ( vaiTaglio() );
361 else if ( vaiLiscio() );
362 else if ( vaiPunti() );
363 else if ( vaiCarico() );
364 }
365 }
366 } else if ( mano == 18 ) {
367 if ( frame.giocata[0] == null ) {
368 if ( vaiAsso() );
369 else if ( vaiCarico() );
370 else if ( vaiBriscolaAlta() );
371 else if ( vaiTaglio() );
372 else if ( vaiPunti() );
373 else if ( vaiLiscio() );
374 else if ( vaiTre() );
375 }
376 else {
377 if ( haLisciato() ) {
378 if ( vaiSopra() );
379 else if ( vaiLiscio() );
380 else if ( vaiPunti() );
381 else if ( vaiTaglio() );
382 else if ( vaiTre() );
383 else if ( vaiBriscolaAlta() );
384 else if ( vaiCarico() );
385 else if ( vaiAsso() );
386 } else if ( haMessoPunti() ) {
387 if ( vaiSopra() );
388 else if ( vaiLiscio() );
389 else if ( vaiTaglio() );
390 else if ( vaiPunti() );
391 else if ( vaiTre() );
392 else if ( vaiBriscolaAlta() );
393 else if ( vaiCarico() );
394 else if ( vaiAsso() );
395 } else if ( haTagliato() ) {
396 if ( vaiLiscio() );
397 else if ( vaiPunti() );
398 else if ( vaiTaglio() );
399 else if ( vaiTre() );
400 else if ( vaiBriscolaAlta() );
401 else if ( vaiCarico() );
402 else if ( vaiAsso() );
403 } else if ( haMessoBriscolaAlta() ) {
404 if ( vaiLiscio() );
405 else if ( vaiPunti() );
406 else if ( vaiTre() );
407 else if ( vaiTaglio() );
408 else if ( vaiBriscolaAlta() );
409 else if ( vaiCarico() );
410 else if ( vaiAsso() );
411 } else if ( haMessoTre() ) {
412 if ( vaiAsso() );
413 else if ( vaiLiscio() );
414 else if ( vaiPunti() );
415 else if ( vaiTaglio() );
416 else if ( vaiBriscolaAlta() );
417 else if ( vaiCarico() );
418 } else if ( haMessoAsso() ) {
419 if ( vaiLiscio() );
420 else if ( vaiPunti() );
421 else if ( vaiTaglio() );
422 else if ( vaiBriscolaAlta() );
423 else if ( vaiCarico() );
424 else if ( vaiTre() );
425 } else if ( haCaricato() ) {
426 if ( vaiSopra() );
427 else if ( vaiTre() );
428 else if ( vaiBriscolaAlta() );
429 else if ( vaiAsso() );
430 else if ( vaiTaglio() );
431 else if ( vaiLiscio() );
432 else if ( vaiPunti() );
433 else if ( vaiCarico() );
434 }
435 }
436 } else {
437 if ( vaiTre() );
438 else if ( vaiBriscolaAlta() );
439 else if ( vaiAsso() );
440 else if ( vaiTaglio() );
441 else if ( vaiLiscio() );
442 else if ( vaiPunti() );
443 else if ( vaiCarico() );
444 }
445 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
446 frame.carteCPU[cartaDaGiocare] = null;
447 frame.pannello.repaint();
448 CPUHaGiocato = true;
449 if ( frame.giocata[0] == null )
450 toccaAllaCPU = false;
451 }
452 public void chiPrende() {
453 char aux[], auxCPU[];
454 aux = frame.giocata[0].toString().toCharArray();
455 auxCPU = frame.giocata[1].toString().toCharArray();
456 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
457 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
458 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
459 }
460 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
461 int a, b;
462 switch ( prima ) {
463 case 0:
464 a = 10;
465 break;
466 case 1:
467 a = 12;
468 break;
469 case 3:
470 a = 11;
471 break;
472 default:
473 a = prima;
474 break;
475 }
476 switch ( seconda ) {
477 case 0:
478 b = 10;
479 break;
480 case 1:
481 b = 12;
482 break;
483 case 3:
484 b = 11;
485 break;
486 default:
487 b = seconda;
488 break;
489 }
490 return a > b;
491 }
492 public void giocatorePrende( boolean giocatore ) {
493 if ( giocatore ) {
494 toccaAllaCPU = CPUHaGiocato = false;
495 haGiocatoPrima = true;
496 }
497 else {
498 toccaAllaCPU = true;
499 CPUHaGiocato = haGiocatoPrima = false;
500 }
501 daiPunti( giocatore );
502 if ( toccaAllaCPU )
503 giocaCPU();
504 }
505 public void daiPunti( boolean giocatore ) {
506 char aux[], auxCPU[];
507 aux = frame.giocata[0].toString().toCharArray();
508 auxCPU = frame.giocata[1].toString().toCharArray();
509 int punti = 0;
510 switch( aux[aux.length-7] - 48 ) {
511 case 0:
512 punti += 4;
513 break;
514 case 1:
515 punti += 11;
516 break;
517 case 3:
518 punti += 10;
519 break;
520 case 8:
521 punti += 2;
522 break;
523 case 9:
524 punti += 3;
525 break;
526 default:
527 break;
528 }
529 switch( auxCPU[auxCPU.length-7] - 48 ) {
530 case 0:
531 punti += 4;
532 break;
533 case 1:
534 punti += 11;
535 break;
536 case 3:
537 punti += 10;
538 break;
539 case 8:
540 punti += 2;
541 break;
542 case 9:
543 punti += 3;
544 break;
545 default:
546 break;
547 }
548 frame.giocata[0] = frame.giocata[1] = null;
549 if ( giocatore ) {
550 punteggio += punti;
551 if ( mano < 18 ) {
552 if ( frame.carteInMano[0] == null )
553 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
554 if ( frame.carteInMano[1] == null )
555 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
556 if ( frame.carteInMano[2] == null )
557 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
558 cartaDaPescare++;
559 if ( frame.carteCPU[0] == null )
560 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
561 if ( frame.carteCPU[1] == null )
562 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
563 if ( frame.carteCPU[2] == null )
564 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
565 cartaDaPescare++;
566 }
567 }
568 else {
569 punteggioCPU += punti;
570 if ( mano < 18 ) {
571 if ( frame.carteCPU[0] == null )
572 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
573 if ( frame.carteCPU[1] == null )
574 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
575 if ( frame.carteCPU[2] == null )
576 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
577 cartaDaPescare++;
578 if ( frame.carteInMano[0] == null )
579 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
580 if ( frame.carteInMano[1] == null )
581 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
582 if ( frame.carteInMano[2] == null )
583 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
584 cartaDaPescare++;
585 }
586 }
587 frame.pannello.repaint();
588 frame.repaint();
589 }
590 public boolean haLisciato() {
591 char auxCPU[];
592 auxCPU = frame.giocata[0].toString().toCharArray();
593 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
594 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
595 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
596 }
597 public boolean haMessoPunti() {
598 char auxCPU[];
599 auxCPU = frame.giocata[0].toString().toCharArray();
600 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
601 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
602 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
603 }
604 public boolean haTagliato() {
605 char auxCPU[];
606 auxCPU = frame.giocata[0].toString().toCharArray();
607 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
608 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
609 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
610 }
611 public boolean haMessoBriscolaAlta() {
612 char auxCPU[];
613 auxCPU = frame.giocata[0].toString().toCharArray();
614 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
615 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
616 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
617 }
618 public boolean haMessoTre() {
619 char auxCPU[];
620 auxCPU = frame.giocata[0].toString().toCharArray();
621 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
622 (auxCPU[auxCPU.length-7] - 48 == 3) );
623 }
624 public boolean haMessoAsso() {
625 char auxCPU[];
626 auxCPU = frame.giocata[0].toString().toCharArray();
627 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
628 (auxCPU[auxCPU.length-7] - 48 == 1) );
629 }
630 public boolean haCaricato() {
631 char auxCPU[];
632 auxCPU = frame.giocata[0].toString().toCharArray();
633 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
634 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
635 }
636 public boolean vaiLiscio() {
637 char auxCPU[];
638 for ( int i = 0; i < 3; i++ ) {
639 if ( frame.carteCPU[i] != null ) {
640 auxCPU = frame.carteCPU[i].toString().toCharArray();
641 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
642 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
643 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
644 cartaDaGiocare = i;
645 return true;
646 }
647 }
648 }
649 return false;
650 }
651 public boolean vaiPunti() {
652 char[] auxCPU;
653 for ( int i = 0; i < 3; i++ ) {
654 if ( frame.carteCPU[i] != null ) {
655 auxCPU = frame.carteCPU[i].toString().toCharArray();
656 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
657 cartaDaGiocare = i;
658 return true;
659 }
660 }
661 }
662 for ( int i = 0; i < 3; i++ ) {
663 if ( frame.carteCPU[i] != null ) {
664 auxCPU = frame.carteCPU[i].toString().toCharArray();
665 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
666 cartaDaGiocare = i;
667 return true;
668 }
669 }
670 }
671 for ( int i = 0; i < 3; i++ ) {
672 if ( frame.carteCPU[i] != null ) {
673 auxCPU = frame.carteCPU[i].toString().toCharArray();
674 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
675 cartaDaGiocare = i;
676 return true;
677 }
678 }
679 }
680 return false;
681 }
682 public boolean vaiTaglio() {
683 char auxCPU[];
684 for ( int i = 0; i < 3; i++ ) {
685 if ( frame.carteCPU[i] != null ) {
686 auxCPU = frame.carteCPU[i].toString().toCharArray();
687 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
688 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
689 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
690 cartaDaGiocare = i;
691 return true;
692 }
693 }
694 }
695 return false;
696 }
697 public boolean vaiBriscolaAlta() {
698 char[] auxCPU;
699 for ( int i = 0; i < 3; i++ ) {
700 if ( frame.carteCPU[i] != null ) {
701 auxCPU = frame.carteCPU[i].toString().toCharArray();
702 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
703 cartaDaGiocare = i;
704 return true;
705 }
706 }
707 }
708 for ( int i = 0; i < 3; i++ ) {
709 if ( frame.carteCPU[i] != null ) {
710 auxCPU = frame.carteCPU[i].toString().toCharArray();
711 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
712 cartaDaGiocare = i;
713 return true;
714 }
715 }
716 }
717 for ( int i = 0; i < 3; i++ ) {
718 if ( frame.carteCPU[i] != null ) {
719 auxCPU = frame.carteCPU[i].toString().toCharArray();
720 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
721 cartaDaGiocare = i;
722 return true;
723 }
724 }
725 }
726 return false;
727 }
728 public boolean vaiTre() {
729 char auxCPU[];
730 for ( int i = 0; i < 3; i++ ) {
731 if ( frame.carteCPU[i] != null ) {
732 auxCPU = frame.carteCPU[i].toString().toCharArray();
733 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
734 cartaDaGiocare = i;
735 return true;
736 }
737 }
738 }
739 return false;
740 }
741 public boolean vaiAsso() {
742 char auxCPU[];
743 for ( int i = 0; i < 3; i++ ) {
744 if ( frame.carteCPU[i] != null ) {
745 auxCPU = frame.carteCPU[i].toString().toCharArray();
746 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
747 cartaDaGiocare = i;
748 return true;
749 }
750 }
751 }
752 return false;
753 }
754 public boolean vaiCarico() {
755 char[] auxCPU;
756 for ( int i = 0; i < 3; i++ ) {
757 if ( frame.carteCPU[i] != null ) {
758 auxCPU = frame.carteCPU[i].toString().toCharArray();
759 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
760 cartaDaGiocare = i;
761 return true;
762 }
763 }
764 }
765 for ( int i = 0; i < 3; i++ ) {
766 if ( frame.carteCPU[i] != null ) {
767 auxCPU = frame.carteCPU[i].toString().toCharArray();
768 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
769 cartaDaGiocare = i;
770 return true;
771 }
772 }
773 }
774 return false;
775 }
776 public boolean vaiSopra() {
777 if ( frame.giocata[0] == null )
778 return false;
779 int a = -1;
780 int b = -1;
781 int c = -1;
782 boolean laPrimaPuoAndareSopra = false;
783 boolean laSecondaPuoAndareSopra = false;
784 boolean laTerzaPuoAndareSopra = false;
785 char[] auxCPU1 = new char[1024];
786 char[] auxCPU2 = new char[1024];
787 char[] auxCPU3 = new char[1024];
788 char[] aux = frame.giocata[0].toString().toCharArray();
789 if ( aux[aux.length-7] - 48 == 1 )
790 return false;
791 if ( frame.carteCPU[0] != null ) {
792 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
793 a = auxCPU1[auxCPU1.length-7] - 48;
794 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
795 laPrimaPuoAndareSopra = true;
796 }
797 if ( frame.carteCPU[1] != null ) {
798 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
799 b = auxCPU2[auxCPU2.length-7] - 48;
800 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
801 laSecondaPuoAndareSopra = true;
802 }
803 if ( frame.carteCPU[2] != null ) {
804 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
805 c = auxCPU3[auxCPU3.length-7] - 48;
806 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
807 laTerzaPuoAndareSopra = true;
808 }
809 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
810 return false;
811 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
812 cartaDaGiocare = 0;
813 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
814 cartaDaGiocare = 1;
815 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
816 cartaDaGiocare = 2;
817 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
818 if ( laPrimaEPiuAlta( a, b ) )
819 cartaDaGiocare = 0;
820 else
821 cartaDaGiocare = 1;
822 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
823 if ( laPrimaEPiuAlta( b, c ) )
824 cartaDaGiocare = 1;
825 else
826 cartaDaGiocare = 2;
827 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
828 if ( laPrimaEPiuAlta( a, c ) )
829 cartaDaGiocare = 0;
830 else
831 cartaDaGiocare = 2;
832 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
833 if ( laPrimaEPiuAlta( a, b ) )
834 if ( laPrimaEPiuAlta( a, c ) )
835 cartaDaGiocare = 0;
836 else
837 cartaDaGiocare = 2;
838 else
839 if ( laPrimaEPiuAlta( b, c ) )
840 cartaDaGiocare = 1;
841 else
842 cartaDaGiocare = 2;
843 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
844 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
845 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
846 return false;
847 return true;
848 }
849 public boolean hoCarico() {
850 char auxCPU[];
851 for ( int i = 0; i < 3; i++ ) {
852 if ( frame.carteCPU[i] != null ) {
853 auxCPU = frame.carteCPU[i].toString().toCharArray();
854 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
855 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
856 return true;
857 }
858 }
859 }
860 return false;
861 }
862 public boolean hoAsso() {
863 char auxCPU[];
864 for ( int i = 0; i < 3; i++ ) {
865 if ( frame.carteCPU[i] != null ) {
866 auxCPU = frame.carteCPU[i].toString().toCharArray();
867 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
868 return true;
869 }
870 }
871 }
872 return false;
873 }
874 public boolean hoTre() {
875 char auxCPU[];
876 for ( int i = 0; i < 3; i++ ) {
877 if ( frame.carteCPU[i] != null ) {
878 auxCPU = frame.carteCPU[i].toString().toCharArray();
879 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
880 return true;
881 }
882 }
883 }
884 return false;
885 }
886 public boolean hoBriscolaAlta() {
887 char auxCPU[];
888 for ( int i = 0; i < 3; i++ ) {
889 if ( frame.carteCPU[i] != null ) {
890 auxCPU = frame.carteCPU[i].toString().toCharArray();
891 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
892 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
893 return true;
894 }
895 }
896 }
897 return false;
898 }
899 public boolean hoTaglio() {
900 char auxCPU[];
901 for ( int i = 0; i < 3; i++ ) {
902 if ( frame.carteCPU[i] != null ) {
903 auxCPU = frame.carteCPU[i].toString().toCharArray();
904 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
905 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
906 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
907 return true;
908 }
909 }
910 }
911 return false;
912 }
913 public static void settaOpzioni() {
914 lang = "it";
915 soundString = "suono=si";
916 keysString = "tasti=si";
917 int r = 0;
918 int g = 150;
919 int b = 0;
920 Scanner scanner = null;
921 File file = new File( "JBriscolaConfig.txt" );
922 if ( file.exists() ) {
923 try {
924 scanner = new Scanner( file );
925 } catch ( FileNotFoundException e ) { }
926 try {
927 lang = scanner.next();
928 soundString = scanner.next();
929 keysString = scanner.next();
930 r = scanner.nextInt();
931 g = scanner.nextInt();
932 b = scanner.nextInt();
933 } catch ( NoSuchElementException e ) { }
934 }
935 if ( lang.equals( "it" ) ) {
936 stringaBottonePrendi = "Prendi/Lascia carte";
937 stringaPrimaGioca = "Prima Gioca!";
938 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
939 stringaVinto = "Hai Vinto!";
940 stringaPerso = "Hai Perso";
941 stringaPareggio = "Pareggio";
942 stringaGiocatore = "Giocatore: ";
943 stringaComputer = "\nComputer: ";
944 stringaNuovaPartita = "Nuova Partita";
945 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
946 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
947 stringaSi = "Si";
948 stringaNo = "No";
949 stringaOpzioni = "Opzioni...";
950 stringaEsci = "Esci";
951 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
952 stringaLingua = "Lingua";
953 stringaAnnulla = "Annulla";
954 stringaIt = "Italiano";
955 stringaLa = "Latino";
956 stringaBL = "Dialetto Bellunese";
957 stringaBV = "Dialetto Basso Veneto";
958 stringaNecessarioRiavviare = "E' necessario riavviare JBriscola se sono state\nmodificate impostazioni riguardanti la lingua\nAlcune parti saranno comunque tradotte prima.";
959 stringaModificaOpzioni = "Modifica Opzioni";
960 stringaInformazioni = "Informazioni";
961 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";
962 stringaSuono = "Effetti sonori";
963 stringaPunteggio = "Punteggio";
964 stringaSfondo = "Sfondo";
965 stringaTasti = "Tasti rapidi";
966 stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 Nuova partita\nF3 Opzioni\nF4 Visualizza Punteggio\nF5 Informazioni\nq Esci";
967 }
968 else if ( lang.equals( "la" ) ) {
969 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
970 stringaPrimaGioca = "ANTE CHARTAM PONE!";
971 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
972 stringaVinto = "VICISTI!";
973 stringaPerso = "PERDIDISTI";
974 stringaPareggio = "AEQVATIO!";
975 stringaGiocatore = "LVSOR: ";
976 stringaComputer = "\nCOMPVTER: ";
977 stringaNuovaPartita = "NOVA LVSO";
978 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
979 stringaVuoiDavveroUscire = "EXIRE?";
980 stringaSi = "ID VOLO";
981 stringaNo = "NOLO";
982 stringaOpzioni = "OPTIONES...";
983 stringaEsci = "EXIRE";
984 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
985 stringaLingua = "LINGVA";
986 stringaAnnulla = "ABROGA";
987 stringaIt = "ITALICA";
988 stringaLa = "LATINA";
989 stringaBL = "BELLUNI";
990 stringaBV = "VENETIAE";
991 stringaNecessarioRiavviare = "JBRISCOLAM RVRSVS INCIPERE NECESSE EST\nSI LINGVA PRAELATIONES NOVATAE SVNT.\nALIQVAE ANTE ID VERSA ERVNT";
992 stringaModificaOpzioni = "OPTIONES NOVARE";
993 stringaInformazioni = "INFORMATIONES";
994 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";
995 stringaSuono = "SONVS";
996 stringaPunteggio = "NVMERI";
997 stringaSfondo = "COLOR";
998 stringaTasti = "TASTI RAPIDI";
999 stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 NOVA LVSO\nF3 OPTIONES\nF4 NVMERI\nF5 INFORMATIONES\nq EXIRE";
1000 }
1001 if ( lang.equals( "bl" ) ) {
1002 stringaBottonePrendi = "Cio' su/lasa le carte";
1003 stringaPrimaGioca = "Prima Duga!";
1004 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1005 stringaVinto = "Te ha vint!";
1006 stringaPerso = "Te ha pers";
1007 stringaPareggio = "Pari";
1008 stringaGiocatore = "Dugador: ";
1009 stringaComputer = "\nComputer: ";
1010 stringaNuovaPartita = "Taca n'altra partida";
1011 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1012 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1013 stringaSi = "Si";
1014 stringaNo = "No";
1015 stringaOpzioni = "Opzioni...";
1016 stringaEsci = "Stusa su";
1017 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1018 stringaLingua = "Lengua";
1019 stringaAnnulla = "Annulla";
1020 stringaIt = "Italian";
1021 stringaLa = "Latin";
1022 stringaBL = "Dialeto de Belun";
1023 stringaBV = "Dialeto de la basa";
1024 stringaNecessarioRiavviare = "Se te ha cambia' la lengua te toca\nstusar su e impizar de novo al dugo\nPero' zerte robe le e' belche tradote.";
1025 stringaModificaOpzioni = "Modifica Opzioni";
1026 stringaInformazioni = "Informazioni";
1027 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";
1028 stringaSuono = "Efeti sonori";
1029 stringaPunteggio = "Varda i punti";
1030 stringaSfondo = "Sfondo";
1031 stringaTasti = "Tasti rapidi";
1032 stringaTasti2 = "1 Duga la prima carta\n2 Duga la seconda carta\n3 Duga la terza carta\nF1 Tasti rapidi\nF2 Taca n'altra partida\nF3 Opzioni\nF4 Varda i punti\nF5 Informazioni\nq Stusa su";
1033 }
1034 if ( lang.equals( "bv" ) ) {
1035 stringaBottonePrendi = "Ciapa su/lasa e carte";
1036 stringaPrimaGioca = "Prima Zuga!";
1037 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1038 stringaVinto = "Ti ga vinto!";
1039 stringaPerso = "Ti ga perso";
1040 stringaPareggio = "Pari";
1041 stringaGiocatore = "Zugador: ";
1042 stringaComputer = "\nComputer: ";
1043 stringaNuovaPartita = "N'altra Partida";
1044 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1045 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1046 stringaSi = "Si";
1047 stringaNo = "No";
1048 stringaOpzioni = "Opzioni...";
1049 stringaEsci = "Stusa su";
1050 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1051 stringaLingua = "Lengua";
1052 stringaAnnulla = "Annulla";
1053 stringaIt = "Italian";
1054 stringaLa = "Latin";
1055 stringaBL = "Dialeto Belumat";
1056 stringaBV = "Dialeto Veneto";
1057 stringaNecessarioRiavviare = "Se ti ga cambia' la lengua te toca\nstusar su e impizar de novo al zugo\nPero' zerte robe le e' belche tradote.";
1058 stringaModificaOpzioni = "Modifica Opzioni";
1059 stringaInformazioni = "Informasioni";
1060 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";
1061 stringaSuono = "Efeti sonori";
1062 stringaPunteggio = "Varda i punti";
1063 stringaSfondo = "Sfondo";
1064 stringaTasti = "Tasti rapidi";
1065 stringaTasti2 = "1 Zuga la prima carta\n2 Zuga la seconda carta\n3 Zuga la terza carta\nF1 Tasti rapidi\nF2 N'altra partida\nF3 Opzioni\nF4 Varda i punti\nF5 Informazioni\nq Stusa su";
1066
1067 }
1068 sound = ( soundString.equals( "suono=si" ) );
1069 keys = ( keysString.equals( "tasti=si" ) );
1070 color = new Color( r, g, b );
1071 if ( frame != null ) {
1072 frame.pannello.repaint();
1073 frame.pannello2.repaint();
1074 frame.repaint();
1075 }
1076 }
1077}
diff --git a/JBriscola/all_versions/0.2/0.2/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2/src/OptionFrame.java
new file mode 100755
index 0000000..9876af8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/OptionFrame.java
@@ -0,0 +1,140 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono, tastiRapidi;
34 public static JPanel[] pannello = new JPanel[6];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono, tastisiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 if ( tastiRapidi.isSelected() )
69 tastisiono = "tasti=si";
70 else
71 tastisiono = "tasti=no";
72 formatter.format( lang );
73 formatter.format( "\n" );
74 formatter.format( suonosiono );
75 formatter.format( "\n" );
76 formatter.format( tastisiono );
77 formatter.format( "\n" );
78 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
79 formatter.close();
80 main.settaOpzioni();
81 OptionFrame.this.dispose();
82 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
83 }
84 });
85 annulla = new JButton( main.stringaAnnulla );
86 annulla.addActionListener( new ActionListener() {
87 public void actionPerformed( ActionEvent e ) {
88 OptionFrame.this.dispose();
89 }
90 });
91 scegliColore = new JButton( " " );
92 scegliColore.setBackground( main.color );
93 scegliColore.addActionListener( new ActionListener() {
94 public void actionPerformed( ActionEvent e ) {
95 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
96 if ( colore != null )
97 main.color = colore;
98 OptionFrame.scegliColore.setBackground( main.color );
99 }
100 } );
101 lingua = new JLabel( main.stringaLingua );
102 sfondo = new JLabel( main.stringaSfondo );
103 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
104 selezionaLingua = new JComboBox( lingueDaSelezionare );
105 int linguaPreselezionata = 0;
106 if ( main.lang.equals( "it" ) )
107 linguaPreselezionata = 0;
108 else if ( main.lang.equals( "la" ) )
109 linguaPreselezionata = 1;
110 else if ( main.lang.equals( "bl" ) )
111 linguaPreselezionata = 2;
112 else if ( main.lang.equals( "bv" ) )
113 linguaPreselezionata = 3;
114 selezionaLingua.setSelectedIndex( linguaPreselezionata );
115 suono = new JCheckBox( main.stringaSuono );
116 suono.setSelected( main.sound );
117 tastiRapidi = new JCheckBox( main.stringaTasti );
118 tastiRapidi.setSelected( main.keys );
119 pannello[0] = new JPanel( new GridLayout( 4, 1 ) );
120 pannello[1] = new JPanel( new FlowLayout() );
121 pannello[2] = new JPanel( new FlowLayout() );
122 pannello[3] = new JPanel( new FlowLayout() );
123 pannello[4] = new JPanel( new FlowLayout() );
124 pannello[5] = new JPanel( new FlowLayout() );
125 pannello[5].add( ok );
126 pannello[5].add( annulla );
127 pannello[4].add( sfondo );
128 pannello[4].add( scegliColore );
129 pannello[3].add( tastiRapidi );
130 pannello[2].add( suono );
131 pannello[1].add( lingua );
132 pannello[1].add( selezionaLingua );
133 pannello[0].add( pannello[1] );
134 pannello[0].add( pannello[2] );
135 pannello[0].add( pannello[3] );
136 pannello[0].add( pannello[4] );
137 add( pannello[0], BorderLayout.CENTER );
138 add( pannello[5], BorderLayout.SOUTH );
139 }
140}
diff --git a/JBriscola/all_versions/0.2/0.2/src/Pannello.java b/JBriscola/all_versions/0.2/0.2/src/Pannello.java
new file mode 100755
index 0000000..24c6596
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/Pannello.java
@@ -0,0 +1,54 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class Pannello extends JPanel {
26 public static Main main;
27 public static Color color;
28 public Pannello() { }
29 public void paint( Graphics g ) {
30 super.paint( g );
31 setBackground( main.color );
32 if ( main.frame.ultimaCarta != null )
33 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
34 if ( main.frame.mazzo )
35 main.frame.retro2.paintIcon( this, g, 17, 256 );
36 if ( main.frame.carteCPU[0] != null )
37 main.frame.retro1.paintIcon( this, g, 230, 5 );
38 if ( main.frame.carteCPU[1] != null )
39 main.frame.retro1.paintIcon( this, g, 300, 5 );
40 if ( main.frame.carteCPU[2] != null )
41 main.frame.retro1.paintIcon( this, g, 370, 5 );
42 if ( main.frame.carteInMano[0] != null )
43 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
44 if ( main.frame.carteInMano[1] != null )
45 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
46 if ( main.frame.carteInMano[2] != null )
47 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
48 if ( main.frame.giocata[0] != null )
49 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
50 if ( main.frame.giocata[1] != null )
51 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
52 }
53}
54
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/1-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/1-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/1-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/1-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/10-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/10-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/10-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/10-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/2-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/2-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/2-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/2-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/3-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/3-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/3-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/3-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/4-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/4-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/4-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/4-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/5-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/5-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/5-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/5-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/6-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/6-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/6-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/6-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/7-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/7-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/7-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/7-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/8-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/8-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/8-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/8-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/9-1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/9-2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/9-3.jpg b/JBriscola/all_versions/0.2/0.2/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/9-4.jpg b/JBriscola/all_versions/0.2/0.2/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/carte.jpg b/JBriscola/all_versions/0.2/0.2/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/retro1.jpg b/JBriscola/all_versions/0.2/0.2/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/img/retro2.jpg b/JBriscola/all_versions/0.2/0.2/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/0.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/1.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/2.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/3.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/4.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/5.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/pareggio.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/perso.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.2/0.2/src/sounds/vinto.wav b/JBriscola/all_versions/0.2/0.2/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/Frame.java b/JBriscola/all_versions/0.3/0.3.1/src/Frame.java
new file mode 100755
index 0000000..21c4858
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/Frame.java
@@ -0,0 +1,523 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.net.*;
26import java.awt.*;
27import java.awt.event.*;
28
29public 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, nuovaPartitaAiTrenta, opzioni, esci, informazioni, punti, aggiornamenti, trucchi, tastiRapidi, briscola;
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, 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 /* Avvisa che si è arrivati alla quartultima mano. */
82 if ( main.mano == 16 )
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 ( main.aiTrenta &&
97 ( ( main.punteggio >= 30 || main.punteggioCPU >= 30 ) ) ) ) {
98
99 String titolo = "";
100 String suonoFinale = "";
101
102 if ( main.punteggio > main.punteggioCPU ) {
103 titolo = main.stringaVinto;
104 suonoFinale = "sounds/perso.wav";
105 }
106 if ( main.punteggio < main.punteggioCPU ) {
107 titolo = main.stringaPerso;
108 suonoFinale = "sounds/vinto.wav";
109 }
110 if ( main.punteggio == main.punteggioCPU ) {
111 titolo = main.stringaPareggio;
112 suonoFinale = "sounds/pareggio.wav";
113 }
114
115 if ( main.sound ) {
116 try {
117 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
118 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
119 AudioFormat af = aff.getFormat();
120 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
121 Clip ol = ( Clip ) AudioSystem.getLine( info );
122 ol.open(ais);
123 ol.loop( 0 );
124 } catch ( Exception ex ) {
125 System.err.println( e );
126 }
127 }
128
129 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.INFORMATION_MESSAGE );
130
131 main.pulisciTavolo();
132
133 }
134 if ( main.toccaAllaCPU )
135 if ( main.aiTrenta )
136 main.giocaCPUAiTrenta();
137 else
138 main.giocaCPU();
139 }
140 } );
141 button.addKeyListener( new KeyAdapter() {
142 /* Aggiunge il keyListener per le scorciatoie da tastiera. Dato
143 * che il bottone prendi/lascia è l'unico componente effettivo
144 * della finestra, avrà obbligatoriamente il focus ed è necessario
145 * che sia lui a gestire gli eventi della tastiera. */
146 public void keyReleased( KeyEvent key ) {
147
148 if ( main.keys ) {
149 switch ( key.getKeyCode() ) {
150 case KeyEvent.VK_1:
151 if ( mettiCarta( 231, 500 ) ) {
152 if ( !main.CPUHaGiocato )
153 if ( main.aiTrenta )
154 main.giocaCPUAiTrenta();
155 else
156 main.giocaCPU();
157 }
158 break;
159
160 case KeyEvent.VK_2:
161 if ( mettiCarta( 301, 500 ) ) {
162 if ( !main.CPUHaGiocato )
163 if ( main.aiTrenta )
164 main.giocaCPUAiTrenta();
165 else
166 main.giocaCPU();
167 }
168 break;
169
170 case KeyEvent.VK_3:
171 if ( mettiCarta( 371, 500 ) ) {
172 if ( !main.CPUHaGiocato )
173 if ( main.aiTrenta )
174 main.giocaCPUAiTrenta();
175 else
176 main.giocaCPU();
177 }
178 break;
179
180 case KeyEvent.VK_F1:
181 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
182 break;
183
184 case KeyEvent.VK_F2:
185 if ( main.mano == 20 ) {
186 main.aiTrenta = false;
187 main.mischia();
188 pannello.repaint();
189 repaint();
190 }
191 else {
192 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 );
193 if ( selezione == JOptionPane.YES_OPTION ) {
194 main.aiTrenta = false;
195 main.mischia();
196 pannello.repaint();
197 repaint();
198 }
199 }
200 break;
201
202 case KeyEvent.VK_F3:
203 OptionFrame optionFrame = new OptionFrame();
204 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
205 optionFrame.setResizable( false );
206 optionFrame.setAlwaysOnTop( true );
207 optionFrame.setSize( 300, 200 );
208 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
209 optionFrame.setVisible( true );
210 break;
211
212 case KeyEvent.VK_F4:
213 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
214 break;
215
216 case KeyEvent.VK_F5:
217 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
218 break;
219
220 case KeyEvent.VK_F6:
221 String latest = main.version;
222 try {
223 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
224 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
225 latest = latestIsReader.readLine();
226 } catch ( Exception ex ) {
227 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
228 }
229 if ( latest.equals( main.version ) )
230 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
231 else
232 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
233 break;
234
235 case KeyEvent.VK_F7:
236 if ( main.mano == 20 ) {
237 main.aiTrenta = true;
238 main.mischia();
239 pannello.repaint();
240 repaint();
241 }
242 else {
243 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 );
244 if ( selezione == JOptionPane.YES_OPTION ) {
245 main.aiTrenta = true;
246 main.mischia();
247 pannello.repaint();
248 repaint();
249 }
250 }
251 break;
252
253 case KeyEvent.VK_F8:
254 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
255 break;
256
257 case KeyEvent.VK_Q:
258 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 );
259 if ( selezione == JOptionPane.YES_OPTION )
260 Frame.this.dispose();
261 break;
262 }
263 }
264 }
265 } );
266
267 barraMenu = new JMenuBar();
268
269 file = new JMenu( "File" );
270
271 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
272 nuovaPartita.addActionListener( new ActionListener() {
273 /* Avvia una nuova partita, chiedendo prima conferma se ce n'è
274 * già una in corso. */
275 public void actionPerformed( ActionEvent e ) {
276 if ( main.mano == 20 ) {
277 main.aiTrenta = false;
278 main.mischia();
279 pannello.repaint();
280 repaint();
281 }
282
283 else {
284 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 );
285 if ( selezione == JOptionPane.YES_OPTION ) {
286 main.aiTrenta = false;
287 main.mischia();
288 pannello.repaint();
289 repaint();
290 }
291 }
292 }
293 });
294
295 nuovaPartitaAiTrenta = new JMenuItem( main.stringaNuovaPartitaAiTrenta );
296 nuovaPartitaAiTrenta.addActionListener( new ActionListener() {
297 /* Avvia una nuova partita ai 30, chiedendo prima conferma se
298 * ce n'è già una in corso. */
299 public void actionPerformed( ActionEvent e ) {
300 if ( main.mano == 20 ) {
301 main.aiTrenta = true;
302 main.mischia();
303 pannello.repaint();
304 repaint();
305 }
306
307 else {
308 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 );
309 if ( selezione == JOptionPane.YES_OPTION ) {
310 main.aiTrenta = true;
311 main.mischia();
312 pannello.repaint();
313 repaint();
314 }
315 }
316 }
317 });
318
319 trucchi = new JMenuItem( main.stringaTrucchi );
320 trucchi.addActionListener( new ActionListener() {
321 public void actionPerformed( ActionEvent e ) {
322 /* Esegue il trucco */
323 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
324 }
325 } );
326
327 opzioni = new JMenuItem( main.stringaOpzioni );
328 opzioni.addActionListener( new ActionListener() {
329 /* Apre una OptionFrame per modificare le opzioni. */
330 public void actionPerformed( ActionEvent e ) {
331
332 OptionFrame optionFrame = new OptionFrame();
333 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
334 optionFrame.setResizable( false );
335 optionFrame.setAlwaysOnTop( true );
336 optionFrame.setSize( 300, 200 );
337 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
338 optionFrame.setVisible( true );
339 }
340 });
341
342 esci = new JMenuItem( main.stringaEsci );
343 esci.addActionListener( new ActionListener() {
344 /* Ciede conferma prima di uscire. */
345 public void actionPerformed( ActionEvent e ) {
346 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 );
347 if ( selezione == JOptionPane.YES_OPTION )
348 Frame.this.dispose();
349 }
350 });
351
352 file.add( nuovaPartita );
353 file.add( nuovaPartitaAiTrenta );
354 file.add( trucchi );
355 file.add( opzioni );
356 file.addSeparator();
357 file.add( esci );
358
359 puntoInterrogativo = new JMenu( "?" );
360
361 informazioni = new JMenuItem( main.stringaInformazioni );
362 informazioni.addActionListener( new ActionListener() {
363 /* Visualizza le informazioni. */
364 public void actionPerformed( ActionEvent e ) {
365 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
366 }
367 } );
368
369 tastiRapidi = new JMenuItem( main.stringaTasti );
370 tastiRapidi.addActionListener( new ActionListener() {
371 /* Visualizza i tasti rapidi. */
372 public void actionPerformed( ActionEvent e ) {
373 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
374 }
375 } );
376
377 briscola = new JMenuItem( main.stringaBriscola );
378 briscola.addActionListener( new ActionListener() {
379 /* Visualizza il seme di briscola corrente. */
380 public void actionPerformed( ActionEvent e ) {
381 JOptionPane.showMessageDialog( Frame.this, main.stringaBriscola + ": " + main.semi[main.semeBriscola], "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
382 }
383 });
384
385 punti = new JMenuItem( main.stringaPunteggio );
386 punti.addActionListener( new ActionListener() {
387 /* Visualizza il punteggio. */
388 public void actionPerformed( ActionEvent e ) {
389 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
390 }
391 } );
392
393 aggiornamenti = new JMenuItem( main.stringaAggiornamenti );
394 aggiornamenti.addActionListener( new ActionListener() {
395 /* Cerca aggiornamenti sul sito http://porkynator.altervista.org,
396 * confrontando la versione del programma con quella scritta nel
397 * file jbriscola-latest.is (online). */
398 public void actionPerformed( ActionEvent e ) {
399 String latest = main.version;
400 try {
401 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
402 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
403 latest = latestIsReader.readLine();
404 } catch ( Exception ex ) {
405 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
406 }
407 if ( latest.equals( main.version ) )
408 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
409 else
410 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
411 }
412 } );
413
414 puntoInterrogativo.add( punti );
415 puntoInterrogativo.add( briscola );
416 puntoInterrogativo.add( tastiRapidi );
417 puntoInterrogativo.add( informazioni );
418 puntoInterrogativo.add( aggiornamenti );
419
420 barraMenu.add( file );
421 barraMenu.add( puntoInterrogativo );
422
423 setJMenuBar( barraMenu );
424
425 /* Inizializza le immagini del retro delle carte. */
426 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
427 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
428
429 /* Inizializza tutte le immagini delle carte scorrendo l'array bidimensionale. */
430 for (int i = 0; i < 10; i++)
431 for (int j = 0; j < 4; j++)
432 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
433
434 /* Mischia le carte. */
435 main.mischia();
436
437 /* Aggiunge i vari componenti. */
438 pannello2.add( button );
439 setLayout( new BorderLayout() );
440 add( pannello, BorderLayout.CENTER );
441 add( pannello2, BorderLayout.SOUTH );
442
443 /* Chiama il metodo mettiCarta se l'utente clicca. */
444 addMouseListener(
445 new MouseAdapter() {
446 public void mouseClicked ( MouseEvent e ) {
447 if ( mettiCarta( e.getX(), e.getY() ) ) {
448 if ( !main.CPUHaGiocato )
449 if ( main.aiTrenta )
450 main.giocaCPUAiTrenta();
451 else
452 main.giocaCPU();
453 }
454 }
455 }
456 );
457
458 /* Chiede conferma prima di uscire quando viene chiusa la finestra. */
459 addWindowListener(
460 new WindowAdapter() {
461 public void windowClosing( WindowEvent e ) {
462 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 );
463 if ( selezione == JOptionPane.YES_OPTION )
464 System.exit( 0 );
465 }
466 }
467 );
468 }
469
470 /* Se il giocatore ha cliccato su una carta la gioca e riproduce un suono casuale. */
471 public boolean mettiCarta( int x, int y ) {
472
473 if ( !main.toccaAllaCPU && giocata[0] == null ) {
474 if ( main.sound &&
475 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
476 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
477 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
478 try {
479
480 double a = Math.random() * 6;
481 int i = (int) a;
482
483 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
484 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
485 AudioFormat af = aff.getFormat();
486 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
487 Clip ol = ( Clip ) AudioSystem.getLine( info );
488
489 ol.open(ais);
490 ol.loop( 0 );
491
492 } catch ( Exception e ) {
493 System.err.println( e );
494 }
495 }
496
497 if ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) {
498 giocata[0] = carteInMano[0];
499 carteInMano[0] = null;
500 pannello.repaint();
501 return true;
502 }
503
504 if ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) {
505 giocata[0] = carteInMano[1];
506 carteInMano[1] = null;
507 pannello.repaint();
508 return true;
509 }
510
511 if ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) {
512 giocata[0] = carteInMano[2];
513 carteInMano[2] = null;
514 pannello.repaint();
515 return true;
516 }
517 }
518
519 return false;
520 }
521}
522
523
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/Main.java b/JBriscola/all_versions/0.3/0.3.1/src/Main.java
new file mode 100755
index 0000000..467e724
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/Main.java
@@ -0,0 +1,1637 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28
29 /*Costanti per i semi e i valori delle carte*/
30 public static final int COPPE = 0;
31 public static final int BASTONI = 1;
32 public static final int DENARI = 2;
33 public static final int SPADE = 3;
34 public static final int RE = 0;
35 public static final int ASSO = 1;
36 public static final int DUE = 2;
37 public static final int TRE = 3;
38 public static final int QUATTRO = 4;
39 public static final int CINQUE = 5;
40 public static final int SEI = 6;
41 public static final int SETTE = 7;
42 public static final int FANTE = 8;
43 public static final int CAVALLO = 9;
44
45 /* semeBriscola serve a determinare quale il seme di briscola (0 coppe,
46 * 1 bastoni, 2 denari, 3 spade).
47 * punteggio è il punteggio del giocatore, punteggioCPU quello della CPU
48 * mano tiene il conto della mano a cui si è arrivati.
49 * cartaDaPescare è la carta che la CPU deve raccogliere dal mazzo
50 * cartaDaGiocare (può assumere valore compraso tra 0 e 2) è la carta
51 * che la cpu deve giocare. */
52 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
53
54 /* toccaAllaCPU determina se è il turno del computer o del giocatore,
55 * CPUHaGiocato se il computer ha già giocato in questo turno e
56 * haGiocatoPrima se la prima mossa del turno è stata del giocatore
57 * (true) o della CPU (false).
58 * aiTrenta serve per determinare se la partida che si sta giocando è
59 * normale o ai 30.
60 * carteScoperte serve se viene attivato il trucco per mostrare le
61 * carte della CPU.
62 * sound e keys riguardano le opzioni (souno si o no, tasti rapidi si
63 * o no) salvate nel file di configurazione. */
64 public static boolean toccaAllaCPU = false;
65 public static boolean CPUHaGiocato = false;
66 public static boolean haGiocatoPrima = true;
67 public static boolean aiTrenta = false;
68 public static boolean carteScoperte = false;
69 public static boolean sound = true;
70 public static boolean keys = true;
71
72 /* frame è la finestra principale del gioco, color il colore dello sfondo.
73 * lang, soundString e keysString servono a leggere le opzioni dal file
74 * di configurazione. */
75 public static Frame frame;
76 public static Color color = new Color( 0, 150, 0 );
77 public static String lang, soundString, keysString;
78
79 /* Tutte le stringhe che vengono utilizzate durante il gioco sono
80 * inizializzate qui, per poter essere tradotte in altre lingue. */
81 public static String version = "0.3.1";
82 public static String semi[] = { "Bastoni", "Coppe", "Denari", "Spade" };
83 public static String stringaBriscola = "Briscola";
84 public static String stringaBottonePrendi = "Prendi/Lascia carte";
85 public static String stringaPrimaGioca = "Prima Gioca!";
86 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
87 public static String stringaVinto = "Hai Vinto!";
88 public static String stringaPerso = "Hai Perso";
89 public static String stringaPareggio = "Pareggio";
90 public static String stringaGiocatore = "Giocatore: ";
91 public static String stringaComputer = "\nComputer: ";
92 public static String stringaNuovaPartita = "Nuova Partita";
93 public static String stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
94 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
95 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
96 public static String stringaSi = "Si";
97 public static String stringaNo = "No";
98 public static String stringaOpzioni = "Opzioni...";
99 public static String stringaEsci = "Esci";
100 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
101 public static String stringaLingua = "Lingua";
102 public static String stringaAnnulla = "Annulla";
103 public static String stringaIt = "Italiano";
104 public static String stringaLa = "Latino";
105 public static String stringaBL = "Dialetto Bellunese";
106 public static String stringaBV = "Dialetto Basso Veneto";
107 public static String stringaEN = "Inglese";
108 public static String stringaModificaOpzioni = "Modifica Opzioni";
109 public static String stringaInformazioni = "Informazioni";
110 public static String stringaInformazioni2 = "JBriscola e' un gioco di briscola per pc scritto in java ideato\ne realizzato da Sebastiano Tronto. Il gioco viene rilasciato sotto licenza GNU/Gpl versione 2 o successive; questo permette\npotenzialmente a chiunque di modificare il gioco partendo dal codice sorgente del programma. Se non avete ricevuto i sorgenti\nassieme al gioco, potete richiedermeli con un'e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
111 public static String stringaSuono = "Effetti Sonori";
112 public static String stringaPunteggio = "Punteggio";
113 public static String stringaSfondo = "Sfondo";
114 public static String stringaTasti = "Tasti rapidi";
115 public static String stringaAggiornamenti = "Cerca aggiornamenti";
116 public static String stringaTrucchi = "Trucchi";
117 public static String stringaInserisciCodice = "Inserisci il codice:";
118 public static String stringaTruccoAttivato = "Trucco attivato!";
119 public static String stringaTruccoSbagliato = "Trucco non valido";
120 public static String stringaCheCartaVuoi = "E allora che carta vuoi?";
121 public static String stringaAggiornamentiSi = "Aggiornamento disponibile: ";
122 public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
123 public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
124 public static String stringaNoInternet = "Errore: nessuna connessione internet";
125 public static String stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
126
127 public static void main( String args[] ) {
128
129 /* Chiama il metodo settaOpzioni per leggere le impostazioni
130 * dell'utente da un eventuale file di configurazione */
131 settaOpzioni();
132
133 /* Crea la finestra principale del gioco e la posiziona al centro
134 * dello schermo. */
135 frame = new Frame();
136 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
137 frame.setResizable( false );
138 frame.setSize( 600, 600 );
139 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
140 frame.setVisible( true );
141 }
142
143 /* Algoritmo per mischiare il mazzo: prende due carte a caso e le
144 * inverte di posto, utilizzando una variabile aux. Ripete il procedimento
145 * per 391 volte. */
146 public void mischia() {
147
148 ImageIcon aux;
149
150 mano = 0;
151 punteggio = 0;
152 punteggioCPU = 0;
153 cartaDaPescare = 6;
154 frame.mazzo = true;
155 toccaAllaCPU = false;
156 CPUHaGiocato = false;
157 haGiocatoPrima = true;
158 frame.mazzo = true;
159
160 /* Inizializza l'array di carte mescolate ordinato */
161 for ( int i = 0, k = 0; i < 10; i++ )
162 for ( int j = 0; j < 4; j++, k++ )
163 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
164
165 /* Mescola le carte utilizzando il metodo sopra citato */
166 for ( int i = 0; i < 391; i++ ) {
167 double a = Math.random() * 40;
168 int x = (int) a;
169 double b = Math.random() * 40;
170 int y = (int) b;
171 aux = frame.arrayCarteMescolate[x];
172 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
173 frame.arrayCarteMescolate[y] = aux;
174 }
175
176 /* Imposta il seme della briscola */
177 semeBriscola = seme( frame.arrayCarteMescolate[39] );
178
179 /* Distribuisce le carte */
180 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
181 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
182 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
183 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
184 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
185 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
186 frame.ultimaCarta = frame.arrayCarteMescolate[39];
187 frame.giocata[0] = null;
188 frame.giocata[1] = null;
189 }
190
191 /* Viene chiamato a fine partita. */
192 public void pulisciTavolo() {
193
194 punteggio = 0;
195 punteggioCPU = 0;
196 cartaDaPescare = 6;
197 toccaAllaCPU = false;
198 CPUHaGiocato = false;
199 haGiocatoPrima = true;
200
201 frame.mazzo = false;
202 frame.ultimaCarta = null;
203 for ( int i = 0; i < 3; i++ ) {
204 frame.carteCPU[i] = null;
205 frame.carteInMano[i] = null;
206 }
207
208 frame.pannello.repaint();
209 frame.repaint();
210
211 }
212
213 /* Fa giocare la CPU. Questo metodo contiene l'intelligenza artificiale
214 * del gioco. Ho preferito non commentare molto il corpo del metodo per
215 * due motivi; il primo è che abbastanza intuitivo: basta sapere che i
216 * vari metodi vaiLiscio(), vaiTaglio() ecc... tentano di fare ciò che
217 * ovviamente dice il loro nome, se ci riescono restituiscono true,
218 * in caso contrario false.*/
219 public void giocaCPU() {
220
221 /* Nelle prime 16 mani ragiona in maniera diversa*/
222 if ( mano < 16 ) {
223
224 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
225 if ( frame.giocata[0] == null ) {
226 if ( vaiPunti() );
227 else if ( vaiLiscio() );
228 else if ( vaiTaglio() );
229 else if ( vaiBriscolaAlta() );
230 else if ( vaiCarico() );
231 else if ( vaiTre() );
232 else if ( vaiAsso() );
233 else;
234 }
235
236 /* Valuta cosa fare quando invece il giocatore ha giocato */
237 else {
238 if ( haLisciato() ) {
239 if ( vaiSopra() );
240 else if ( vaiLiscio() );
241 else if ( vaiPunti() );
242 else if ( vaiTaglio() );
243 else if ( vaiTre() );
244 else if ( vaiBriscolaAlta() );
245 else if ( vaiCarico() );
246 else if ( vaiAsso() );
247 } else if ( haMessoPunti() ) {
248 if ( vaiSopra() );
249 else if ( vaiLiscio() );
250 else if ( vaiTaglio() );
251 else if ( vaiPunti() );
252 else if ( vaiTre() );
253 else if ( vaiBriscolaAlta() );
254 else if ( vaiCarico() );
255 else if ( vaiAsso() );
256 } else if ( haTagliato() ) {
257 if ( vaiLiscio() );
258 else if ( vaiPunti() );
259 else if ( vaiTaglio() );
260 else if ( vaiTre() );
261 else if ( vaiBriscolaAlta() );
262 else if ( vaiCarico() );
263 else if ( vaiAsso() );
264 } else if ( haMessoBriscolaAlta() ) {
265 if ( vaiLiscio() );
266 else if ( vaiPunti() );
267 else if ( vaiTre() );
268 else if ( vaiTaglio() );
269 else if ( vaiBriscolaAlta() );
270 else if ( vaiCarico() );
271 else if ( vaiAsso() );
272 } else if ( haMessoTre() ) {
273 if ( vaiAsso() );
274 else if ( vaiLiscio() );
275 else if ( vaiPunti() );
276 else if ( vaiTaglio() );
277 else if ( vaiBriscolaAlta() );
278 else if ( vaiCarico() );
279 } else if ( haMessoAsso() ) {
280 if ( vaiLiscio() );
281 else if ( vaiPunti() );
282 else if ( vaiTaglio() );
283 else if ( vaiBriscolaAlta() );
284 else if ( vaiCarico() );
285 else if ( vaiTre() );
286 } else if ( haCaricato() ) {
287 if ( vaiSopra() );
288 else if ( vaiTre() );
289 else if ( vaiBriscolaAlta() );
290 else if ( vaiTaglio() );
291 else if ( vaiAsso() );
292 else if ( vaiLiscio() );
293 else if ( vaiPunti() );
294 else if ( vaiCarico() );
295 }
296 }
297 }
298
299 /* Nella penultima mano (prima di pescare l'ultima carta) */
300 else if ( mano == 16 ) {
301
302 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
303 if ( frame.giocata[0] == null ) {
304 if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
305 if ( vaiCarico() );
306 else if ( vaiPunti() );
307 else if ( vaiLiscio() );
308 else if ( vaiTaglio() );
309 else if ( vaiBriscolaAlta() );
310 else if ( vaiTre() );
311 else if ( vaiAsso() );
312 else;
313 } else {
314 if ( vaiPunti() );
315 else if ( vaiLiscio() );
316 else if ( vaiTaglio() );
317 else if ( vaiBriscolaAlta() );
318 else if ( vaiCarico() );
319 else if ( vaiTre() );
320 else if ( vaiAsso() );
321 else;
322 }
323 }
324
325 /* Valuta cosa fare quando invece il giocatore ha giocato */
326 else {
327 if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
328 if ( haCaricato() ) {
329 if ( vaiSopra() );
330 else if ( vaiLiscio() );
331 else if ( vaiPunti() );
332 else if ( vaiTre() );
333 else if ( vaiTaglio() );
334 else if ( vaiBriscolaAlta() );
335 else if ( vaiAsso() );
336 else if ( vaiCarico() );
337 }
338 } else {
339 if ( haLisciato() ) {
340 if ( vaiSopra() );
341 else if ( vaiLiscio() );
342 else if ( vaiPunti() );
343 else if ( vaiTaglio() );
344 else if ( vaiTre() );
345 else if ( vaiBriscolaAlta() );
346 else if ( vaiCarico() );
347 else if ( vaiAsso() );
348 } else if ( haMessoPunti() ) {
349 if ( vaiSopra() );
350 else if ( vaiLiscio() );
351 else if ( vaiTaglio() );
352 else if ( vaiPunti() );
353 else if ( vaiTre() );
354 else if ( vaiBriscolaAlta() );
355 else if ( vaiCarico() );
356 else if ( vaiAsso() );
357 } else if ( haTagliato() ) {
358 if ( vaiLiscio() );
359 else if ( vaiPunti() );
360 else if ( vaiTaglio() );
361 else if ( vaiTre() );
362 else if ( vaiBriscolaAlta() );
363 else if ( vaiCarico() );
364 else if ( vaiAsso() );
365 } else if ( haMessoBriscolaAlta() ) {
366 if ( vaiLiscio() );
367 else if ( vaiPunti() );
368 else if ( vaiTre() );
369 else if ( vaiTaglio() );
370 else if ( vaiBriscolaAlta() );
371 else if ( vaiCarico() );
372 else if ( vaiAsso() );
373 } else if ( haMessoTre() ) {
374 if ( vaiAsso() );
375 else if ( vaiLiscio() );
376 else if ( vaiPunti() );
377 else if ( vaiTaglio() );
378 else if ( vaiBriscolaAlta() );
379 else if ( vaiCarico() );
380 } else if ( haMessoAsso() ) {
381 if ( vaiLiscio() );
382 else if ( vaiPunti() );
383 else if ( vaiTaglio() );
384 else if ( vaiBriscolaAlta() );
385 else if ( vaiCarico() );
386 else if ( vaiTre() );
387 } else if ( haCaricato() ) {
388 if ( vaiSopra() );
389 else if ( vaiTre() );
390 else if ( vaiBriscolaAlta() );
391 else if ( vaiAsso() );
392 else if ( vaiTaglio() );
393 else if ( vaiLiscio() );
394 else if ( vaiPunti() );
395 else if ( vaiCarico() );
396 }
397 }
398 }
399
400 } else if ( mano == 17 ) {
401
402 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
403 if ( frame.giocata[0] == null ) {
404 if ( hoAsso() ) {
405 if ( vaiTre() );
406 else if ( vaiBriscolaAlta() );
407 else if ( vaiTaglio() );
408 else if ( vaiLiscio() );
409 else if ( vaiPunti() );
410 else if ( vaiAsso() );
411 else if ( vaiCarico() );
412 } else {
413 if ( vaiLiscio() );
414 else if ( vaiPunti() );
415 else if ( vaiTaglio() );
416 else if ( vaiBriscolaAlta() );
417 else if ( vaiCarico() );
418 else if ( vaiTre() );
419 }
420 }
421
422 /* Valuta cosa fare quando invece il giocatore ha giocato */
423 else {
424 if ( haLisciato() ) {
425 if ( vaiSopra() );
426 else if ( vaiLiscio() );
427 else if ( vaiPunti() );
428 else if ( vaiTaglio() );
429 else if ( vaiTre() );
430 else if ( vaiBriscolaAlta() );
431 else if ( vaiCarico() );
432 else if ( vaiAsso() );
433 } else if ( haMessoPunti() ) {
434 if ( vaiSopra() );
435 else if ( vaiLiscio() );
436 else if ( vaiTaglio() );
437 else if ( vaiPunti() );
438 else if ( vaiTre() );
439 else if ( vaiBriscolaAlta() );
440 else if ( vaiCarico() );
441 else if ( vaiAsso() );
442 } else if ( haTagliato() ) {
443 if ( vaiLiscio() );
444 else if ( vaiPunti() );
445 else if ( vaiTaglio() );
446 else if ( vaiTre() );
447 else if ( vaiBriscolaAlta() );
448 else if ( vaiCarico() );
449 else if ( vaiAsso() );
450 } else if ( haMessoBriscolaAlta() ) {
451 if ( vaiLiscio() );
452 else if ( vaiPunti() );
453 else if ( vaiTre() );
454 else if ( vaiTaglio() );
455 else if ( vaiBriscolaAlta() );
456 else if ( vaiCarico() );
457 else if ( vaiAsso() );
458 } else if ( haMessoTre() ) {
459 if ( vaiAsso() );
460 else if ( vaiLiscio() );
461 else if ( vaiPunti() );
462 else if ( vaiTaglio() );
463 else if ( vaiBriscolaAlta() );
464 else if ( vaiCarico() );
465 } else if ( haMessoAsso() ) {
466 if ( vaiLiscio() );
467 else if ( vaiPunti() );
468 else if ( vaiTaglio() );
469 else if ( vaiBriscolaAlta() );
470 else if ( vaiCarico() );
471 else if ( vaiTre() );
472 } else if ( haCaricato() ) {
473 if ( vaiSopra() );
474 else if ( vaiTre() );
475 else if ( vaiBriscolaAlta() );
476 else if ( vaiAsso() );
477 else if ( vaiTaglio() );
478 else if ( vaiLiscio() );
479 else if ( vaiPunti() );
480 else if ( vaiCarico() );
481 }
482 }
483
484 } else if ( mano == 18 ) {
485
486 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
487 if ( frame.giocata[0] == null ) {
488 if ( vaiAsso() );
489 else if ( vaiCarico() );
490 else if ( vaiBriscolaAlta() );
491 else if ( vaiTaglio() );
492 else if ( vaiPunti() );
493 else if ( vaiLiscio() );
494 else if ( vaiTre() );
495 }
496
497 /* Valuta cosa fare quando invece il giocatore ha giocato */
498 else {
499 if ( haLisciato() ) {
500 if ( vaiSopra() );
501 else if ( vaiLiscio() );
502 else if ( vaiPunti() );
503 else if ( vaiTaglio() );
504 else if ( vaiTre() );
505 else if ( vaiBriscolaAlta() );
506 else if ( vaiCarico() );
507 else if ( vaiAsso() );
508 } else if ( haMessoPunti() ) {
509 if ( vaiSopra() );
510 else if ( vaiLiscio() );
511 else if ( vaiTaglio() );
512 else if ( vaiPunti() );
513 else if ( vaiTre() );
514 else if ( vaiBriscolaAlta() );
515 else if ( vaiCarico() );
516 else if ( vaiAsso() );
517 } else if ( haTagliato() ) {
518 if ( vaiLiscio() );
519 else if ( vaiPunti() );
520 else if ( vaiTaglio() );
521 else if ( vaiTre() );
522 else if ( vaiBriscolaAlta() );
523 else if ( vaiCarico() );
524 else if ( vaiAsso() );
525 } else if ( haMessoBriscolaAlta() ) {
526 if ( vaiLiscio() );
527 else if ( vaiPunti() );
528 else if ( vaiTre() );
529 else if ( vaiTaglio() );
530 else if ( vaiBriscolaAlta() );
531 else if ( vaiCarico() );
532 else if ( vaiAsso() );
533 } else if ( haMessoTre() ) {
534 if ( vaiAsso() );
535 else if ( vaiLiscio() );
536 else if ( vaiPunti() );
537 else if ( vaiTaglio() );
538 else if ( vaiBriscolaAlta() );
539 else if ( vaiCarico() );
540 } else if ( haMessoAsso() ) {
541 if ( vaiLiscio() );
542 else if ( vaiPunti() );
543 else if ( vaiTaglio() );
544 else if ( vaiBriscolaAlta() );
545 else if ( vaiCarico() );
546 else if ( vaiTre() );
547 } else if ( haCaricato() ) {
548 if ( vaiSopra() );
549 else if ( vaiTre() );
550 else if ( vaiBriscolaAlta() );
551 else if ( vaiAsso() );
552 else if ( vaiTaglio() );
553 else if ( vaiLiscio() );
554 else if ( vaiPunti() );
555 else if ( vaiCarico() );
556 }
557 }
558
559 /* All'ultima mano è inutile ragionare, dato che ha una sola carta */
560 } else {
561 if ( vaiTre() );
562 else if ( vaiBriscolaAlta() );
563 else if ( vaiAsso() );
564 else if ( vaiTaglio() );
565 else if ( vaiLiscio() );
566 else if ( vaiPunti() );
567 else if ( vaiCarico() );
568 }
569
570 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
571 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
572 frame.carteCPU[cartaDaGiocare] = null;
573 frame.pannello.repaint();
574
575 CPUHaGiocato = true;
576
577 if ( frame.giocata[0] == null )
578 toccaAllaCPU = false;
579 }
580
581 /* Fa giocare una partita ai 30. È analogo al metodo precedente, cambia
582 * solo la tecnica di gioco, quindi non è commentato. */
583 public void giocaCPUAiTrenta() {
584
585 if ( punteggio <= 20 ) {
586
587 if ( frame.giocata[0] == null ) {
588 if ( vaiPunti() );
589 else if ( vaiLiscio() );
590 else if ( vaiTaglio() );
591 else if ( vaiBriscolaAlta() );
592 else if ( vaiCarico() );
593 else if ( vaiTre() );
594 else if ( vaiAsso() );
595 else;
596 }
597
598 /* Valuta cosa fare quando invece il giocatore ha giocato */
599 else {
600 if ( haLisciato() ) {
601 if ( vaiSopra() );
602 else if ( vaiLiscio() );
603 else if ( vaiTre() );
604 else if ( vaiBriscolaAlta() );
605 else if ( vaiTaglio() );
606 else if ( vaiPunti() );
607 else if ( vaiAsso() );
608 else if ( vaiCarico() );
609 } else if ( haMessoPunti() ) {
610 if ( vaiSopra() );
611 else if ( vaiTre() );
612 else if ( vaiBriscolaAlta() );
613 else if ( vaiTaglio() );
614 else if ( vaiLiscio() );
615 else if ( vaiPunti() );
616 else if ( vaiAsso() );
617 else if ( vaiCarico() );
618 } else if ( haTagliato() ) {
619 if ( vaiLiscio() );
620 else if ( vaiPunti() );
621 else if ( vaiTaglio() );
622 else if ( vaiTre() );
623 else if ( vaiBriscolaAlta() );
624 else if ( vaiAsso() );
625 else if ( vaiCarico() );
626 } else if ( haMessoBriscolaAlta() ) {
627 if ( vaiLiscio() );
628 else if ( vaiPunti() );
629 else if ( vaiTre() );
630 else if ( vaiTaglio() );
631 else if ( vaiBriscolaAlta() );
632 else if ( vaiAsso() );
633 else if ( vaiCarico() );
634 } else if ( haMessoTre() ) {
635 if ( vaiAsso() );
636 else if ( vaiLiscio() );
637 else if ( vaiPunti() );
638 else if ( vaiTaglio() );
639 else if ( vaiBriscolaAlta() );
640 else if ( vaiCarico() );
641 } else if ( haMessoAsso() ) {
642 if ( vaiLiscio() );
643 else if ( vaiPunti() );
644 else if ( vaiTaglio() );
645 else if ( vaiBriscolaAlta() );
646 else if ( vaiCarico() );
647 else if ( vaiTre() );
648 } else if ( haCaricato() ) {
649 if ( vaiSopra() );
650 else if ( vaiTre() );
651 else if ( vaiBriscolaAlta() );
652 else if ( vaiTaglio() );
653 else if ( vaiAsso() );
654 else if ( vaiLiscio() );
655 else if ( vaiPunti() );
656 else if ( vaiCarico() );
657 }
658 }
659 }
660
661 else {
662
663 if ( frame.giocata[0] == null ) {
664 if ( vaiLiscio() );
665 else if ( vaiPunti() );
666 else if ( vaiTaglio() );
667 else if ( vaiBriscolaAlta() );
668 else if ( vaiAsso() );
669 else if ( vaiTre() );
670 else if ( vaiCarico() );
671 else;
672 }
673
674 /* Valuta cosa fare quando invece il giocatore ha giocato */
675 else {
676 if ( haLisciato() ) {
677 if ( vaiSopra() );
678 else if ( vaiLiscio() );
679 else if ( vaiTre() );
680 else if ( vaiBriscolaAlta() );
681 else if ( vaiTaglio() );
682 else if ( vaiAsso() );
683 else if ( vaiPunti() );
684 else if ( vaiCarico() );
685 } else if ( haMessoPunti() ) {
686 if ( vaiSopra() );
687 else if ( vaiTre() );
688 else if ( vaiBriscolaAlta() );
689 else if ( vaiTaglio() );
690 else if ( vaiAsso() );
691 else if ( vaiLiscio() );
692 else if ( vaiPunti() );
693 else if ( vaiCarico() );
694 } else if ( haTagliato() ) {
695 if ( vaiLiscio() );
696 else if ( vaiTaglio() );
697 else if ( vaiTre() );
698 else if ( vaiBriscolaAlta() );
699 else if ( vaiAsso() );
700 else if ( vaiPunti() );
701 else if ( vaiCarico() );
702 } else if ( haMessoBriscolaAlta() ) {
703 if ( vaiLiscio() );
704 else if ( vaiTre() );
705 else if ( vaiTaglio() );
706 else if ( vaiAsso() );
707 else if ( vaiBriscolaAlta() );
708 else if ( vaiPunti() );
709 else if ( vaiCarico() );
710 } else if ( haMessoTre() ) {
711 if ( vaiAsso() );
712 else if ( vaiLiscio() );
713 else if ( vaiPunti() );
714 else if ( vaiTaglio() );
715 else if ( vaiBriscolaAlta() );
716 else if ( vaiCarico() );
717 } else if ( haMessoAsso() ) {
718 if ( vaiLiscio() );
719 else if ( vaiTaglio() );
720 else if ( vaiPunti() );
721 else if ( vaiBriscolaAlta() );
722 else if ( vaiCarico() );
723 else if ( vaiTre() );
724 } else if ( haCaricato() ) {
725 if ( vaiSopra() );
726 else if ( vaiTre() );
727 else if ( vaiBriscolaAlta() );
728 else if ( vaiTaglio() );
729 else if ( vaiAsso() );
730 else if ( vaiLiscio() );
731 else if ( vaiPunti() );
732 else if ( vaiCarico() );
733 }
734 }
735 }
736
737 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
738 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
739 frame.carteCPU[cartaDaGiocare] = null;
740 frame.pannello.repaint();
741
742 CPUHaGiocato = true;
743
744 if ( frame.giocata[0] == null )
745 toccaAllaCPU = false;
746 }
747
748 /* Determina se ha preso la CPU o il giocatore */
749 public void chiPrende() {
750
751 /* Chiama il metodo giocatorePrende( boolean giocatore ) con parametro
752 * true se ha preso il giocatore, false se ha preso la CPU */
753 giocatorePrende( ( (seme( frame.giocata[0] ) == semeBriscola) && (seme( frame.giocata[1] ) != semeBriscola) )
754 || ( (seme( frame.giocata[0] ) == seme( frame.giocata[1] )) && laPrimaEPiuAlta( valore( frame.giocata[0] ), valore( frame.giocata[1] )) )
755 || ( (seme( frame.giocata[1] ) != semeBriscola) && (seme( frame.giocata[0] ) != seme( frame.giocata[1] )) && haGiocatoPrima ) );
756 }
757
758 /* Confronta due carte per decidere quale ha più valore di presa.
759 * Restituisce true se è la prima, false se è la seconda */
760 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
761 int a, b;
762 switch ( prima ) {
763 case 0:
764 a = 10;
765 break;
766 case 1:
767 a = 12;
768 break;
769 case 3:
770 a = 11;
771 break;
772 default:
773 a = prima;
774 break;
775 }
776 switch ( seconda ) {
777 case 0:
778 b = 10;
779 break;
780 case 1:
781 b = 12;
782 break;
783 case 3:
784 b = 11;
785 break;
786 default:
787 b = seconda;
788 break;
789 }
790 return a > b;
791 }
792
793 /* Viene chiamato con parametro true se ha preso il giocatore, false se
794 * ha preso la CPU */
795 public void giocatorePrende( boolean giocatore ) {
796 if ( giocatore ) {
797 toccaAllaCPU = CPUHaGiocato = false;
798 haGiocatoPrima = true;
799 }
800 else {
801 toccaAllaCPU = true;
802 CPUHaGiocato = haGiocatoPrima = false;
803 }
804 daiPunti( giocatore );
805 }
806
807 /* Da i punti (true al giocatore, false alla CPU) e fa pescare le carte*/
808 public void daiPunti( boolean giocatore ) {
809
810 int punti = 0;
811
812 switch( valore( frame.giocata[0] ) ) {
813 case 0:
814 punti += 4;
815 break;
816 case 1:
817 punti += 11;
818 break;
819 case 3:
820 punti += 10;
821 break;
822 case 8:
823 punti += 2;
824 break;
825 case 9:
826 punti += 3;
827 break;
828 default:
829 break;
830 }
831 switch( valore( frame.giocata[1] ) ) {
832 case 0:
833 punti += 4;
834 break;
835 case 1:
836 punti += 11;
837 break;
838 case 3:
839 punti += 10;
840 break;
841 case 8:
842 punti += 2;
843 break;
844 case 9:
845 punti += 3;
846 break;
847 default:
848 break;
849 }
850
851 frame.giocata[0] = frame.giocata[1] = null;
852
853 if ( giocatore ) {
854 punteggio += punti;
855 if ( mano < 18 ) {
856 if ( frame.carteInMano[0] == null )
857 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
858 if ( frame.carteInMano[1] == null )
859 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
860 if ( frame.carteInMano[2] == null )
861 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
862 cartaDaPescare++;
863 if ( frame.carteCPU[0] == null )
864 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
865 if ( frame.carteCPU[1] == null )
866 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
867 if ( frame.carteCPU[2] == null )
868 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
869 cartaDaPescare++;
870 }
871 }
872
873 else {
874 punteggioCPU += punti;
875 if ( mano < 18 ) {
876 if ( frame.carteCPU[0] == null )
877 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
878 if ( frame.carteCPU[1] == null )
879 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
880 if ( frame.carteCPU[2] == null )
881 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
882 cartaDaPescare++;
883 if ( frame.carteInMano[0] == null )
884 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
885 if ( frame.carteInMano[1] == null )
886 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
887 if ( frame.carteInMano[2] == null )
888 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
889 cartaDaPescare++;
890 }
891 }
892
893 /* Aggiorna la finestra */
894 frame.pannello.repaint();
895 frame.repaint();
896 }
897
898 /* Vari metodi che determinano che tipo di carta ha giocato il giocatore.*/
899 public boolean haLisciato() {
900 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
901 (valore( frame.giocata[0] ) != RE ) && (valore( frame.giocata[0] ) != ASSO ) &&
902 (valore( frame.giocata[0] ) != TRE ) && (valore( frame.giocata[0] ) < FANTE ) );
903 }
904
905 public boolean haMessoPunti() {
906 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
907 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
908 (valore( frame.giocata[0] ) == CAVALLO ) ) );
909 }
910
911 public boolean haTagliato() {
912 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
913 (valore( frame.giocata[0] ) == RE) && (valore( frame.giocata[0] ) != ASSO) &&
914 (valore( frame.giocata[0] ) == TRE) && (valore( frame.giocata[0] ) <= SETTE) );
915 }
916
917 public boolean haMessoBriscolaAlta() {
918 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
919 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
920 (valore( frame.giocata[0] ) == CAVALLO ) ) );
921 }
922
923 public boolean haMessoTre() {
924 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
925 (valore( frame.giocata[0] ) == TRE) );
926 }
927
928 public boolean haMessoAsso() {
929 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) == semeBriscola) &&
930 (valore( frame.giocata[0] ) == ASSO) );
931 }
932
933 public boolean haCaricato() {
934 return ( (frame.giocata[0] != null) && (seme( frame.giocata[0] ) != semeBriscola) &&
935 ( (valore( frame.giocata[0] ) == ASSO) || (valore( frame.giocata[0] ) == TRE) ) );
936 }
937
938 /* I metodi seguenti cercano di andare liscio - dare punti - mettere
939 * un taglio - ecc... e restituiscono true se hanno avuto successo,
940 * false altrimenti. */
941 public boolean vaiLiscio() {
942 for ( int i = 0; i < 3; i++ ) {
943 if ( frame.carteCPU[i] != null ) {
944 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
945 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
946 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
947 cartaDaGiocare = i;
948 return true;
949 }
950 }
951 }
952
953 return false;
954 }
955
956 public boolean vaiPunti() {
957 /* Cerca di dare punti, cercando di darne il meno possibile (meglio
958 * un fante di re). */
959 for ( int i = 0; i < 3; i++ ) {
960 if ( frame.carteCPU[i] != null ) {
961 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE ) ) {
962 cartaDaGiocare = i;
963 return true;
964 }
965 }
966 }
967
968 for ( int i = 0; i < 3; i++ ) {
969 if ( frame.carteCPU[i] != null ) {
970 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO ) ) {
971 cartaDaGiocare = i;
972 return true;
973 }
974 }
975 }
976
977 for ( int i = 0; i < 3; i++ ) {
978 if ( frame.carteCPU[i] != null ) {
979 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE ) ) {
980 cartaDaGiocare = i;
981 return true;
982 }
983 }
984 }
985
986 return false;
987 }
988 public boolean vaiTaglio() {
989 for ( int i = 0; i < 3; i++ ) {
990 if ( frame.carteCPU[i] != null ) {
991 if ( seme( frame.carteCPU[i] ) == semeBriscola &&
992 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
993 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
994 cartaDaGiocare = i;
995 return true;
996 }
997 }
998 }
999
1000 return false;
1001 }
1002 public boolean vaiBriscolaAlta() {
1003 for ( int i = 0; i < 3; i++ ) {
1004 if ( frame.carteCPU[i] != null ) {
1005 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE) ) {
1006 cartaDaGiocare = i;
1007 return true;
1008 }
1009 }
1010 }
1011
1012 for ( int i = 0; i < 3; i++ ) {
1013 if ( frame.carteCPU[i] != null ) {
1014 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO) ) {
1015 cartaDaGiocare = i;
1016 return true;
1017 }
1018 }
1019 }
1020
1021 for ( int i = 0; i < 3; i++ ) {
1022 if ( frame.carteCPU[i] != null ) {
1023 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == RE) ) {
1024 cartaDaGiocare = i;
1025 return true;
1026 }
1027 }
1028 }
1029
1030 return false;
1031 }
1032 public boolean vaiTre() {
1033 for ( int i = 0; i < 3; i++ ) {
1034 if ( frame.carteCPU[i] != null ) {
1035 if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == TRE) ) {
1036 cartaDaGiocare = i;
1037 return true;
1038 }
1039 }
1040 }
1041
1042 return false;
1043 }
1044 public boolean vaiAsso() {
1045 for ( int i = 0; i < 3; i++ ) {
1046 if ( frame.carteCPU[i] != null ) {
1047 if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == ASSO) ) {
1048 cartaDaGiocare = i;
1049 return true;
1050 }
1051 }
1052 }
1053
1054 return false;
1055 }
1056 public boolean vaiCarico() {
1057 for ( int i = 0; i < 3; i++ ) {
1058 if ( frame.carteCPU[i] != null ) {
1059 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == TRE) ) {
1060 cartaDaGiocare = i;
1061 return true;
1062 }
1063 }
1064 }
1065
1066 for ( int i = 0; i < 3; i++ ) {
1067 if ( frame.carteCPU[i] != null ) {
1068 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO) ) {
1069 cartaDaGiocare = i;
1070 return true;
1071 }
1072 }
1073 }
1074
1075 return false;
1076 }
1077 public boolean vaiSopra() {
1078 /* Innanzitutto controlla se il giocatore ha giocato (non dovrebbe
1079 * essere possibile, in quanto quando questo metodo viene chiamato
1080 * tale condizione è già stata verificata, ma è sempre meglio un
1081 * controllo in più che uno in meno) e restituisce false in caso
1082 * contrario */
1083 if ( frame.giocata[0] == null )
1084 return false;
1085
1086 /* Tre variabili intere che serviranno a valutare quali delle tre
1087 * carte è meglio giocare, se più di una può andare sopra. */
1088 int a = -1;
1089 int b = -1;
1090 int c = -1;
1091
1092 /* Tre booleane che verificano quali delle tre carte possono
1093 * andare sopra. */
1094 boolean laPrimaPuoAndareSopra = false;
1095 boolean laSecondaPuoAndareSopra = false;
1096 boolean laTerzaPuoAndareSopra = false;
1097
1098 /* Se il giocatore ha giocato un asso, restituisce direttamente false. */
1099 if ( valore( frame.giocata[0] ) == ASSO )
1100 return false;
1101
1102 /* Valuta quali delle tre carte possono andare sopra, dopo essersi
1103 * accertato di averle: nelle ultime mani non si hanno tutte le carte
1104 * in mano, e noi non vogliamo una NullPointerException sul più bello
1105 * di una partita, vero?! */
1106 if ( frame.carteCPU[0] != null ) {
1107 a = valore( frame.carteCPU[0] );
1108 if ( (seme( frame.carteCPU[0] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( a, valore( frame.giocata[0] ) ) )
1109 laPrimaPuoAndareSopra = true;
1110 }
1111
1112 if ( frame.carteCPU[1] != null ) {
1113 b = valore( frame.carteCPU[1] );
1114 if ( (seme( frame.carteCPU[1] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( b, valore( frame.giocata[0] ) ) )
1115 laSecondaPuoAndareSopra = true;
1116 }
1117
1118 if ( frame.carteCPU[2] != null ) {
1119 c = valore( frame.carteCPU[2] );
1120 if ( (seme( frame.carteCPU[2] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( c, valore( frame.giocata[0] ) ) )
1121 laTerzaPuoAndareSopra = true;
1122 }
1123
1124 /* Se nessuna carta può andare sopra, restituisce false. Se una
1125 * sola delle tre può andare sopra la imposta come carta da giocare. */
1126 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1127 return false;
1128 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1129 cartaDaGiocare = 0;
1130 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1131 cartaDaGiocare = 1;
1132 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1133 cartaDaGiocare = 2;
1134
1135 /* Se più di una carta può andare sopra, valuta quale è più alta. */
1136 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1137 if ( laPrimaEPiuAlta( a, b ) )
1138 cartaDaGiocare = 0;
1139 else
1140 cartaDaGiocare = 1;
1141 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1142 if ( laPrimaEPiuAlta( b, c ) )
1143 cartaDaGiocare = 1;
1144 else
1145 cartaDaGiocare = 2;
1146 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1147 if ( laPrimaEPiuAlta( a, c ) )
1148 cartaDaGiocare = 0;
1149 else
1150 cartaDaGiocare = 2;
1151 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1152 if ( laPrimaEPiuAlta( a, b ) )
1153 if ( laPrimaEPiuAlta( a, c ) )
1154 cartaDaGiocare = 0;
1155 else
1156 cartaDaGiocare = 2;
1157 else
1158 if ( laPrimaEPiuAlta( b, c ) )
1159 cartaDaGiocare = 1;
1160 else
1161 cartaDaGiocare = 2;
1162
1163 /* Controlla che la carta con cui sta cercando di andare sopra
1164 * sia una figura o un carico. Non vogliamo mica prendere delle
1165 * scartelle con delle scartelle, giusto?! */
1166 if ( ( valore( frame.carteCPU[cartaDaGiocare] ) != RE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) != ASSO ) &&
1167 ( valore( frame.carteCPU[cartaDaGiocare] ) != TRE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) <= SETTE ) )
1168 return false;
1169
1170 return true;
1171 }
1172
1173 /* I metodi seguenti valutano le carte che la CPU ha in mano. */
1174 public boolean hoCarico() {
1175 for ( int i = 0; i < 3; i++ ) {
1176 if ( frame.carteCPU[i] != null ) {
1177 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1178 ( ( valore( frame.carteCPU[i] ) == ASSO ) || ( valore( frame.carteCPU[i] ) == TRE ) ) ) {
1179 return true;
1180 }
1181 }
1182 }
1183
1184 return false;
1185 }
1186 public boolean hoAsso() {
1187 for ( int i = 0; i < 3; i++ ) {
1188 if ( frame.carteCPU[i] != null ) {
1189 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO ) ) {
1190 return true;
1191 }
1192 }
1193 }
1194
1195 return false;
1196 }
1197 public boolean hoTre() {
1198 for ( int i = 0; i < 3; i++ ) {
1199 if ( frame.carteCPU[i] != null ) {
1200 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == TRE ) ) {
1201 return true;
1202 }
1203 }
1204 }
1205
1206 return false;
1207 }
1208 public boolean hoBriscolaAlta() {
1209 for ( int i = 0; i < 3; i++ ) {
1210 if ( frame.carteCPU[i] != null ) {
1211 if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
1212 ( (valore( frame.carteCPU[i] ) == RE) || (valore( frame.carteCPU[i] ) == FANTE) || (valore( frame.carteCPU[i] ) == CAVALLO) ) ) {
1213 return true;
1214 }
1215 }
1216 }
1217
1218 return false;
1219 }
1220 public boolean hoTaglio() {
1221 for ( int i = 0; i < 3; i++ ) {
1222 if ( frame.carteCPU[i] != null ) {
1223 if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
1224 (valore( frame.carteCPU[i] ) < FANTE ) && (valore( frame.carteCPU[i] ) != TRE )
1225 && (valore( frame.carteCPU[i] ) != ASSO ) && (valore( frame.carteCPU[i] ) != RE ) ) {
1226 return true;
1227 }
1228 }
1229 }
1230
1231 return false;
1232 }
1233
1234 /* Restituisce il seme della carta passata come parametro */
1235 public static int seme( ImageIcon carta ) {
1236 char aux[] = carta.toString().toCharArray();
1237 return aux[aux.length-5] - 49;
1238 }
1239
1240 /* Restituisce il valore della carta */
1241 public static int valore( ImageIcon carta ) {
1242 char aux[] = carta.toString().toCharArray();
1243 return aux[aux.length-7] - 48;
1244 }
1245
1246 /* I vari trucchi del gioco. */
1247 public static void trucco( String trucco ) {
1248
1249 byte[] truccoByte = trucco.getBytes();
1250 char[] truccoChar = new char[ truccoByte.length ];
1251 for ( int i = 0; i < truccoChar.length; i++ )
1252 truccoChar[i] = (char)truccoByte[i];
1253
1254 String attivato = stringaTruccoSbagliato;
1255
1256 /* Carta che vuoi dove vuoi. Esempio: x251 sostituisce
1257 * la terza carta (2) con il 6 (5) di coppe (1). */
1258 if ( truccoChar[0] == 'x' && truccoChar.length == 4 ) {
1259
1260 attivato = stringaTruccoAttivato;
1261
1262 String aS = "" + truccoChar[1];
1263 String xS = "" + truccoChar[2];
1264 String yS = "" + truccoChar[3];
1265
1266 int a, x, y;
1267
1268 try {
1269
1270 a = Integer.parseInt( aS );
1271 x = Integer.parseInt( xS );
1272 y = Integer.parseInt( yS );
1273
1274 frame.carteInMano[a] = frame.arrayCarte[x][y];
1275
1276 } catch ( Exception e ) {
1277 attivato = stringaTruccoSbagliato;
1278 }
1279 }
1280
1281 /* Mostra le carte del computer. */
1282 if ( trucco.equalsIgnoreCase( "Kill Devil Hill" ) ) {
1283
1284 attivato = stringaTruccoAttivato;
1285
1286 carteScoperte = true;
1287
1288 }
1289
1290 /* Scambia le carte con il computer. */
1291 if ( trucco.equalsIgnoreCase( "Darkside of Aquarius" ) ) {
1292
1293 attivato = stringaTruccoAttivato;
1294
1295 ImageIcon aux = null;
1296
1297 for ( int i = 0; i < 3; i++ ) {
1298
1299 aux = frame.carteInMano[i];
1300 frame.carteInMano[i] = frame.carteCPU[i];
1301 frame.carteCPU[i] = aux;
1302
1303 }
1304 }
1305
1306 /* Cambia il seme di briscola con uno a caso, senza dire quale.
1307 * L'ultima carta non cambia. È possibile comunque capire
1308 * qual'è la briscola dal menu ?->Briscola*/
1309 if ( trucco.equalsIgnoreCase( "Change of Heart" ) ) {
1310
1311 attivato = stringaTruccoAttivato;
1312
1313 semeBriscola = (int) ( Math.random() * 4 );
1314
1315 }
1316
1317 /* Asso Tre e Re di Briscola tutti in mano (anche in caso di doppioni). */
1318 if ( trucco.equalsIgnoreCase( "Tears of The Dragon" ) ) {
1319
1320 attivato = stringaTruccoAttivato;
1321
1322 frame.carteInMano[0] = frame.arrayCarte[9][semeBriscola];
1323 frame.carteInMano[1] = frame.arrayCarte[2][semeBriscola];
1324 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1325
1326 }
1327
1328 /* Tre assi di briscola. */
1329 if ( trucco.equalsIgnoreCase( "Navigate The Seas of The Sun" ) ) {
1330
1331 attivato = stringaTruccoAttivato;
1332
1333 frame.carteInMano[0] = frame.arrayCarte[0][semeBriscola];
1334 frame.carteInMano[1] = frame.arrayCarte[0][semeBriscola];
1335 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1336
1337 }
1338
1339 /* Fa finire la partita al prossimo piglio. */
1340 if ( trucco.equalsIgnoreCase( "Omega" ) ) {
1341
1342 attivato = stringaTruccoAttivato;
1343
1344 mano = 19;
1345
1346 }
1347
1348 JOptionPane.showMessageDialog( frame, attivato, "JBriscola - " + version, JOptionPane.INFORMATION_MESSAGE );
1349 frame.pannello.repaint();
1350 frame.repaint();
1351
1352 }
1353
1354 /* Imposta le opzioni dell'utente cercando di leggerle dal file di configurazione. */
1355 public static void settaOpzioni() {
1356
1357 /* Impostazioni predefinite. */
1358 lang = "it";
1359 soundString = "suono=si";
1360 keysString = "tasti=si";
1361 int r = 0;
1362 int g = 150;
1363 int b = 0;
1364
1365 /* Cerca di leggere il file per impostare le opzioni. */
1366 Scanner scanner = null;
1367 File file = new File( "JBriscolaConfig.txt" );
1368 if ( file.exists() ) {
1369 try {
1370 scanner = new Scanner( file );
1371 } catch ( FileNotFoundException e ) { }
1372 try {
1373 lang = scanner.next();
1374 soundString = scanner.next();
1375 keysString = scanner.next();
1376 r = scanner.nextInt();
1377 g = scanner.nextInt();
1378 b = scanner.nextInt();
1379 } catch ( NoSuchElementException e ) { }
1380 }
1381
1382 /* Modifica le opzioni. */
1383 if ( lang.equals( "it" ) ) {
1384 semi[0] = "Bastoni";
1385 semi[1] = "Coppe";
1386 semi[2] = "Denari";
1387 semi[3] = "Spade";
1388 stringaBriscola = "Briscola";
1389 stringaBottonePrendi = "Prendi/Lascia carte";
1390 stringaPrimaGioca = "Prima Gioca!";
1391 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
1392 stringaVinto = "Hai Vinto!";
1393 stringaPerso = "Hai Perso";
1394 stringaPareggio = "Pareggio";
1395 stringaGiocatore = "Giocatore: ";
1396 stringaComputer = "\nComputer: ";
1397 stringaNuovaPartita = "Nuova Partita";
1398 stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
1399 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
1400 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
1401 stringaSi = "Si";
1402 stringaNo = "No";
1403 stringaOpzioni = "Opzioni...";
1404 stringaEsci = "Esci";
1405 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
1406 stringaLingua = "Lingua";
1407 stringaAnnulla = "Annulla";
1408 stringaIt = "Italiano";
1409 stringaLa = "Latino";
1410 stringaBL = "Dialetto Bellunese";
1411 stringaBV = "Dialetto Basso Veneto";
1412 stringaEN = "Inglese";
1413 stringaModificaOpzioni = "Modifica Opzioni";
1414 stringaInformazioni = "Informazioni";
1415 stringaInformazioni2 = "JBriscola e' un gioco di briscola per pc scritto in java ideato\ne realizzato da Sebastiano Tronto. Il gioco viene rilasciato sotto licenza GNU/Gpl versione 2 o successive; questo permette\npotenzialmente a chiunque di modificare il gioco partendo dal codice sorgente del programma. Se non avete ricevuto i sorgenti\nassieme al gioco, potete richiedermeli con un'e-mail a sebastiano@luganega.org.\n\nJBriscola version" + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
1416 stringaSuono = "Effetti sonori";
1417 stringaPunteggio = "Punteggio";
1418 stringaSfondo = "Sfondo";
1419 stringaTasti = "Tasti rapidi";
1420 stringaAggiornamenti = "Cerca aggiornamenti";
1421 stringaTrucchi = "Trucchi";
1422 stringaInserisciCodice = "Inserisci il codice:";
1423 stringaTruccoAttivato = "Trucco attivato!";
1424 stringaTruccoSbagliato = "Trucco non valido";
1425 stringaCheCartaVuoi = "E allora che carta vuoi?";
1426 stringaAggiornamentiSi = "Aggiornamento disponibile: ";
1427 stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
1428 stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
1429 stringaNoInternet = "Errore: nessuna connessione internet";
1430 stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1431 }
1432 else if ( lang.equals( "la" ) ) {
1433 semi[0] = "BACULI";
1434 semi[1] = "CALICES";
1435 semi[2] = "DENARII";
1436 semi[3] = "GLADII";
1437 stringaBriscola = "BRISCOLA";
1438 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
1439 stringaPrimaGioca = "ANTE CHARTAM PONE!";
1440 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
1441 stringaVinto = "VICISTI!";
1442 stringaPerso = "PERDIDISTI";
1443 stringaPareggio = "AEQVATIO!";
1444 stringaGiocatore = "LVSOR: ";
1445 stringaComputer = "\nCOMPVTER: ";
1446 stringaNuovaPartita = "NOVA LVSO";
1447 stringaNuovaPartitaAiTrenta = "NOVA LVSO XXX";
1448 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
1449 stringaVuoiDavveroUscire = "EXIRE?";
1450 stringaSi = "ID VOLO";
1451 stringaNo = "NOLO";
1452 stringaOpzioni = "OPTIONES...";
1453 stringaEsci = "EXIRE";
1454 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
1455 stringaLingua = "LINGVA";
1456 stringaAnnulla = "ABROGA";
1457 stringaIt = "ITALICA";
1458 stringaLa = "LATINA";
1459 stringaBL = "BELLUNI";
1460 stringaBV = "VENETIAE";
1461 stringaEN = "ANGLICVS";
1462 stringaModificaOpzioni = "OPTIONES NOVARE";
1463 stringaInformazioni = "INFORMATIONES";
1464 stringaInformazioni2 = "JBriscola EST LVDVM BRISCOLAE COMPVTERI, JAVA SCRIPTVM, EXCOGITATVM\nFACTVMQUE A SEBASTIANO TRONTO. IPSVM LUDVM REICITUR LICENTIA GNU/Gpl VERSIONE 2 AVT POSTERIORIBUS; ID\nOMNIBVS LVDVM MUTARE CODICE IPSIVS INCIPIENDO LICET. SI CODICES CUM\nLVDO NON PERVENIT, EOS POSCERE POTESTIS E-MAILE sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
1465 stringaSuono = "SONVS";
1466 stringaPunteggio = "NVMERI";
1467 stringaSfondo = "COLOR";
1468 stringaTasti = "TASTI RAPIDI";
1469 stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE";
1470 stringaTrucchi = "CODICES";
1471 stringaInserisciCodice = "CODICEM INSCRIBE:";
1472 stringaTruccoAttivato = "CODEX INCIPIVIT!";
1473 stringaTruccoSbagliato = "ERROR CODICIS";
1474 stringaCheCartaVuoi = "QUAM CHARTAM VOLIS?";
1475 stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST";
1476 stringaAggiornamentiSi = "VERSIO RECENTIOR EST: ";
1477 stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST";
1478 stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html";
1479 stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1480 }
1481 if ( lang.equals( "bl" ) ) {
1482 semi[0] = "Bastoi";
1483 semi[1] = "Coppe";
1484 semi[2] = "Danari";
1485 semi[3] = "Spade";
1486 stringaBriscola = "Briscola";
1487 stringaBottonePrendi = "Cio' su/lasa le carte";
1488 stringaPrimaGioca = "Prima Duga!";
1489 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1490 stringaVinto = "Te ha vint!";
1491 stringaPerso = "Te ha pers";
1492 stringaPareggio = "Pari";
1493 stringaGiocatore = "Dugador: ";
1494 stringaComputer = "\nComputer: ";
1495 stringaNuovaPartita = "Taca n'altra partida";
1496 stringaNuovaPartitaAiTrenta = "Taca na partida ai 30";
1497 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1498 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1499 stringaSi = "Si";
1500 stringaNo = "No";
1501 stringaOpzioni = "Opzioni...";
1502 stringaEsci = "Stusa su";
1503 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1504 stringaLingua = "Lengua";
1505 stringaAnnulla = "Annulla";
1506 stringaIt = "Italian";
1507 stringaLa = "Latin";
1508 stringaBL = "Dialeto de Belun";
1509 stringaBV = "Dialeto de la basa";
1510 stringaEN = "Inglese";
1511 stringaModificaOpzioni = "Modifica Opzioni";
1512 stringaInformazioni = "Informazioni";
1513 stringaInformazioni2 = "JBriscola le' an dugo de briscola par computer scrit in java, pensa' e realiza'\n da Sebastiano Tronto. Al dugo l'e' sotto licenza GNU/Gpl versione 2 o sucesive; questo ol dir che chi che ol\n(se l'e' bon) al pol modificar al dugo coi codici sorgenti del programa. Se no i ve ha dat i sorgenti\nasieme al dugo, pote' domandarmeli co na e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
1514 stringaSuono = "Efeti sonori";
1515 stringaPunteggio = "Varda i punti";
1516 stringaSfondo = "Sfondo";
1517 stringaTasti = "Tasti rapidi";
1518 stringaAggiornamenti = "Varda se ghe ne' na version pi nova";
1519 stringaTrucchi = "Truchi";
1520 stringaInserisciCodice = "Scrivi al codice:";
1521 stringaTruccoAttivato = "Truco ativa'!";
1522 stringaTruccoSbagliato = "Truco sbaia'";
1523 stringaCheCartaVuoi = "Che carta utu alora?";
1524 stringaAggiornamentiSi = "Ghe ne' na version pi nova: ";
1525 stringaAggiornamentiNo = "No ghe ne na version pi nova";
1526 stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1527 stringaNoInternet = "Erore: no te se su internet";
1528 stringaTasti2 = "1 Duga la prima carta\n2 Duga la seconda carta\n3 Duga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1529 }
1530 if ( lang.equals( "bv" ) ) {
1531 semi[0] = "Bastoni";
1532 semi[1] = "Coppe";
1533 semi[2] = "Danari";
1534 semi[3] = "Spade";
1535 stringaBriscola = "Briscola";
1536 stringaBottonePrendi = "Ciapa su/lasa e carte";
1537 stringaPrimaGioca = "Prima Zuga!";
1538 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1539 stringaVinto = "Ti ga vinto!";
1540 stringaPerso = "Ti ga perso";
1541 stringaPareggio = "Pari";
1542 stringaGiocatore = "Zugador: ";
1543 stringaComputer = "\nComputer: ";
1544 stringaNuovaPartita = "N'altra Partida";
1545 stringaNuovaPartitaAiTrenta = "Na Partida ai 30";
1546 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1547 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1548 stringaSi = "Si";
1549 stringaNo = "No";
1550 stringaOpzioni = "Opzioni...";
1551 stringaEsci = "Stusa su";
1552 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1553 stringaLingua = "Lengua";
1554 stringaAnnulla = "Annulla";
1555 stringaIt = "Italian";
1556 stringaLa = "Latin";
1557 stringaBL = "Dialeto Belumat";
1558 stringaBV = "Dialeto Veneto";
1559 stringaEN = "Inglese";
1560 stringaModificaOpzioni = "Modifica Opzioni";
1561 stringaInformazioni = "Informasioni";
1562 stringaInformazioni2 = "JBriscola xe an zugo de briscola par computer scrito in java, pensato e realisato\n da Sebastiano Tronto. Al zugo xe sotto licenza GNU/Gpl versione 2 o sucesive; questo vol dire che chi che\nvol (se xe bono) al pol modificare al zugo coi codici sorgenti del programa. Se no i ve ha dato i sorgenti\nasieme al zugo, pote' domandarmeli co na e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
1563 stringaSuono = "Efeti sonori";
1564 stringaPunteggio = "Varda i punti";
1565 stringaSfondo = "Sfondo";
1566 stringaTasti = "Tasti rapidi";
1567 stringaAggiornamenti = "Varda se ghe xe na versione pi nova";
1568 stringaTrucchi = "Truchi";
1569 stringaInserisciCodice = "Scrivi al codice:";
1570 stringaTruccoAttivato = "Truco ativa'!";
1571 stringaTruccoSbagliato = "Truco sbaia'";
1572 stringaCheCartaVuoi = "Che carta utu alora?";
1573 stringaAggiornamentiSi = "Ghe xe na versione pi nova: ";
1574 stringaAggiornamentiNo = "No ghe xe na versione pi nova";
1575 stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1576 stringaNoInternet = "Erore: no ti xe su internet";
1577 stringaTasti2 = "1 Zuga la prima carta\n2 Zuga la seconda carta\n3 Zuga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1578 }
1579 if ( lang.equals( "en" ) ) {
1580 semi[0] = "Sticks";
1581 semi[1] = "Cups";
1582 semi[2] = "Golds";
1583 semi[3] = "Swords";
1584 stringaBriscola = "Briscola";
1585 stringaBottonePrendi = "Take/leave cards";
1586 stringaPrimaGioca = "Play your card before!";
1587 stringaUltime4 = "Last card - keep your eye on the briscola!";
1588 stringaVinto = "You won!";
1589 stringaPerso = "You lost";
1590 stringaPareggio = "Sixty - sixty!";
1591 stringaGiocatore = "Palyer: ";
1592 stringaComputer = "\nComputer: ";
1593 stringaNuovaPartita = "New Game";
1594 stringaNuovaPartitaAiTrenta = "New Game - 30 Points";
1595 stringaVuoiDavveroIniziare = "Do you really want to start a new game?";
1596 stringaVuoiDavveroUscire = "Do you really want to exit?";
1597 stringaSi = "Yes";
1598 stringaNo = "No";
1599 stringaOpzioni = "Options...";
1600 stringaEsci = "Exit";
1601 stringaImpossibileConfigurare = "Couldn't write to the configuration file.\nPlease report the bug to: sebastiano@luganega.org\n\nException:\n";
1602 stringaLingua = "Lang";
1603 stringaAnnulla = "Cancel";
1604 stringaIt = "Italian";
1605 stringaLa = "Latin";
1606 stringaBL = "Belluno dialect";
1607 stringaBV = "Venice dialect";
1608 stringaEN = "English";
1609 stringaModificaOpzioni = "Change options";
1610 stringaInformazioni = "Information";
1611 stringaInformazioni2 = "JBriscola is a briscola pc game written in java, meant\nand made by Sebastiano Tronto. The game is protected by the GNU/General public licence version 2 or later.\n\nJBriscola version" + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
1612 stringaSuono = "Sound";
1613 stringaPunteggio = "Score";
1614 stringaSfondo = "Background";
1615 stringaTasti = "Hot keys";
1616 stringaAggiornamenti = "Check updates";
1617 stringaTrucchi = "Cheats";
1618 stringaInserisciCodice = "Insert cheat:";
1619 stringaTruccoAttivato = "Cheat actived!";
1620 stringaTruccoSbagliato = "Wrong cheat";
1621 stringaCheCartaVuoi = "So what card do you want?";
1622 stringaAggiornamentiSi = "Update available: ";
1623 stringaAggiornamentiNo = "No updates available";
1624 stringaScarica = "You can get the latest version from the site\nhttp://porkynator.altervista.org/programmi.html";
1625 stringaNoInternet = "Error: no internet connection";
1626 stringaTasti2 = "1 Play the first card\n2 Play the second card\n3 Play the third card\nF1 Get this message\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1627 }
1628 sound = ( soundString.equals( "suono=si" ) );
1629 keys = ( keysString.equals( "tasti=si" ) );
1630 color = new Color( r, g, b );
1631 if ( frame != null ) {
1632 frame.pannello.repaint();
1633 frame.pannello2.repaint();
1634 frame.repaint();
1635 }
1636 }
1637}
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/OptionFrame.java b/JBriscola/all_versions/0.3/0.3.1/src/OptionFrame.java
new file mode 100755
index 0000000..d89745b
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/OptionFrame.java
@@ -0,0 +1,169 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public 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.3/0.3.1/src/Pannello.java b/JBriscola/all_versions/0.3/0.3.1/src/Pannello.java
new file mode 100755
index 0000000..ca9e9c6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/Pannello.java
@@ -0,0 +1,88 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25/* Questa classe dispone semplicemente le carte
26 * sulla finestra e imposta la sfondo. */
27public class Pannello extends JPanel {
28
29 public static Main main;
30
31 public static Color color;
32
33 public Pannello() { }
34
35 public void paint( Graphics g ) {
36
37 super.paint( g );
38
39 setBackground( main.color );
40
41 if ( main.frame.ultimaCarta != null )
42 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
43
44 if ( main.frame.mazzo )
45 main.frame.retro2.paintIcon( this, g, 17, 256 );
46
47 if ( main.carteScoperte ) {
48
49 if ( main.frame.carteCPU[0] != null )
50 main.frame.carteCPU[0].paintIcon( this, g, 230, 5 );
51
52 if ( main.frame.carteCPU[1] != null )
53 main.frame.carteCPU[1].paintIcon( this, g, 300, 5 );
54
55 if ( main.frame.carteCPU[2] != null )
56 main.frame.carteCPU[2].paintIcon( this, g, 370, 5 );
57
58 } else {
59
60 if ( main.frame.carteCPU[0] != null )
61 main.frame.retro1.paintIcon( this, g, 230, 5 );
62
63 if ( main.frame.carteCPU[1] != null )
64 main.frame.retro1.paintIcon( this, g, 300, 5 );
65
66 if ( main.frame.carteCPU[2] != null )
67 main.frame.retro1.paintIcon( this, g, 370, 5 );
68
69 }
70
71 if ( main.frame.carteInMano[0] != null )
72 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
73
74 if ( main.frame.carteInMano[1] != null )
75 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
76
77 if ( main.frame.carteInMano[2] != null )
78 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
79
80 if ( main.frame.giocata[0] != null )
81 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
82
83 if ( main.frame.giocata[1] != null )
84 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
85
86 }
87}
88
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/1-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/1-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/1-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/1-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/10-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/10-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/10-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/10-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/2-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/2-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/2-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/2-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/3-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/3-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/3-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/3-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/4-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/4-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/4-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/4-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/5-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/5-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/5-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/5-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/6-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/6-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/6-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/6-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/7-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/7-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/7-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/7-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/8-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/8-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/8-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/8-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/9-1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/9-2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/9-3.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/9-4.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/Thumbs.db b/JBriscola/all_versions/0.3/0.3.1/src/img/Thumbs.db
new file mode 100755
index 0000000..d9b6bc5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/Thumbs.db
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/carte.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/retro1.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/img/retro2.jpg b/JBriscola/all_versions/0.3/0.3.1/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/0.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/1.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/2.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/3.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/4.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/5.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/pareggio.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/perso.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.1/src/sounds/vinto.wav b/JBriscola/all_versions/0.3/0.3.1/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.1/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/CartePassateFrame.java b/JBriscola/all_versions/0.3/0.3.2/src/CartePassateFrame.java
new file mode 100755
index 0000000..c1d90ef
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/CartePassateFrame.java
@@ -0,0 +1,39 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class CartePassateFrame extends JFrame {
26
27 public static Main main = new Main();
28 public static PannelloCartePassate pannelloCP = new PannelloCartePassate();
29
30 CartePassateFrame() {
31 super( "JBriscola - " + main.stringaCartePassate );
32 pannelloCP.repaint();
33 add( pannelloCP );
34 }
35
36}
37
38
39
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/Frame.java b/JBriscola/all_versions/0.3/0.3.2/src/Frame.java
new file mode 100755
index 0000000..c211cab
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/Frame.java
@@ -0,0 +1,552 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.net.*;
26import java.awt.*;
27import java.awt.event.*;
28
29public 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, nuovaPartitaAiTrenta, opzioni, esci, informazioni, punti, cartePassate, aggiornamenti, trucchi, tastiRapidi, briscola;
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[] arrayCartePassate = new ImageIcon[40];
52 public static ImageIcon[][] arrayCarte = new ImageIcon[10][4];
53
54 public Frame() {
55
56 super( "Tronto's JBriscola " + main.version );
57
58 mazzo = true;
59 main = new Main();
60 pannello = new Pannello();
61 pannello2 = new JPanel( new FlowLayout() );
62
63 button = new JButton( main.stringaBottonePrendi );
64 button.addActionListener( new ActionListener() {
65
66 /* Quando viene premuto il bottone per prendere/lasciare le carte,
67 * valuta innanzitutto se il giocatore ha giocato, poi a chi
68 * darle ed eventualmente, se è finita la partita, a caricare
69 * il suono adatto. */
70 public void actionPerformed( ActionEvent e ) {
71
72 arrayCartePassate[main.mano*2] = giocata[0];
73 arrayCartePassate[main.mano*2+1] = giocata[1];
74
75 if ( giocata[0] != null && giocata[1] != null )
76 main.mano++;
77
78 try {
79 main.chiPrende();
80 } catch ( Exception ex ) {
81 /* Avvisa di giocare una carta. */
82 JOptionPane.showMessageDialog( Frame.this, main.stringaPrimaGioca, "JBriscola " + main.version, JOptionPane.WARNING_MESSAGE );
83 }
84
85 /* Avvisa che si è arrivati alla quartultima mano. */
86 if ( main.mano == 16 )
87 JOptionPane.showMessageDialog( Frame.this, main.stringaUltime4, "JBriscola " + main.version, JOptionPane.INFORMATION_MESSAGE );
88
89 /* Non disegna più la briscola e il mazzo se sono già state
90 * pescate tutte le carte. */
91 if ( main.mano == 17 ) {
92 mazzo = false;
93 ultimaCarta = null;
94 pannello.repaint();
95 Frame.this.repaint();
96 }
97
98 /* Mostra il punteggio e carica i suoni se è finita la partita. */
99 if ( main.mano == 20 ||
100 ( main.aiTrenta &&
101 ( ( main.punteggio >= 30 || main.punteggioCPU >= 30 ) ) ) ) {
102
103 String titolo = "";
104 String suonoFinale = "";
105
106 if ( main.punteggio > main.punteggioCPU ) {
107 titolo = main.stringaVinto;
108 suonoFinale = "sounds/perso.wav";
109 }
110 if ( main.punteggio < main.punteggioCPU ) {
111 titolo = main.stringaPerso;
112 suonoFinale = "sounds/vinto.wav";
113 }
114 if ( main.punteggio == main.punteggioCPU ) {
115 titolo = main.stringaPareggio;
116 suonoFinale = "sounds/pareggio.wav";
117 }
118
119 if ( main.sound ) {
120 try {
121 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
122 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
123 AudioFormat af = aff.getFormat();
124 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
125 Clip ol = ( Clip ) AudioSystem.getLine( info );
126 ol.open(ais);
127 ol.loop( 0 );
128 } catch ( Exception ex ) {
129 System.err.println( e );
130 }
131 }
132
133 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.INFORMATION_MESSAGE );
134
135 main.pulisciTavolo();
136
137 }
138 if ( main.toccaAllaCPU )
139 if ( main.aiTrenta )
140 main.giocaCPUAiTrenta();
141 else
142 main.giocaCPU();
143 }
144 } );
145 button.addKeyListener( new KeyAdapter() {
146 /* Aggiunge il keyListener per le scorciatoie da tastiera. Dato
147 * che il bottone prendi/lascia è l'unico componente effettivo
148 * della finestra, avrà obbligatoriamente il focus ed è necessario
149 * che sia lui a gestire gli eventi della tastiera. */
150 public void keyReleased( KeyEvent key ) {
151
152 if ( main.keys ) {
153 switch ( key.getKeyCode() ) {
154 case KeyEvent.VK_1:
155 if ( mettiCarta( 231, 500 ) ) {
156 if ( !main.CPUHaGiocato )
157 if ( main.aiTrenta )
158 main.giocaCPUAiTrenta();
159 else
160 main.giocaCPU();
161 }
162 break;
163
164 case KeyEvent.VK_2:
165 if ( mettiCarta( 301, 500 ) ) {
166 if ( !main.CPUHaGiocato )
167 if ( main.aiTrenta )
168 main.giocaCPUAiTrenta();
169 else
170 main.giocaCPU();
171 }
172 break;
173
174 case KeyEvent.VK_3:
175 if ( mettiCarta( 371, 500 ) ) {
176 if ( !main.CPUHaGiocato )
177 if ( main.aiTrenta )
178 main.giocaCPUAiTrenta();
179 else
180 main.giocaCPU();
181 }
182 break;
183
184 case KeyEvent.VK_F1:
185 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
186 break;
187
188 case KeyEvent.VK_F2:
189 if ( main.mano == 20 ) {
190 main.aiTrenta = false;
191 main.mischia();
192 pannello.repaint();
193 repaint();
194 }
195 else {
196 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 );
197 if ( selezione == JOptionPane.YES_OPTION ) {
198 main.aiTrenta = false;
199 main.mischia();
200 pannello.repaint();
201 repaint();
202 }
203 }
204 break;
205
206 case KeyEvent.VK_F3:
207 OptionFrame optionFrame = new OptionFrame();
208 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
209 optionFrame.setResizable( false );
210 optionFrame.setAlwaysOnTop( true );
211 optionFrame.setSize( 300, 200 );
212 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
213 optionFrame.setVisible( true );
214 break;
215
216 case KeyEvent.VK_F4:
217 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
218 break;
219
220 case KeyEvent.VK_F5:
221 CartePassateFrame cartePassateFrame = new CartePassateFrame();
222 cartePassateFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
223 cartePassateFrame.setResizable( false );
224 cartePassateFrame.setAlwaysOnTop( true );
225 cartePassateFrame.setSize( 700, 560 );
226 cartePassateFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 700) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 560) / 2);
227 cartePassateFrame.setVisible( true );
228 break;
229
230 case KeyEvent.VK_F6:
231 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
232 break;
233
234 case KeyEvent.VK_F7:
235 String latest = main.version;
236 try {
237 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
238 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
239 latest = latestIsReader.readLine();
240 } catch ( Exception ex ) {
241 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
242 }
243 if ( latest.equals( main.version ) )
244 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
245 else
246 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
247 break;
248
249 case KeyEvent.VK_F8:
250 if ( main.mano == 20 ) {
251 main.aiTrenta = true;
252 main.mischia();
253 pannello.repaint();
254 repaint();
255 }
256 else {
257 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 );
258 if ( selezione == JOptionPane.YES_OPTION ) {
259 main.aiTrenta = true;
260 main.mischia();
261 pannello.repaint();
262 repaint();
263 }
264 }
265 break;
266
267 case KeyEvent.VK_F9:
268 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
269 break;
270
271 case KeyEvent.VK_Q:
272 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 );
273 if ( selezione == JOptionPane.YES_OPTION )
274 Frame.this.dispose();
275 break;
276 }
277 }
278 }
279 } );
280
281 barraMenu = new JMenuBar();
282
283 file = new JMenu( "File" );
284
285 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
286 nuovaPartita.addActionListener( new ActionListener() {
287 /* Avvia una nuova partita, chiedendo prima conferma se ce n'è
288 * già una in corso. */
289 public void actionPerformed( ActionEvent e ) {
290 if ( main.mano == 20 ) {
291 main.aiTrenta = false;
292 main.mischia();
293 pannello.repaint();
294 repaint();
295 }
296
297 else {
298 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 );
299 if ( selezione == JOptionPane.YES_OPTION ) {
300 main.aiTrenta = false;
301 main.mischia();
302 pannello.repaint();
303 repaint();
304 }
305 }
306 }
307 });
308
309 nuovaPartitaAiTrenta = new JMenuItem( main.stringaNuovaPartitaAiTrenta );
310 nuovaPartitaAiTrenta.addActionListener( new ActionListener() {
311 /* Avvia una nuova partita ai 30, chiedendo prima conferma se
312 * ce n'è già una in corso. */
313 public void actionPerformed( ActionEvent e ) {
314 if ( main.mano == 20 ) {
315 main.aiTrenta = true;
316 main.mischia();
317 pannello.repaint();
318 repaint();
319 }
320
321 else {
322 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 );
323 if ( selezione == JOptionPane.YES_OPTION ) {
324 main.aiTrenta = true;
325 main.mischia();
326 pannello.repaint();
327 repaint();
328 }
329 }
330 }
331 });
332
333 trucchi = new JMenuItem( main.stringaTrucchi );
334 trucchi.addActionListener( new ActionListener() {
335 public void actionPerformed( ActionEvent e ) {
336 /* Esegue il trucco */
337 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
338 }
339 } );
340
341 opzioni = new JMenuItem( main.stringaOpzioni );
342 opzioni.addActionListener( new ActionListener() {
343 /* Apre una OptionFrame per modificare le opzioni. */
344 public void actionPerformed( ActionEvent e ) {
345
346 OptionFrame optionFrame = new OptionFrame();
347 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
348 optionFrame.setResizable( false );
349 optionFrame.setAlwaysOnTop( true );
350 optionFrame.setSize( 300, 200 );
351 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
352 optionFrame.setVisible( true );
353 }
354 });
355
356 esci = new JMenuItem( main.stringaEsci );
357 esci.addActionListener( new ActionListener() {
358 /* Ciede conferma prima di uscire. */
359 public void actionPerformed( ActionEvent e ) {
360 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 );
361 if ( selezione == JOptionPane.YES_OPTION )
362 Frame.this.dispose();
363 }
364 });
365
366 file.add( nuovaPartita );
367 file.add( nuovaPartitaAiTrenta );
368 file.add( trucchi );
369 file.add( opzioni );
370 file.addSeparator();
371 file.add( esci );
372
373 puntoInterrogativo = new JMenu( "?" );
374
375 informazioni = new JMenuItem( main.stringaInformazioni );
376 informazioni.addActionListener( new ActionListener() {
377 /* Visualizza le informazioni. */
378 public void actionPerformed( ActionEvent e ) {
379 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
380 }
381 } );
382
383 tastiRapidi = new JMenuItem( main.stringaTasti );
384 tastiRapidi.addActionListener( new ActionListener() {
385 /* Visualizza i tasti rapidi. */
386 public void actionPerformed( ActionEvent e ) {
387 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
388 }
389 } );
390
391 briscola = new JMenuItem( main.stringaBriscola );
392 briscola.addActionListener( new ActionListener() {
393 /* Visualizza il seme di briscola corrente. */
394 public void actionPerformed( ActionEvent e ) {
395 JOptionPane.showMessageDialog( Frame.this, main.stringaBriscola + ": " + main.semi[main.semeBriscola], "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
396 }
397 });
398
399 punti = new JMenuItem( main.stringaPunteggio );
400 punti.addActionListener( new ActionListener() {
401 /* Visualizza il punteggio. */
402 public void actionPerformed( ActionEvent e ) {
403 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
404 }
405 } );
406
407 cartePassate = new JMenuItem( main.stringaCartePassate );
408 cartePassate.addActionListener( new ActionListener() {
409 /*Visualizza le carte passate*/
410 public void actionPerformed( ActionEvent e ) {
411 CartePassateFrame cartePassateFrame = new CartePassateFrame();
412 cartePassateFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
413 cartePassateFrame.setResizable( false );
414 cartePassateFrame.setAlwaysOnTop( true );
415 cartePassateFrame.setSize( 700, 560 );
416 cartePassateFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 700) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 560) / 2);
417 cartePassateFrame.setVisible( true );
418 }
419 } );
420
421 aggiornamenti = new JMenuItem( main.stringaAggiornamenti );
422 aggiornamenti.addActionListener( new ActionListener() {
423 /* Cerca aggiornamenti sul sito http://porkynator.altervista.org,
424 * confrontando la versione del programma con quella scritta nel
425 * file jbriscola-latest.is (online). */
426 public void actionPerformed( ActionEvent e ) {
427 String latest = main.version;
428 try {
429 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
430 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
431 latest = latestIsReader.readLine();
432 } catch ( Exception ex ) {
433 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
434 }
435 if ( latest.equals( main.version ) )
436 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
437 else
438 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
439 }
440 } );
441
442 puntoInterrogativo.add( punti );
443 puntoInterrogativo.add( cartePassate );
444 puntoInterrogativo.add( briscola );
445 puntoInterrogativo.add( tastiRapidi );
446 puntoInterrogativo.add( informazioni );
447 puntoInterrogativo.add( aggiornamenti );
448
449 barraMenu.add( file );
450 barraMenu.add( puntoInterrogativo );
451
452 setJMenuBar( barraMenu );
453
454 /* Inizializza le immagini del retro delle carte. */
455 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
456 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
457
458 /* Inizializza tutte le immagini delle carte scorrendo l'array bidimensionale. */
459 for (int i = 0; i < 10; i++)
460 for (int j = 0; j < 4; j++)
461 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
462
463 /* Mischia le carte. */
464 main.mischia();
465
466 /* Aggiunge i vari componenti. */
467 pannello2.add( button );
468 setLayout( new BorderLayout() );
469 add( pannello, BorderLayout.CENTER );
470 add( pannello2, BorderLayout.SOUTH );
471
472 /* Chiama il metodo mettiCarta se l'utente clicca. */
473 addMouseListener(
474 new MouseAdapter() {
475 public void mouseClicked ( MouseEvent e ) {
476 if ( mettiCarta( e.getX(), e.getY() ) ) {
477 if ( !main.CPUHaGiocato )
478 if ( main.aiTrenta )
479 main.giocaCPUAiTrenta();
480 else
481 main.giocaCPU();
482 }
483 }
484 }
485 );
486
487 /* Chiede conferma prima di uscire quando viene chiusa la finestra. */
488 addWindowListener(
489 new WindowAdapter() {
490 public void windowClosing( WindowEvent e ) {
491 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 );
492 if ( selezione == JOptionPane.YES_OPTION )
493 System.exit( 0 );
494 }
495 }
496 );
497 }
498
499 /* Se il giocatore ha cliccato su una carta la gioca e riproduce un suono casuale. */
500 public boolean mettiCarta( int x, int y ) {
501
502 if ( !main.toccaAllaCPU && giocata[0] == null ) {
503 if ( main.sound &&
504 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
505 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
506 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
507 try {
508
509 double a = Math.random() * 6;
510 int i = (int) a;
511
512 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
513 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
514 AudioFormat af = aff.getFormat();
515 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
516 Clip ol = ( Clip ) AudioSystem.getLine( info );
517
518 ol.open(ais);
519 ol.loop( 0 );
520
521 } catch ( Exception e ) {
522 System.err.println( e );
523 }
524 }
525
526 if ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) {
527 giocata[0] = carteInMano[0];
528 carteInMano[0] = null;
529 pannello.repaint();
530 return true;
531 }
532
533 if ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) {
534 giocata[0] = carteInMano[1];
535 carteInMano[1] = null;
536 pannello.repaint();
537 return true;
538 }
539
540 if ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) {
541 giocata[0] = carteInMano[2];
542 carteInMano[2] = null;
543 pannello.repaint();
544 return true;
545 }
546 }
547
548 return false;
549 }
550}
551
552
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/Main.java b/JBriscola/all_versions/0.3/0.3.2/src/Main.java
new file mode 100755
index 0000000..3760a0d
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/Main.java
@@ -0,0 +1,2086 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public class Main {
28
29 /*Costanti per i semi e i valori delle carte*/
30 public static final int COPPE = 0;
31 public static final int BASTONI = 1;
32 public static final int DENARI = 2;
33 public static final int SPADE = 3;
34 public static final int RE = 0;
35 public static final int ASSO = 1;
36 public static final int DUE = 2;
37 public static final int TRE = 3;
38 public static final int QUATTRO = 4;
39 public static final int CINQUE = 5;
40 public static final int SEI = 6;
41 public static final int SETTE = 7;
42 public static final int FANTE = 8;
43 public static final int CAVALLO = 9;
44
45 /* semeBriscola serve a determinare quale il seme di briscola (0 coppe,
46 * 1 bastoni, 2 denari, 3 spade).
47 * punteggio è il punteggio del giocatore, punteggioCPU quello della CPU
48 * mano tiene il conto della mano a cui si è arrivati.
49 * cartaDaPescare è la carta che la CPU deve raccogliere dal mazzo
50 * cartaDaGiocare (può assumere valore compraso tra 0 e 2) è la carta
51 * che la cpu deve giocare. */
52 public static int semeBriscola, punteggio, punteggioCPU, mano, cartaDaPescare, cartaDaGiocare;
53
54 /* toccaAllaCPU determina se è il turno del computer o del giocatore,
55 * CPUHaGiocato se il computer ha già giocato in questo turno e
56 * haGiocatoPrima se la prima mossa del turno è stata del giocatore
57 * (true) o della CPU (false).
58 * aiTrenta serve per determinare se la partida che si sta giocando è
59 * normale o ai 30.
60 * carteScoperte serve se viene attivato il trucco per mostrare le
61 * carte della CPU.
62 * sound e keys riguardano le opzioni (souno si o no, tasti rapidi si
63 * o no) salvate nel file di configurazione. */
64 public static boolean toccaAllaCPU = false;
65 public static boolean CPUHaGiocato = false;
66 public static boolean haGiocatoPrima = true;
67 public static boolean aiTrenta = false;
68 public static boolean carteScoperte = false;
69 public static boolean sound = true;
70 public static boolean keys = true;
71
72 /* frame è la finestra principale del gioco, color il colore dello sfondo.
73 * lang, soundString e keysString servono a leggere le opzioni dal file
74 * di configurazione. */
75 public static Frame frame;
76 public static Color color = new Color( 0, 150, 0 );
77 public static String lang, soundString, keysString;
78
79 /* Tutte le stringhe che vengono utilizzate durante il gioco sono
80 * inizializzate qui, per poter essere tradotte in altre lingue. */
81 public static String version = "0.3.2";
82 public static String semi[] = { "Bastoni", "Coppe", "Denari", "Spade" };
83 public static String stringaBriscola = "Briscola";
84 public static String stringaBottonePrendi = "Prendi/Lascia carte";
85 public static String stringaPrimaGioca = "Prima Gioca!";
86 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
87 public static String stringaVinto = "Hai Vinto!";
88 public static String stringaPerso = "Hai Perso";
89 public static String stringaPareggio = "Pareggio";
90 public static String stringaGiocatore = "Giocatore: ";
91 public static String stringaComputer = "\nComputer: ";
92 public static String stringaNuovaPartita = "Nuova Partita";
93 public static String stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
94 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
95 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
96 public static String stringaSi = "Si";
97 public static String stringaNo = "No";
98 public static String stringaOpzioni = "Opzioni...";
99 public static String stringaEsci = "Esci";
100 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
101 public static String stringaLingua = "Lingua";
102 public static String stringaAnnulla = "Annulla";
103 public static String stringaIt = "Italiano";
104 public static String stringaLa = "Latino";
105 public static String stringaBL = "Dialetto Bellunese";
106 public static String stringaBV = "Dialetto Basso Veneto";
107 public static String stringaEN = "Inglese";
108 public static String stringaModificaOpzioni = "Modifica Opzioni";
109 public static String stringaInformazioni = "Informazioni";
110 public static String stringaInformazioni2 = "JBriscola e' un gioco di briscola per pc scritto in java ideato\ne realizzato da Sebastiano Tronto. Il gioco viene rilasciato sotto licenza GNU/Gpl versione 2 o successive; questo permette\npotenzialmente a chiunque di modificare il gioco partendo dal codice sorgente del programma. Se non avete ricevuto i sorgenti\nassieme al gioco, potete richiedermeli con un'e-mail a sebastiano@luganega.org.\n\nJBriscola version " + version + "\nCopyright 2009 Sebastiano Tronto, license GNU/Gpl 2.0 or later\nE-mail: sebastiano@luganega.org";
111 public static String stringaSuono = "Effetti Sonori";
112 public static String stringaPunteggio = "Punteggio";
113 public static String stringaCartePassate = "Carte Passate";
114 public static String stringaSfondo = "Sfondo";
115 public static String stringaTasti = "Tasti rapidi";
116 public static String stringaAggiornamenti = "Cerca aggiornamenti";
117 public static String stringaTrucchi = "Trucchi";
118 public static String stringaInserisciCodice = "Inserisci il codice:";
119 public static String stringaTruccoAttivato = "Trucco attivato!";
120 public static String stringaTruccoSbagliato = "Trucco non valido";
121 public static String stringaCheCartaVuoi = "E allora che carta vuoi?";
122 public static String stringaAggiornamentiSi = "Aggiornamento disponibile: ";
123 public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
124 public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
125 public static String stringaNoInternet = "Errore: nessuna connessione internet";
126 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 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
127
128 public static void main( String args[] ) {
129
130 /* Chiama il metodo settaOpzioni per leggere le impostazioni
131 * dell'utente da un eventuale file di configurazione */
132 settaOpzioni();
133
134 /* Crea la finestra principale del gioco e la posiziona al centro
135 * dello schermo. */
136 frame = new Frame();
137 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
138 frame.setResizable( false );
139 frame.setSize( 600, 600 );
140 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
141 frame.setVisible( true );
142 }
143
144 /* Algoritmo per mischiare il mazzo: prende due carte a caso e le
145 * inverte di posto, utilizzando una variabile aux. Ripete il procedimento
146 * per 391 volte. */
147 public void mischia() {
148
149 ImageIcon aux;
150
151 mano = 0;
152 punteggio = 0;
153 punteggioCPU = 0;
154 cartaDaPescare = 6;
155 frame.mazzo = true;
156 toccaAllaCPU = false;
157 CPUHaGiocato = false;
158 haGiocatoPrima = true;
159 frame.mazzo = true;
160
161 /* Inizializza l'array di carte mescolate ordinato */
162 for ( int i = 0, k = 0; i < 10; i++ )
163 for ( int j = 0; j < 4; j++, k++ )
164 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
165
166 /* Mescola le carte utilizzando il metodo sopra citato */
167 for ( int i = 0; i < 391; i++ ) {
168 double a = Math.random() * 40;
169 int x = (int) a;
170 double b = Math.random() * 40;
171 int y = (int) b;
172 aux = frame.arrayCarteMescolate[x];
173 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
174 frame.arrayCarteMescolate[y] = aux;
175 }
176
177 /* Imposta il seme della briscola */
178 semeBriscola = seme( frame.arrayCarteMescolate[39] );
179
180 /* Distribuisce le carte */
181 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
182 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
183 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
184 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
185 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
186 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
187 frame.ultimaCarta = frame.arrayCarteMescolate[39];
188 frame.giocata[0] = null;
189 frame.giocata[1] = null;
190 }
191
192 /* Viene chiamato a fine partita. */
193 public void pulisciTavolo() {
194
195 punteggio = 0;
196 punteggioCPU = 0;
197 cartaDaPescare = 6;
198 toccaAllaCPU = false;
199 CPUHaGiocato = false;
200 haGiocatoPrima = true;
201
202 frame.mazzo = false;
203 frame.ultimaCarta = null;
204 for ( int i = 0; i < 3; i++ ) {
205 frame.carteCPU[i] = null;
206 frame.carteInMano[i] = null;
207 }
208
209 for ( int i = 0; i < 40; i++ )
210 frame.arrayCartePassate[i] = null;
211
212 frame.pannello.repaint();
213 frame.repaint();
214
215 }
216
217 /* Fa giocare la CPU. Questo metodo contiene l'intelligenza artificiale
218 * del gioco. Ho preferito non commentare molto il corpo del metodo per
219 * due motivi; il primo è che abbastanza intuitivo: basta sapere che i
220 * vari metodi vaiLiscio(), vaiTaglio() ecc... tentano di fare ciò che
221 * ovviamente dice il loro nome, se ci riescono restituiscono true,
222 * in caso contrario false.*/
223 public void giocaCPU() {
224
225 /* Nelle prime 16 mani ragiona in maniera diversa*/
226 if ( mano < 16 ) {
227
228 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
229 if ( !haGiocato() ) {
230 if ( vaiPuntiConCarichiPassati() );
231 else if ( vaiLiscioConCarichiPassati() );
232 else if ( vaiLiscio() );
233 else if ( vaiPunti() );
234 else if ( vaiTaglio() );
235 else if ( vaiBriscolaAlta() );
236 else if ( vaiCarico() );
237 else if ( vaiTre() );
238 else if ( vaiAsso() );
239 else;
240 }
241
242 /* Valuta cosa fare quando invece il giocatore ha giocato */
243 else {
244 if ( haLisciato() ) {
245 if ( vaiSopra() );
246 else if ( vaiLiscioConCarichiInGioco() );
247 else if ( vaiLiscio() );
248 else if ( vaiPuntiConCarichiInGioco() );
249 else if ( vaiPunti() );
250 else if ( vaiTaglio() );
251 else if ( vaiTre() );
252 else if ( vaiBriscolaAlta() );
253 else if ( vaiCarico() );
254 else if ( vaiAsso() );
255 } else if ( haMessoPunti() ) {
256 if ( vaiSopra() );
257 else if ( vaiLiscioConCarichiInGioco() );
258 else if ( vaiLiscio() );
259 else if ( vaiTaglio() );
260 else if ( vaiPuntiConCarichiInGioco() );
261 else if ( vaiPunti() );
262 else if ( vaiTre() );
263 else if ( vaiBriscolaAlta() );
264 else if ( vaiCarico() );
265 else if ( vaiAsso() );
266 } else if ( haTagliato() ) {
267 if ( vaiLiscioConCarichiInGioco() );
268 else if ( vaiLiscio() );
269 else if ( vaiPuntiConCarichiInGioco() );
270 else if ( vaiPunti() );
271 else if ( vaiTaglio() );
272 else if ( vaiTre() );
273 else if ( vaiBriscolaAlta() );
274 else if ( vaiCarico() );
275 else if ( vaiAsso() );
276 } else if ( haMessoBriscolaAlta() ) {
277 if ( vaiLiscioConCarichiInGioco() );
278 else if ( vaiLiscio() );
279 else if ( vaiPuntiConCarichiInGioco() );
280 else if ( vaiPunti() );
281 else if ( vaiTre() );
282 else if ( vaiTaglio() );
283 else if ( vaiBriscolaAlta() );
284 else if ( vaiCarico() );
285 else if ( vaiAsso() );
286 } else if ( haMessoTre() ) {
287 if ( vaiAsso() );
288 else if ( vaiLiscioConCarichiInGioco() );
289 else if ( vaiLiscio() );
290 else if ( vaiPuntiConCarichiInGioco() );
291 else if ( vaiPunti() );
292 else if ( vaiTaglio() );
293 else if ( vaiBriscolaAlta() );
294 else if ( vaiCarico() );
295 } else if ( haMessoAsso() ) {
296 if ( vaiLiscioConCarichiInGioco() );
297 else if ( vaiLiscio() );
298 else if ( vaiPuntiConCarichiInGioco() );
299 else if ( vaiPunti() );
300 else if ( vaiTaglio() );
301 else if ( vaiBriscolaAlta() );
302 else if ( vaiCarico() );
303 else if ( vaiTre() );
304 } else if ( haCaricato() ) {
305 if ( vaiSopra() );
306 else if ( vaiTre() );
307 else if ( vaiBriscolaAlta() );
308 else if ( vaiTaglio() );
309 else if ( vaiAsso() );
310 else if ( vaiLiscioConCarichiInGioco() );
311 else if ( vaiLiscio() );
312 else if ( vaiPuntiConCarichiInGioco() );
313 else if ( vaiPunti() );
314 else if ( vaiCarico() );
315 }
316 }
317 }
318
319 /* Nella penultima mano (prima di pescare l'ultima carta) */
320 else if ( mano == 16 ) {
321
322 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
323 if ( !haGiocato() ) {
324 if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
325
326 if ( vaiLiscioConCarichiInGioco() );
327 else if ( vaiPuntiConCarichiInGioco() );
328 else if ( vaiCarico() );
329 else if ( vaiPunti() );
330 else if ( vaiLiscio() );
331 else if ( vaiTaglio() );
332 else if ( vaiBriscolaAlta() );
333 else if ( vaiTre() );
334 else if ( vaiAsso() );
335 else;
336 } else {
337 if ( vaiPuntiConCarichiPassati() );
338 else if ( vaiLiscioConCarichiPassati() );
339 else if ( vaiLiscio() );
340 else if ( vaiPunti() );
341 else if ( vaiTaglio() );
342 else if ( vaiBriscolaAlta() );
343 else if ( vaiCarico() );
344 else if ( vaiTre() );
345 else if ( vaiAsso() );
346 else;
347 }
348 }
349
350 /* Valuta cosa fare quando invece il giocatore ha giocato */
351 else {
352 if ( valore( frame.ultimaCarta ) == TRE || valore( frame.ultimaCarta ) == ASSO ) {
353 if ( haCaricato() ) {
354 if ( vaiSopra() );
355 else if ( vaiLiscioConCarichiInGioco() );
356 else if ( vaiPuntiConCarichiInGioco() );
357 else if ( vaiLiscio() );
358 else if ( vaiPunti() );
359 else if ( vaiTre() );
360 else if ( vaiTaglio() );
361 else if ( vaiBriscolaAlta() );
362 else if ( vaiAsso() );
363 else if ( vaiCarico() );
364 }
365 } else {
366 if ( haLisciato() ) {
367 if ( vaiSopra() );
368 else if ( vaiLiscioConCarichiInGioco() );
369 else if ( vaiPuntiConCarichiInGioco() );
370 else if ( vaiLiscio() );
371 else if ( vaiPunti() );
372 else if ( vaiTaglio() );
373 else if ( vaiTre() );
374 else if ( vaiBriscolaAlta() );
375 else if ( vaiCarico() );
376 else if ( vaiAsso() );
377 } else if ( haMessoPunti() ) {
378 if ( vaiSopra() );
379 else if ( vaiLiscioConCarichiInGioco() );
380 else if ( vaiPuntiConCarichiInGioco() );
381 else if ( vaiLiscio() );
382 else if ( vaiTaglio() );
383 else if ( vaiPunti() );
384 else if ( vaiTre() );
385 else if ( vaiBriscolaAlta() );
386 else if ( vaiCarico() );
387 else if ( vaiAsso() );
388 } else if ( haTagliato() ) {
389 if ( vaiLiscioConCarichiInGioco() );
390 else if ( vaiPuntiConCarichiInGioco() );
391 else if ( vaiLiscio() );
392 else if ( vaiPunti() );
393 else if ( vaiTaglio() );
394 else if ( vaiTre() );
395 else if ( vaiBriscolaAlta() );
396 else if ( vaiCarico() );
397 else if ( vaiAsso() );
398 } else if ( haMessoBriscolaAlta() ) {
399 if ( vaiLiscioConCarichiInGioco() );
400 else if ( vaiPuntiConCarichiInGioco() );
401 else if ( vaiLiscio() );
402 else if ( vaiPunti() );
403 else if ( vaiTre() );
404 else if ( vaiTaglio() );
405 else if ( vaiBriscolaAlta() );
406 else if ( vaiCarico() );
407 else if ( vaiAsso() );
408 } else if ( haMessoTre() ) {
409 if ( vaiAsso() );
410 else if ( vaiLiscioConCarichiInGioco() );
411 else if ( vaiPuntiConCarichiInGioco() );
412 else if ( vaiLiscio() );
413 else if ( vaiPunti() );
414 else if ( vaiTaglio() );
415 else if ( vaiBriscolaAlta() );
416 else if ( vaiCarico() );
417 } else if ( haMessoAsso() ) {
418 if ( vaiLiscioConCarichiInGioco() );
419 else if ( vaiPuntiConCarichiInGioco() );
420 else if ( vaiLiscio() );
421 else if ( vaiPunti() );
422 else if ( vaiTaglio() );
423 else if ( vaiBriscolaAlta() );
424 else if ( vaiCarico() );
425 else if ( vaiTre() );
426 } else if ( haCaricato() ) {
427 if ( vaiSopra() );
428 else if ( vaiTre() );
429 else if ( vaiBriscolaAlta() );
430 else if ( vaiAsso() );
431 else if ( vaiTaglio() );
432 else if ( vaiLiscioConCarichiInGioco() );
433 else if ( vaiPuntiConCarichiInGioco() );
434 else if ( vaiLiscio() );
435 else if ( vaiPunti() );
436 else if ( vaiCarico() );
437 }
438 }
439 }
440
441 } else if ( mano == 17 ) {
442 /* AVVISO: nelle ultime 3 mani, la CPU "guarda" le carte al giocatore;
443 * Questa non è una scorrettezza, ma semplicemente un metodo per sem-
444 * plificare i passaggi: il computer potrebbe comunque dedurre le carte
445 * che ha in mano il giocatore controllando le proprie carte e quelle
446 * che sono già passate. */
447
448 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
449 if ( !haGiocato() ) {
450 if ( hoLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
451 vaiSecondaBriscolaPiuAltaInGioco();
452 else {
453 if ( vaiLiscioConCarichiPassati() );
454 else if ( vaiPuntiConCarichiPassati() );
455 else if ( vaiLiscio() );
456 else if ( vaiPunti() );
457 else if ( vaiTaglio() );
458 else if ( vaiBriscolaAlta() );
459 else if ( vaiCarico() );
460 else if ( vaiTre() );
461 }
462 }
463
464 /* Valuta cosa fare quando invece il giocatore ha giocato */
465 else {
466 if ( haLisciato() ) {
467 if ( vaiSopra() );
468 else if ( vaiLiscioConCarichiInGioco() );
469 else if ( vaiPuntiConCarichiInGioco() );
470 else if ( vaiLiscio() );
471 else if ( vaiPunti() );
472 else if ( vaiTaglio() );
473 else if ( vaiTre() );
474 else if ( vaiBriscolaAlta() );
475 else if ( vaiCarico() );
476 else if ( vaiAsso() );
477 } else if ( haMessoPunti() ) {
478 if ( vaiSopra() );
479 else if ( vaiLiscioConCarichiInGioco() );
480 else if ( vaiPuntiConCarichiInGioco() );
481 else if ( vaiLiscio() );
482 else if ( vaiTaglio() );
483 else if ( vaiPunti() );
484 else if ( vaiTre() );
485 else if ( vaiBriscolaAlta() );
486 else if ( vaiCarico() );
487 else if ( vaiAsso() );
488 } else if ( haTagliato() ) {
489 if ( vaiLiscioConCarichiInGioco() );
490 else if ( vaiPuntiConCarichiInGioco() );
491 else if ( vaiLiscio() );
492 else if ( vaiPunti() );
493 else if ( vaiTaglio() );
494 else if ( vaiTre() );
495 else if ( vaiBriscolaAlta() );
496 else if ( vaiCarico() );
497 else if ( vaiAsso() );
498 } else if ( haMessoBriscolaAlta() ) {
499 if ( vaiLiscioConCarichiInGioco() );
500 else if ( vaiPuntiConCarichiInGioco() );
501 else if ( vaiLiscio() );
502 else if ( vaiPunti() );
503 else if ( vaiTre() );
504 else if ( vaiTaglio() );
505 else if ( vaiBriscolaAlta() );
506 else if ( vaiCarico() );
507 else if ( vaiAsso() );
508 } else if ( haMessoTre() ) {
509 if ( vaiAsso() );
510 else if ( vaiLiscioConCarichiInGioco() );
511 else if ( vaiPuntiConCarichiInGioco() );
512 else if ( vaiLiscio() );
513 else if ( vaiPunti() );
514 else if ( vaiTaglio() );
515 else if ( vaiBriscolaAlta() );
516 else if ( vaiCarico() );
517 } else if ( haMessoAsso() ) {
518 if ( vaiLiscioConCarichiInGioco() );
519 else if ( vaiPuntiConCarichiInGioco() );
520 else if ( vaiLiscio() );
521 else if ( vaiPunti() );
522 else if ( vaiTaglio() );
523 else if ( vaiBriscolaAlta() );
524 else if ( vaiCarico() );
525 else if ( vaiTre() );
526 } else if ( haCaricato() ) {
527 if ( vaiSopra() );
528 else if ( piuAltaInGioco() == ASSO && luiHaLaBriscolaPiuAltaInGioco() && hoTre() )
529 vaiTre();
530 else if ( vaiTaglio() );
531 else if ( vaiBriscolaAlta() );
532 else if ( piuAltaInGioco() == ASSO && !luiHaLaSecondaBriscolaPiuAltaInGioco() && hoAsso() )
533 vaiAsso();
534 else if ( vaiTre() );
535 else if ( vaiAsso() );
536 else if ( vaiLiscioConCarichiInGioco() );
537 else if ( vaiPuntiConCarichiInGioco() );
538 else if ( vaiLiscio() );
539 else if ( vaiPunti() );
540 else if ( vaiCarico() );
541 }
542 }
543
544 } else if ( mano == 18 ) {
545
546 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
547 if ( !haGiocato() ) {
548 if ( hoLaBriscolaPiuAltaInGioco() )
549 vaiBriscolaPiuAltaInGioco();
550 else
551 if ( hoLaSecondaBriscolaPiuAltaInGioco() )
552 vaiNon( secondaPiuAltaInGioco(), semeBriscola );
553 else
554 if ( luiHaTutteBriscole() )
555 vaiPrima();
556 else if ( vaiTaglio() );
557 else if ( vaiBriscolaAlta() );
558 else if ( vaiLiscioConCarichiPassati() );
559 else if ( vaiPuntiConCarichiPassati() );
560 else if ( vaiLiscio() );
561 else if ( vaiPunti() );
562 else if ( vaiCarico() );
563 else if ( vaiTre() );
564 }
565
566 /* Valuta cosa fare quando invece il giocatore ha giocato */
567 else {
568 if ( haLisciato() ) {
569 if ( luiHaLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
570 vaiSecondaBriscolaPiuAltaInGioco();
571 else if ( vaiSopra() );
572 else if ( vaiLiscioConCarichiInGioco() );
573 else if ( vaiPuntiConCarichiInGioco() );
574 else if ( vaiLiscio() );
575 else if ( vaiPunti() );
576 else if ( vaiTaglio() );
577 else if ( vaiTre() );
578 else if ( vaiBriscolaAlta() );
579 else if ( vaiCarico() );
580 else if ( vaiAsso() );
581 } else if ( haMessoPunti() ) {
582 if ( luiHaLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
583 vaiSecondaBriscolaPiuAltaInGioco();
584 else if ( vaiSopra() );
585 else if ( vaiLiscioConCarichiInGioco() );
586 else if ( vaiLiscio() );
587 else if ( vaiTaglio() );
588 else if ( vaiPuntiConCarichiInGioco() );
589 else if ( vaiPunti() );
590 else if ( vaiTre() );
591 else if ( vaiBriscolaAlta() );
592 else if ( vaiCarico() );
593 else if ( vaiAsso() );
594 } else if ( haTagliato() ) {
595 if ( luiHaLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
596 vaiSecondaBriscolaPiuAltaInGioco();
597 else if ( vaiLiscioConCarichiInGioco() );
598 else if ( vaiPuntiConCarichiInGioco() );
599 else if ( vaiLiscio() );
600 else if ( vaiPunti() );
601 else if ( vaiTaglio() );
602 else if ( vaiTre() );
603 else if ( vaiBriscolaAlta() );
604 else if ( vaiCarico() );
605 else if ( vaiAsso() );
606 } else if ( haMessoBriscolaAlta() ) {
607 if ( luiHaLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
608 vaiSecondaBriscolaPiuAltaInGioco();
609 else if ( vaiLiscioConCarichiInGioco() );
610 else if ( vaiPuntiConCarichiInGioco() );
611 else if ( vaiLiscio() );
612 else if ( vaiPunti() );
613 else if ( vaiTre() );
614 else if ( vaiTaglio() );
615 else if ( vaiSopra() );
616 else if ( vaiBriscolaAlta() );
617 else if ( vaiAsso() );
618 else if ( vaiCarico() );
619 } else if ( haMessoTre() ) {
620 if ( vaiAsso() );
621 else if ( vaiLiscioConCarichiInGioco() );
622 else if ( vaiPuntiConCarichiInGioco() );
623 else if ( vaiLiscio() );
624 else if ( vaiPunti() );
625 else if ( vaiTaglio() );
626 else if ( vaiBriscolaAlta() );
627 else if ( vaiCarico() );
628 } else if ( haMessoAsso() ) {
629 if ( vaiLiscioConCarichiInGioco() );
630 else if ( vaiPuntiConCarichiInGioco() );
631 else if ( vaiLiscio() );
632 else if ( vaiPunti() );
633 else if ( vaiTaglio() );
634 else if ( vaiBriscolaAlta() );
635 else if ( vaiCarico() );
636 else if ( vaiTre() );
637 } else if ( haCaricato() ) {
638 if ( vaiSopra() );
639 else if ( luiHaLaBriscolaPiuAltaInGioco() && hoLaSecondaBriscolaPiuAltaInGioco() )
640 vaiSecondaBriscolaPiuAltaInGioco();
641 else if ( vaiTre() );
642 else if ( vaiBriscolaAlta() );
643 else if ( vaiAsso() );
644 else if ( vaiTaglio() );
645 else if ( vaiLiscioConCarichiInGioco() );
646 else if ( vaiPuntiConCarichiInGioco() );
647 else if ( vaiLiscio() );
648 else if ( vaiPunti() );
649 else if ( vaiCarico() );
650 }
651 }
652
653 /* All'ultima mano è inutile ragionare, dato che ha una sola carta */
654 } else vaiPrima();
655
656 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
657 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
658 frame.carteCPU[cartaDaGiocare] = null;
659 frame.pannello.repaint();
660
661 CPUHaGiocato = true;
662
663 if ( !haGiocato() )
664 toccaAllaCPU = false;
665 }
666
667 /* Fa giocare una partita ai 30. È analogo al metodo precedente, cambia
668 * solo la tecnica di gioco, quindi non è commentato. */
669 public void giocaCPUAiTrenta() {
670
671 if ( punteggio <= 20 ) {
672
673 if ( !haGiocato() ) {
674 if ( vaiPuntiConCarichiPassati() );
675 else if ( vaiPunti() );
676 else if ( vaiLiscioConCarichiPassati() );
677 else if ( vaiLiscio() );
678 else if ( vaiTaglio() );
679 else if ( vaiBriscolaAlta() );
680 else if ( vaiCarico() );
681 else if ( vaiTre() );
682 else if ( vaiAsso() );
683 else;
684 }
685
686 /* Valuta cosa fare quando invece il giocatore ha giocato */
687 else {
688 if ( haLisciato() ) {
689 if ( vaiSopra() );
690 else if ( vaiLiscioConCarichiInGioco() );
691 else if ( vaiLiscio() );
692 else if ( vaiTre() );
693 else if ( vaiBriscolaAlta() );
694 else if ( vaiTaglio() );
695 else if ( vaiPuntiConCarichiInGioco() );
696 else if ( vaiPunti() );
697 else if ( vaiAsso() );
698 else if ( vaiCarico() );
699 } else if ( haMessoPunti() ) {
700 if ( vaiSopra() );
701 else if ( vaiTre() );
702 else if ( vaiBriscolaAlta() );
703 else if ( vaiTaglio() );
704 else if ( vaiLiscioConCarichiInGioco() );
705 else if ( vaiLiscio() );
706 else if ( vaiPuntiConCarichiInGioco() );
707 else if ( vaiPunti() );
708 else if ( vaiAsso() );
709 else if ( vaiCarico() );
710 } else if ( haTagliato() ) {
711 if ( vaiLiscioConCarichiInGioco() );
712 else if ( vaiLiscio() );
713 else if ( vaiPuntiConCarichiInGioco() );
714 else if ( vaiPunti() );
715 else if ( vaiTaglio() );
716 else if ( vaiTre() );
717 else if ( vaiBriscolaAlta() );
718 else if ( vaiAsso() );
719 else if ( vaiCarico() );
720 } else if ( haMessoBriscolaAlta() ) {
721 if ( vaiLiscioConCarichiInGioco() );
722 else if ( vaiLiscio() );
723 else if ( vaiPuntiConCarichiInGioco() );
724 else if ( vaiPunti() );
725 else if ( vaiTre() );
726 else if ( vaiTaglio() );
727 else if ( vaiBriscolaAlta() );
728 else if ( vaiAsso() );
729 else if ( vaiCarico() );
730 } else if ( haMessoTre() ) {
731 if ( vaiAsso() );
732 else if ( vaiLiscioConCarichiInGioco() );
733 else if ( vaiLiscio() );
734 else if ( vaiPuntiConCarichiInGioco() );
735 else if ( vaiPunti() );
736 else if ( vaiTaglio() );
737 else if ( vaiBriscolaAlta() );
738 else if ( vaiCarico() );
739 } else if ( haMessoAsso() ) {
740 if ( vaiLiscioConCarichiInGioco() );
741 else if ( vaiLiscio() );
742 else if ( vaiPuntiConCarichiInGioco() );
743 else if ( vaiPunti() );
744 else if ( vaiTaglio() );
745 else if ( vaiBriscolaAlta() );
746 else if ( vaiCarico() );
747 else if ( vaiTre() );
748 } else if ( haCaricato() ) {
749 if ( vaiSopra() );
750 else if ( vaiTre() );
751 else if ( vaiBriscolaAlta() );
752 else if ( vaiTaglio() );
753 else if ( vaiAsso() );
754 else if ( vaiLiscioConCarichiInGioco() );
755 else if ( vaiLiscio() );
756 else if ( vaiPuntiConCarichiInGioco() );
757 else if ( vaiPunti() );
758 else if ( vaiCarico() );
759 }
760 }
761 }
762
763 else {
764
765 if ( !haGiocato() ) {
766 if ( vaiLiscioConCarichiPassati() );
767 else if ( vaiLiscio() );
768 else if ( vaiPuntiConCarichiPassati() );
769 else if ( vaiPunti() );
770 else if ( vaiTaglio() );
771 else if ( vaiBriscolaAlta() );
772 else if ( vaiCarico() );
773 else if ( vaiTre() );
774 else if ( vaiAsso() );
775 else;
776 }
777
778 /* Valuta cosa fare quando invece il giocatore ha giocato */
779 else {
780 if ( haLisciato() ) {
781 if ( vaiSopra() );
782 else if ( vaiLiscioConCarichiInGioco() );
783 else if ( vaiLiscio() );
784 else if ( vaiTre() );
785 else if ( vaiBriscolaAlta() );
786 else if ( vaiTaglio() );
787 else if ( vaiAsso() );
788 else if ( vaiPuntiConCarichiInGioco() );
789 else if ( vaiPunti() );
790 else if ( vaiCarico() );
791 } else if ( haMessoPunti() ) {
792 if ( vaiSopra() );
793 else if ( vaiTre() );
794 else if ( vaiBriscolaAlta() );
795 else if ( vaiTaglio() );
796 else if ( vaiAsso() );
797 else if ( vaiLiscioConCarichiInGioco() );
798 else if ( vaiLiscio() );
799 else if ( vaiPuntiConCarichiInGioco() );
800 else if ( vaiPunti() );
801 else if ( vaiCarico() );
802 } else if ( haTagliato() ) {
803 if ( vaiLiscioConCarichiInGioco() );
804 else if ( vaiLiscio() );
805 else if ( vaiTaglio() );
806 else if ( vaiTre() );
807 else if ( vaiBriscolaAlta() );
808 else if ( vaiAsso() );
809 else if ( vaiPuntiConCarichiInGioco() );
810 else if ( vaiPunti() );
811 else if ( vaiCarico() );
812 } else if ( haMessoBriscolaAlta() ) {
813 if ( vaiLiscioConCarichiInGioco() );
814 else if ( vaiLiscio() );
815 else if ( vaiTre() );
816 else if ( vaiTaglio() );
817 else if ( vaiAsso() );
818 else if ( vaiBriscolaAlta() );
819 else if ( vaiPuntiConCarichiInGioco() );
820 else if ( vaiPunti() );
821 else if ( vaiCarico() );
822 } else if ( haMessoTre() ) {
823 if ( vaiAsso() );
824 else if ( vaiLiscioConCarichiInGioco() );
825 else if ( vaiLiscio() );
826 else if ( vaiPuntiConCarichiInGioco() );
827 else if ( vaiPunti() );
828 else if ( vaiTaglio() );
829 else if ( vaiBriscolaAlta() );
830 else if ( vaiCarico() );
831 } else if ( haMessoAsso() ) {
832 if ( vaiLiscioConCarichiInGioco() );
833 else if ( vaiLiscio() );
834 else if ( vaiTaglio() );
835 else if ( vaiPuntiConCarichiInGioco() );
836 else if ( vaiPunti() );
837 else if ( vaiBriscolaAlta() );
838 else if ( vaiCarico() );
839 else if ( vaiTre() );
840 } else if ( haCaricato() ) {
841 if ( vaiSopra() );
842 else if ( vaiTre() );
843 else if ( vaiBriscolaAlta() );
844 else if ( vaiTaglio() );
845 else if ( vaiAsso() );
846 else if ( vaiLiscioConCarichiInGioco() );
847 else if ( vaiLiscio() );
848 else if ( vaiPuntiConCarichiInGioco() );
849 else if ( vaiPunti() );
850 else if ( vaiCarico() );
851 }
852 }
853 }
854
855 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
856 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
857 frame.carteCPU[cartaDaGiocare] = null;
858 frame.pannello.repaint();
859
860 CPUHaGiocato = true;
861
862 if ( !haGiocato() )
863 toccaAllaCPU = false;
864 }
865
866 /* Determina se ha preso la CPU o il giocatore*/
867 public void chiPrende() {
868
869 /* Chiama il metodo giocatorePrende( boolean giocatore ) con parametro
870 * true se ha preso il giocatore, false se ha preso la CPU */
871 giocatorePrende( ( (seme( frame.giocata[0] ) == semeBriscola) && (seme( frame.giocata[1] ) != semeBriscola) )
872 || ( (seme( frame.giocata[0] ) == seme( frame.giocata[1] )) && laPrimaEPiuAlta( valore( frame.giocata[0] ), valore( frame.giocata[1] )) )
873 || ( (seme( frame.giocata[1] ) != semeBriscola) && (seme( frame.giocata[0] ) != seme( frame.giocata[1] )) && haGiocatoPrima ) );
874 }
875
876 /* Confronta due carte per decidere quale ha più valore di presa.
877 * Restituisce true se è la prima, false se è la seconda */
878 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
879 int a, b;
880 switch ( prima ) {
881 case 0:
882 a = 10;
883 break;
884 case 1:
885 a = 12;
886 break;
887 case 3:
888 a = 11;
889 break;
890 default:
891 a = prima;
892 break;
893 }
894 switch ( seconda ) {
895 case 0:
896 b = 10;
897 break;
898 case 1:
899 b = 12;
900 break;
901 case 3:
902 b = 11;
903 break;
904 default:
905 b = seconda;
906 break;
907 }
908 return a > b;
909 }
910
911 /* Viene chiamato con parametro true se ha preso il giocatore, false se
912 * ha preso la CPU */
913 public void giocatorePrende( boolean giocatore ) {
914 if ( giocatore ) {
915 toccaAllaCPU = CPUHaGiocato = false;
916 haGiocatoPrima = true;
917 }
918 else {
919 toccaAllaCPU = true;
920 CPUHaGiocato = haGiocatoPrima = false;
921 }
922 daiPunti( giocatore );
923 }
924
925 /* Da i punti (true al giocatore, false alla CPU) e fa pescare le carte*/
926 public void daiPunti( boolean giocatore ) {
927
928 int punti = 0;
929
930 switch( valore( frame.giocata[0] ) ) {
931 case 0:
932 punti += 4;
933 break;
934 case 1:
935 punti += 11;
936 break;
937 case 3:
938 punti += 10;
939 break;
940 case 8:
941 punti += 2;
942 break;
943 case 9:
944 punti += 3;
945 break;
946 default:
947 break;
948 }
949 switch( valore( frame.giocata[1] ) ) {
950 case 0:
951 punti += 4;
952 break;
953 case 1:
954 punti += 11;
955 break;
956 case 3:
957 punti += 10;
958 break;
959 case 8:
960 punti += 2;
961 break;
962 case 9:
963 punti += 3;
964 break;
965 default:
966 break;
967 }
968
969 frame.giocata[0] = frame.giocata[1] = null;
970
971 if ( giocatore ) {
972 punteggio += punti;
973 if ( mano < 18 ) {
974 if ( frame.carteInMano[0] == null )
975 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
976 if ( frame.carteInMano[1] == null )
977 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
978 if ( frame.carteInMano[2] == null )
979 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
980 cartaDaPescare++;
981 if ( frame.carteCPU[0] == null )
982 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
983 if ( frame.carteCPU[1] == null )
984 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
985 if ( frame.carteCPU[2] == null )
986 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
987 cartaDaPescare++;
988 }
989 }
990
991 else {
992 punteggioCPU += punti;
993 if ( mano < 18 ) {
994 if ( frame.carteCPU[0] == null )
995 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
996 if ( frame.carteCPU[1] == null )
997 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
998 if ( frame.carteCPU[2] == null )
999 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
1000 cartaDaPescare++;
1001 if ( frame.carteInMano[0] == null )
1002 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
1003 if ( frame.carteInMano[1] == null )
1004 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
1005 if ( frame.carteInMano[2] == null )
1006 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
1007 cartaDaPescare++;
1008 }
1009 }
1010
1011 /* Aggiorna la finestra */
1012 frame.pannello.repaint();
1013 frame.repaint();
1014 }
1015
1016 /* Ritorna true se il giocatore ha giocato */
1017 public boolean haGiocato() {
1018 return frame.giocata[0] != null;
1019 }
1020
1021 /* Vari metodi che determinano che tipo di carta ha giocato il giocatore.*/
1022 public boolean haLisciato() {
1023 return ( (haGiocato()) && (seme( frame.giocata[0] ) != semeBriscola) &&
1024 (valore( frame.giocata[0] ) != RE ) && (valore( frame.giocata[0] ) != ASSO ) &&
1025 (valore( frame.giocata[0] ) != TRE ) && (valore( frame.giocata[0] ) < FANTE ) );
1026 }
1027
1028 public boolean haMessoPunti() {
1029 return ( (haGiocato()) && (seme( frame.giocata[0] ) != semeBriscola) &&
1030 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
1031 (valore( frame.giocata[0] ) == CAVALLO ) ) );
1032 }
1033
1034 public boolean haTagliato() {
1035 return ( (haGiocato()) && (seme( frame.giocata[0] ) == semeBriscola) &&
1036 (valore( frame.giocata[0] ) == RE) && (valore( frame.giocata[0] ) != ASSO) &&
1037 (valore( frame.giocata[0] ) == TRE) && (valore( frame.giocata[0] ) <= SETTE) );
1038 }
1039
1040 public boolean haMessoBriscolaAlta() {
1041 return ( (haGiocato()) && (seme( frame.giocata[0] ) == semeBriscola) &&
1042 ( (valore( frame.giocata[0] ) == RE ) || (valore( frame.giocata[0] ) == FANTE ) ||
1043 (valore( frame.giocata[0] ) == CAVALLO ) ) );
1044 }
1045
1046 public boolean haMessoTre() {
1047 return ( (haGiocato()) && (seme( frame.giocata[0] ) == semeBriscola) &&
1048 (valore( frame.giocata[0] ) == TRE) );
1049 }
1050
1051 public boolean haMessoAsso() {
1052 return ( (haGiocato()) && (seme( frame.giocata[0] ) == semeBriscola) &&
1053 (valore( frame.giocata[0] ) == ASSO) );
1054 }
1055
1056 public boolean haCaricato() {
1057 return ( (haGiocato()) && (seme( frame.giocata[0] ) != semeBriscola) &&
1058 ( (valore( frame.giocata[0] ) == ASSO) || (valore( frame.giocata[0] ) == TRE) ) );
1059 }
1060
1061 /* I metodi seguenti cercano di andare liscio - dare punti - mettere
1062 * un taglio - ecc... e restituiscono true se hanno avuto successo,
1063 * false altrimenti. Le varianti -ConCarichiPassati e -ConCarichiInGioco
1064 * cercano, rispettivamente, di giocare un seme i cui carichi siano già
1065 * passati o ancora in gioco.*/
1066 public boolean vaiLiscio() {
1067 for ( int i = 0; i < 3; i++ ) {
1068 if ( frame.carteCPU[i] != null ) {
1069 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1070 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1071 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
1072 cartaDaGiocare = i;
1073 return true;
1074 }
1075 }
1076 }
1077
1078 return false;
1079 }
1080
1081 public boolean vaiLiscioConCarichiPassati() {
1082 for ( int i = 0; i < 3; i++ ) {
1083 if ( frame.carteCPU[i] != null ) {
1084 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1085 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1086 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1087 && sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1088 cartaDaGiocare = i;
1089 return true;
1090 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1091 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1092 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1093 && ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1094 cartaDaGiocare = i;
1095 return true;
1096 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1097 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1098 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1099 && ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1100 cartaDaGiocare = i;
1101 return true;
1102 }
1103 }
1104 }
1105
1106 return false;
1107 }
1108
1109 public boolean vaiLiscioConCarichiInGioco() {
1110 for ( int i = 0; i < 3; i++ ) {
1111 if ( frame.carteCPU[i] != null ) {
1112 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1113 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1114 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1115 && !sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1116 cartaDaGiocare = i;
1117 return true;
1118 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1119 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1120 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1121 && !ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1122 cartaDaGiocare = i;
1123 return true;
1124 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1125 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1126 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE)
1127 && !ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1128 cartaDaGiocare = i;
1129 return true;
1130 }
1131 }
1132 }
1133
1134 return false;
1135 }
1136
1137 public boolean vaiPunti() {
1138 /* Cerca di dare punti, cercando di darne il meno possibile (meglio
1139 * un fante di re). */
1140 for ( int i = 0; i < 3; i++ ) {
1141 if ( frame.carteCPU[i] != null ) {
1142 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE ) ) {
1143 cartaDaGiocare = i;
1144 return true;
1145 }
1146 }
1147 }
1148
1149 for ( int i = 0; i < 3; i++ ) {
1150 if ( frame.carteCPU[i] != null ) {
1151 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO ) ) {
1152 cartaDaGiocare = i;
1153 return true;
1154 }
1155 }
1156 }
1157
1158 for ( int i = 0; i < 3; i++ ) {
1159 if ( frame.carteCPU[i] != null ) {
1160 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE ) ) {
1161 cartaDaGiocare = i;
1162 return true;
1163 }
1164 }
1165 }
1166
1167 return false;
1168 }
1169
1170 public boolean vaiPuntiConCarichiPassati() {
1171 for ( int i = 0; i < 3; i++ ) {
1172 if ( frame.carteCPU[i] != null ) {
1173 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1174 && sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1175 cartaDaGiocare = i;
1176 return true;
1177 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1178 && ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1179 cartaDaGiocare = i;
1180 return true;
1181 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1182 && ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1183 cartaDaGiocare = i;
1184 return true;
1185 }
1186 }
1187 }
1188 for ( int i = 0; i < 3; i++ ) {
1189 if ( frame.carteCPU[i] != null ) {
1190 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1191 && sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1192 cartaDaGiocare = i;
1193 return true;
1194 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1195 && ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1196 cartaDaGiocare = i;
1197 return true;
1198 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1199 && ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1200 cartaDaGiocare = i;
1201 return true;
1202 }
1203 }
1204 }
1205 for ( int i = 0; i < 3; i++ ) {
1206 if ( frame.carteCPU[i] != null ) {
1207 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1208 && sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1209 cartaDaGiocare = i;
1210 return true;
1211 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1212 && ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1213 cartaDaGiocare = i;
1214 return true;
1215 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1216 && ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1217 cartaDaGiocare = i;
1218 return true;
1219 }
1220 }
1221 }
1222
1223 return false;
1224 }
1225
1226 public boolean vaiPuntiConCarichiInGioco() {
1227 for ( int i = 0; i < 3; i++ ) {
1228 if ( frame.carteCPU[i] != null ) {
1229 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1230 && !sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1231 cartaDaGiocare = i;
1232 return true;
1233 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1234 && !ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1235 cartaDaGiocare = i;
1236 return true;
1237 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE )
1238 && !ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1239 cartaDaGiocare = i;
1240 return true;
1241 }
1242 }
1243 }
1244 for ( int i = 0; i < 3; i++ ) {
1245 if ( frame.carteCPU[i] != null ) {
1246 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1247 && !sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1248 cartaDaGiocare = i;
1249 return true;
1250 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1251 && !ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1252 cartaDaGiocare = i;
1253 return true;
1254 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO )
1255 && !ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1256 cartaDaGiocare = i;
1257 return true;
1258 }
1259 }
1260 }
1261 for ( int i = 0; i < 3; i++ ) {
1262 if ( frame.carteCPU[i] != null ) {
1263 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1264 && !sonoPassatiICarichi( seme( frame.carteCPU[i] ) ) ) {
1265 cartaDaGiocare = i;
1266 return true;
1267 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1268 && !ePassato( ASSO, seme( frame.carteCPU[i] ) ) ) {
1269 cartaDaGiocare = i;
1270 return true;
1271 } else if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == RE )
1272 && !ePassato( TRE, seme( frame.carteCPU[i] ) ) ) {
1273 cartaDaGiocare = i;
1274 return true;
1275 }
1276 }
1277 }
1278
1279 return false;
1280 }
1281
1282 public boolean vaiTaglio() {
1283 for ( int i = 0; i < 3; i++ ) {
1284 if ( frame.carteCPU[i] != null ) {
1285 if ( seme( frame.carteCPU[i] ) == semeBriscola &&
1286 (valore( frame.carteCPU[i] ) != RE) && (valore( frame.carteCPU[i] ) != ASSO) &&
1287 (valore( frame.carteCPU[i] ) != TRE) && (valore( frame.carteCPU[i] ) < FANTE) ) {
1288 cartaDaGiocare = i;
1289 return true;
1290 }
1291 }
1292 }
1293
1294 return false;
1295 }
1296 public boolean vaiBriscolaAlta() {
1297 for ( int i = 0; i < 3; i++ ) {
1298 if ( frame.carteCPU[i] != null ) {
1299 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == FANTE) ) {
1300 cartaDaGiocare = i;
1301 return true;
1302 }
1303 }
1304 }
1305
1306 for ( int i = 0; i < 3; i++ ) {
1307 if ( frame.carteCPU[i] != null ) {
1308 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == CAVALLO) ) {
1309 cartaDaGiocare = i;
1310 return true;
1311 }
1312 }
1313 }
1314
1315 for ( int i = 0; i < 3; i++ ) {
1316 if ( frame.carteCPU[i] != null ) {
1317 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == RE) ) {
1318 cartaDaGiocare = i;
1319 return true;
1320 }
1321 }
1322 }
1323
1324 return false;
1325 }
1326 public boolean vaiTre() {
1327 for ( int i = 0; i < 3; i++ ) {
1328 if ( frame.carteCPU[i] != null ) {
1329 if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == TRE) ) {
1330 cartaDaGiocare = i;
1331 return true;
1332 }
1333 }
1334 }
1335
1336 return false;
1337 }
1338 public boolean vaiAsso() {
1339 for ( int i = 0; i < 3; i++ ) {
1340 if ( frame.carteCPU[i] != null ) {
1341 if ( seme( frame.carteCPU[i] ) == semeBriscola && (valore( frame.carteCPU[i] ) == ASSO) ) {
1342 cartaDaGiocare = i;
1343 return true;
1344 }
1345 }
1346 }
1347
1348 return false;
1349 }
1350 public boolean vaiCarico() {
1351
1352 for ( int i = 0; i < 3; i++ ) {
1353 if ( frame.carteCPU[i] != null ) {
1354 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO) ) {
1355 cartaDaGiocare = i;
1356 return true;
1357 }
1358 }
1359 }
1360
1361 for ( int i = 0; i < 3; i++ ) {
1362 if ( frame.carteCPU[i] != null ) {
1363 if ( (seme( frame.carteCPU[i] ) != semeBriscola) && (valore( frame.carteCPU[i] ) == TRE) ) {
1364 cartaDaGiocare = i;
1365 return true;
1366 }
1367 }
1368 }
1369
1370 return false;
1371 }
1372
1373 /* Gioca una carta diversa da quella passata come parametro */
1374 public boolean vaiNon( int valore, int seme ) {
1375 for ( int i = 0; i < 3; i++ ) {
1376 if ( frame.carteCPU[i] != null ) {
1377 if ( seme( frame.carteCPU[i] ) != seme && valore( frame.carteCPU[i] ) != valore ) {
1378 cartaDaGiocare = i;
1379 return true;
1380 }
1381 }
1382 }
1383
1384 return false;
1385 }
1386
1387 /* Gioca la prima carta che trova */
1388 public boolean vaiPrima() {
1389 for ( int i = 0; i < 3; i++ ) {
1390 if ( frame.carteCPU[i] != null ) {
1391 cartaDaGiocare = i;
1392 return true;
1393 }
1394 }
1395
1396 return false;
1397 }
1398
1399 /* Metodi per l'ultima mano */
1400 public boolean vaiBriscolaPiuAltaInGioco() {
1401 for ( int i = 0; i < 3; i++ ) {
1402 if ( frame.carteCPU[i] != null ) {
1403 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == piuAltaInGioco()) ) {
1404 cartaDaGiocare = i;
1405 return true;
1406 }
1407 }
1408 }
1409
1410 return false;
1411 }
1412
1413 public boolean vaiSecondaBriscolaPiuAltaInGioco() {
1414 for ( int i = 0; i < 3; i++ ) {
1415 if ( frame.carteCPU[i] != null ) {
1416 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == secondaPiuAltaInGioco()) ) {
1417 cartaDaGiocare = i;
1418 return true;
1419 }
1420 }
1421 }
1422
1423 return false;
1424 }
1425
1426 public boolean vaiSopra() {
1427 /* Innanzitutto controlla se il giocatore ha giocato (non dovrebbe
1428 * essere possibile, in quanto quando questo metodo viene chiamato
1429 * tale condizione è già stata verificata, ma è sempre meglio un
1430 * controllo in più che uno in meno) e restituisce false in caso
1431 * contrario */
1432 if ( !haGiocato() )
1433 return false;
1434
1435 /* Tre variabili intere che serviranno a valutare quali delle tre
1436 * carte è meglio giocare, se più di una può andare sopra. */
1437 int a = -1;
1438 int b = -1;
1439 int c = -1;
1440
1441 /* Tre booleane che verificano quali delle tre carte possono
1442 * andare sopra. */
1443 boolean laPrimaPuoAndareSopra = false;
1444 boolean laSecondaPuoAndareSopra = false;
1445 boolean laTerzaPuoAndareSopra = false;
1446
1447 /* Se il giocatore ha giocato un asso, restituisce direttamente false. */
1448 if ( valore( frame.giocata[0] ) == ASSO )
1449 return false;
1450
1451 /* Valuta quali delle tre carte possono andare sopra, dopo essersi
1452 * accertato di averle: nelle ultime mani non si hanno tutte le carte
1453 * in mano, e noi non vogliamo una NullPointerException sul più bello
1454 * di una partita, vero?! */
1455 if ( frame.carteCPU[0] != null ) {
1456 a = valore( frame.carteCPU[0] );
1457 if ( (seme( frame.carteCPU[0] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( a, valore( frame.giocata[0] ) ) )
1458 laPrimaPuoAndareSopra = true;
1459 }
1460
1461 if ( frame.carteCPU[1] != null ) {
1462 b = valore( frame.carteCPU[1] );
1463 if ( (seme( frame.carteCPU[1] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( b, valore( frame.giocata[0] ) ) )
1464 laSecondaPuoAndareSopra = true;
1465 }
1466
1467 if ( frame.carteCPU[2] != null ) {
1468 c = valore( frame.carteCPU[2] );
1469 if ( (seme( frame.carteCPU[2] ) == seme( frame.giocata[0] )) && laPrimaEPiuAlta( c, valore( frame.giocata[0] ) ) )
1470 laTerzaPuoAndareSopra = true;
1471 }
1472
1473 /* Se nessuna carta può andare sopra, restituisce false. Se una
1474 * sola delle tre può andare sopra la imposta come carta da giocare. */
1475 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1476 return false;
1477 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1478 cartaDaGiocare = 0;
1479 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1480 cartaDaGiocare = 1;
1481 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1482 cartaDaGiocare = 2;
1483
1484 /* Se più di una carta può andare sopra, valuta quale è più alta. */
1485 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1486 if ( laPrimaEPiuAlta( a, b ) )
1487 cartaDaGiocare = 0;
1488 else
1489 cartaDaGiocare = 1;
1490 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1491 if ( laPrimaEPiuAlta( b, c ) )
1492 cartaDaGiocare = 1;
1493 else
1494 cartaDaGiocare = 2;
1495 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1496 if ( laPrimaEPiuAlta( a, c ) )
1497 cartaDaGiocare = 0;
1498 else
1499 cartaDaGiocare = 2;
1500 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1501 if ( laPrimaEPiuAlta( a, b ) )
1502 if ( laPrimaEPiuAlta( a, c ) )
1503 cartaDaGiocare = 0;
1504 else
1505 cartaDaGiocare = 2;
1506 else
1507 if ( laPrimaEPiuAlta( b, c ) )
1508 cartaDaGiocare = 1;
1509 else
1510 cartaDaGiocare = 2;
1511
1512 /* Controlla che la carta con cui sta cercando di andare sopra
1513 * sia una figura o un carico. Non vogliamo mica prendere delle
1514 * scartelle con delle scartelle, giusto?! */
1515 if ( ( valore( frame.carteCPU[cartaDaGiocare] ) != RE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) != ASSO ) &&
1516 ( valore( frame.carteCPU[cartaDaGiocare] ) != TRE ) && ( valore( frame.carteCPU[cartaDaGiocare] ) <= SETTE ) )
1517 return false;
1518
1519 return true;
1520 }
1521
1522 /* I metodi seguenti valutano le carte che la CPU ha in mano. */
1523 public boolean hoCarico() {
1524 for ( int i = 0; i < 3; i++ ) {
1525 if ( frame.carteCPU[i] != null ) {
1526 if ( (seme( frame.carteCPU[i] ) != semeBriscola) &&
1527 ( ( valore( frame.carteCPU[i] ) == ASSO ) || ( valore( frame.carteCPU[i] ) == TRE ) ) ) {
1528 return true;
1529 }
1530 }
1531 }
1532
1533 return false;
1534 }
1535 public boolean hoAsso() {
1536 for ( int i = 0; i < 3; i++ ) {
1537 if ( frame.carteCPU[i] != null ) {
1538 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == ASSO ) ) {
1539 return true;
1540 }
1541 }
1542 }
1543
1544 return false;
1545 }
1546 public boolean hoTre() {
1547 for ( int i = 0; i < 3; i++ ) {
1548 if ( frame.carteCPU[i] != null ) {
1549 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == TRE ) ) {
1550 return true;
1551 }
1552 }
1553 }
1554
1555 return false;
1556 }
1557 public boolean hoBriscolaAlta() {
1558 for ( int i = 0; i < 3; i++ ) {
1559 if ( frame.carteCPU[i] != null ) {
1560 if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
1561 ( (valore( frame.carteCPU[i] ) == RE) || (valore( frame.carteCPU[i] ) == FANTE) || (valore( frame.carteCPU[i] ) == CAVALLO) ) ) {
1562 return true;
1563 }
1564 }
1565 }
1566
1567 return false;
1568 }
1569 public boolean hoTaglio() {
1570 for ( int i = 0; i < 3; i++ ) {
1571 if ( frame.carteCPU[i] != null ) {
1572 if ( (seme( frame.carteCPU[i] ) == semeBriscola) &&
1573 (valore( frame.carteCPU[i] ) < FANTE ) && (valore( frame.carteCPU[i] ) != TRE )
1574 && (valore( frame.carteCPU[i] ) != ASSO ) && (valore( frame.carteCPU[i] ) != RE ) ) {
1575 return true;
1576 }
1577 }
1578 }
1579
1580 return false;
1581 }
1582
1583 /* Metodi per l'ultima mano */
1584 public boolean hoLaBriscolaPiuAltaInGioco() {
1585 for ( int i = 0; i < 3; i++ ) {
1586 if ( frame.carteCPU[i] != null ) {
1587 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == piuAltaInGioco()) )
1588 return true;
1589 }
1590 }
1591
1592 return false;
1593 }
1594 public boolean hoLaSecondaBriscolaPiuAltaInGioco() {
1595 for ( int i = 0; i < 3; i++ ) {
1596 if ( frame.carteCPU[i] != null ) {
1597 if ( (seme( frame.carteCPU[i] ) == semeBriscola) && (valore( frame.carteCPU[i] ) == secondaPiuAltaInGioco()) )
1598 return true;
1599 }
1600 }
1601
1602 return false;
1603 }
1604 public boolean luiHaLaBriscolaPiuAltaInGioco() {
1605 for ( int i = 0; i < 3; i++ ) {
1606 if ( frame.carteInMano[i] != null ) {
1607 if ( (seme( frame.carteInMano[i] ) == semeBriscola) && (valore( frame.carteInMano[i] ) == piuAltaInGioco()) )
1608 return true;
1609 }
1610 }
1611
1612 return false;
1613 }
1614 public boolean luiHaLaSecondaBriscolaPiuAltaInGioco() {
1615 for ( int i = 0; i < 3; i++ ) {
1616 if ( frame.carteInMano[i] != null ) {
1617 if ( (seme( frame.carteInMano[i] ) == semeBriscola) && (valore( frame.carteInMano[i] ) == secondaPiuAltaInGioco()) )
1618 return true;
1619 }
1620 }
1621
1622 return false;
1623 }
1624 public boolean luiHaTutteBriscole() {
1625 if ( frame.carteInMano[0] != null && seme( frame.carteInMano[0] ) != semeBriscola ) return false;
1626 else if ( frame.carteInMano[1] != null && seme( frame.carteInMano[1] ) != semeBriscola ) return false;
1627 else if ( frame.carteInMano[2] != null && seme( frame.carteInMano[2] ) != semeBriscola ) return false;
1628 else return true;
1629 }
1630
1631 /* Restituisce il seme della carta passata come parametro */
1632 public static int seme( ImageIcon carta ) {
1633 char aux[] = carta.toString().toCharArray();
1634 return aux[aux.length-5] - 49;
1635 }
1636
1637 /* Restituisce il valore della carta */
1638 public static int valore( ImageIcon carta ) {
1639 char aux[] = carta.toString().toCharArray();
1640 return aux[aux.length-7] - 48;
1641 }
1642
1643 /* Controlla se una carta è già passata */
1644 public static boolean ePassato( int valore, int seme ) {
1645 for ( int i = 0; ; i++ ) {
1646 if ( frame.arrayCartePassate[i] == null ) {
1647 for ( int j = 0; j < 3; j++ )
1648 if ( frame.carteCPU[j] != null && valore( frame.carteCPU[j] ) == valore && seme( frame.carteCPU[j] ) == seme ) return true;
1649 return false;
1650 }
1651 else if ( valore( frame.arrayCartePassate[i] ) == valore && seme( frame.arrayCartePassate[i] ) == seme ) return true;
1652 }
1653 }
1654
1655 /* Controlla se sono passati i carichi di un determinato seme */
1656 public static boolean sonoPassatiICarichi( int seme ) {
1657 return ePassato( TRE, seme ) && ePassato( ASSO, seme );
1658 }
1659
1660 /* Restituisce il valore della briscola più alta in gioco*/
1661 public static int piuAltaInGioco() {
1662 if ( !ePassato( ASSO, semeBriscola ) ) return ASSO;
1663 else if ( !ePassato( TRE, semeBriscola ) ) return TRE;
1664 else if ( !ePassato( RE, semeBriscola ) ) return RE;
1665 else if ( !ePassato( CAVALLO, semeBriscola ) ) return CAVALLO;
1666 else if ( !ePassato( FANTE, semeBriscola ) ) return FANTE;
1667 else if ( !ePassato( SETTE, semeBriscola ) ) return SETTE;
1668 else if ( !ePassato( SEI, semeBriscola ) ) return SEI;
1669 else if ( !ePassato( CINQUE, semeBriscola ) ) return CINQUE;
1670 else if ( !ePassato( QUATTRO, semeBriscola ) ) return QUATTRO;
1671 else if ( !ePassato( DUE, semeBriscola ) ) return DUE;
1672 else return -1;
1673 }
1674
1675 /* Restituisce il valore della seconda briscola più alta in gioco*/
1676 public static int secondaPiuAltaInGioco() {
1677 if ( !ePassato( ASSO, semeBriscola ) && piuAltaInGioco() != ASSO ) return ASSO;
1678 else if ( !ePassato( TRE, semeBriscola ) && piuAltaInGioco() != TRE ) return TRE;
1679 else if ( !ePassato( RE, semeBriscola ) && piuAltaInGioco() != RE ) return RE;
1680 else if ( !ePassato( CAVALLO, semeBriscola ) && piuAltaInGioco() != CAVALLO ) return CAVALLO;
1681 else if ( !ePassato( FANTE, semeBriscola ) && piuAltaInGioco() != FANTE ) return FANTE;
1682 else if ( !ePassato( SETTE, semeBriscola ) && piuAltaInGioco() != SETTE ) return SETTE;
1683 else if ( !ePassato( SEI, semeBriscola ) && piuAltaInGioco() != SEI ) return SEI;
1684 else if ( !ePassato( CINQUE, semeBriscola ) && piuAltaInGioco() != CINQUE ) return CINQUE;
1685 else if ( !ePassato( QUATTRO, semeBriscola ) && piuAltaInGioco() != QUATTRO ) return QUATTRO;
1686 else if ( !ePassato( DUE, semeBriscola ) && piuAltaInGioco() != DUE ) return DUE;
1687 else return -1;
1688 }
1689
1690 /* I vari trucchi del gioco. */
1691 public static void trucco( String trucco ) {
1692
1693 byte[] truccoByte = trucco.getBytes();
1694 char[] truccoChar = new char[ truccoByte.length ];
1695 for ( int i = 0; i < truccoChar.length; i++ )
1696 truccoChar[i] = (char)truccoByte[i];
1697
1698 String attivato = stringaTruccoSbagliato;
1699
1700 /* Carta che vuoi dove vuoi. Esempio: x251 sostituisce
1701 * la terza carta (2) con il 6 (5) di coppe (1). */
1702 if ( truccoChar[0] == 'x' && truccoChar.length == 4 ) {
1703
1704 attivato = stringaTruccoAttivato;
1705
1706 String aS = "" + truccoChar[1];
1707 String xS = "" + truccoChar[2];
1708 String yS = "" + truccoChar[3];
1709
1710 int a, x, y;
1711
1712 try {
1713
1714 a = Integer.parseInt( aS );
1715 x = Integer.parseInt( xS );
1716 y = Integer.parseInt( yS );
1717
1718 frame.carteInMano[a] = frame.arrayCarte[x][y];
1719
1720 } catch ( Exception e ) {
1721 attivato = stringaTruccoSbagliato;
1722 }
1723 }
1724
1725 /* Mostra le carte del computer. */
1726 if ( trucco.equalsIgnoreCase( "Kill Devil Hill" ) ) {
1727
1728 attivato = stringaTruccoAttivato;
1729
1730 carteScoperte = true;
1731
1732 }
1733
1734 /* Scambia le carte con il computer. */
1735 if ( trucco.equalsIgnoreCase( "Darkside of Aquarius" ) ) {
1736
1737 attivato = stringaTruccoAttivato;
1738
1739 ImageIcon aux = null;
1740
1741 for ( int i = 0; i < 3; i++ ) {
1742
1743 aux = frame.carteInMano[i];
1744 frame.carteInMano[i] = frame.carteCPU[i];
1745 frame.carteCPU[i] = aux;
1746
1747 }
1748 }
1749
1750 /* Cambia il seme di briscola con uno a caso, senza dire quale.
1751 * L'ultima carta non cambia. È possibile comunque capire
1752 * qual'è la briscola dal menu ?->Briscola*/
1753 if ( trucco.equalsIgnoreCase( "Change of Heart" ) ) {
1754
1755 attivato = stringaTruccoAttivato;
1756
1757 semeBriscola = (int) ( Math.random() * 4 );
1758
1759 }
1760
1761 /* Asso Tre e Re di Briscola tutti in mano (anche in caso di doppioni). */
1762 if ( trucco.equalsIgnoreCase( "Tears of The Dragon" ) ) {
1763
1764 attivato = stringaTruccoAttivato;
1765
1766 frame.carteInMano[0] = frame.arrayCarte[9][semeBriscola];
1767 frame.carteInMano[1] = frame.arrayCarte[2][semeBriscola];
1768 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1769
1770 }
1771
1772 /* Tre assi di briscola. */
1773 if ( trucco.equalsIgnoreCase( "Navigate The Seas of The Sun" ) ) {
1774
1775 attivato = stringaTruccoAttivato;
1776
1777 frame.carteInMano[0] = frame.arrayCarte[0][semeBriscola];
1778 frame.carteInMano[1] = frame.arrayCarte[0][semeBriscola];
1779 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1780
1781 }
1782
1783 /* Fa finire la partita al prossimo piglio. */
1784 if ( trucco.equalsIgnoreCase( "Omega" ) ) {
1785
1786 attivato = stringaTruccoAttivato;
1787
1788 mano = 19;
1789
1790 }
1791
1792 JOptionPane.showMessageDialog( frame, attivato, "JBriscola - " + version, JOptionPane.INFORMATION_MESSAGE );
1793 frame.pannello.repaint();
1794 frame.repaint();
1795
1796 }
1797
1798 /* Imposta le opzioni dell'utente cercando di leggerle dal file di configurazione. */
1799 public static void settaOpzioni() {
1800
1801 /* Impostazioni predefinite. */
1802 lang = "it";
1803 soundString = "suono=si";
1804 keysString = "tasti=si";
1805 int r = 0;
1806 int g = 150;
1807 int b = 0;
1808
1809 /* Cerca di leggere il file per impostare le opzioni. */
1810 Scanner scanner = null;
1811 File file = new File( "JBriscolaConfig.txt" );
1812 if ( file.exists() ) {
1813 try {
1814 scanner = new Scanner( file );
1815 } catch ( FileNotFoundException e ) { }
1816 try {
1817 lang = scanner.next();
1818 soundString = scanner.next();
1819 keysString = scanner.next();
1820 r = scanner.nextInt();
1821 g = scanner.nextInt();
1822 b = scanner.nextInt();
1823 } catch ( NoSuchElementException e ) { }
1824 }
1825
1826 /* Modifica le opzioni. */
1827 if ( lang.equals( "it" ) ) {
1828 semi[0] = "Bastoni";
1829 semi[1] = "Coppe";
1830 semi[2] = "Denari";
1831 semi[3] = "Spade";
1832 stringaBriscola = "Briscola";
1833 stringaBottonePrendi = "Prendi/Lascia carte";
1834 stringaPrimaGioca = "Prima Gioca!";
1835 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
1836 stringaVinto = "Hai Vinto!";
1837 stringaPerso = "Hai Perso";
1838 stringaPareggio = "Pareggio";
1839 stringaGiocatore = "Giocatore: ";
1840 stringaComputer = "\nComputer: ";
1841 stringaNuovaPartita = "Nuova Partita";
1842 stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
1843 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
1844 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
1845 stringaSi = "Si";
1846 stringaNo = "No";
1847 stringaOpzioni = "Opzioni...";
1848 stringaEsci = "Esci";
1849 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
1850 stringaLingua = "Lingua";
1851 stringaAnnulla = "Annulla";
1852 stringaIt = "Italiano";
1853 stringaLa = "Latino";
1854 stringaBL = "Dialetto Bellunese";
1855 stringaBV = "Dialetto Basso Veneto";
1856 stringaEN = "Inglese";
1857 stringaModificaOpzioni = "Modifica Opzioni";
1858 stringaInformazioni = "Informazioni";
1859 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";
1860 stringaSuono = "Effetti sonori";
1861 stringaPunteggio = "Punteggio";
1862 stringaCartePassate = "Carte Passate";
1863 stringaSfondo = "Sfondo";
1864 stringaTasti = "Tasti rapidi";
1865 stringaAggiornamenti = "Cerca aggiornamenti";
1866 stringaTrucchi = "Trucchi";
1867 stringaInserisciCodice = "Inserisci il codice:";
1868 stringaTruccoAttivato = "Trucco attivato!";
1869 stringaTruccoSbagliato = "Trucco non valido";
1870 stringaCheCartaVuoi = "E allora che carta vuoi?";
1871 stringaAggiornamentiSi = "Aggiornamento disponibile: ";
1872 stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
1873 stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
1874 stringaNoInternet = "Errore: nessuna connessione internet";
1875 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 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
1876 }
1877 else if ( lang.equals( "la" ) ) {
1878 semi[0] = "BACULI";
1879 semi[1] = "CALICES";
1880 semi[2] = "DENARII";
1881 semi[3] = "GLADII";
1882 stringaBriscola = "BRISCOLA";
1883 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
1884 stringaPrimaGioca = "ANTE CHARTAM PONE!";
1885 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
1886 stringaVinto = "VICISTI!";
1887 stringaPerso = "PERDIDISTI";
1888 stringaPareggio = "AEQVATIO!";
1889 stringaGiocatore = "LVSOR: ";
1890 stringaComputer = "\nCOMPVTER: ";
1891 stringaNuovaPartita = "NOVA LVSO";
1892 stringaNuovaPartitaAiTrenta = "NOVA LVSO XXX";
1893 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
1894 stringaVuoiDavveroUscire = "EXIRE?";
1895 stringaSi = "ID VOLO";
1896 stringaNo = "NOLO";
1897 stringaOpzioni = "OPTIONES...";
1898 stringaEsci = "EXIRE";
1899 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
1900 stringaLingua = "LINGVA";
1901 stringaAnnulla = "ABROGA";
1902 stringaIt = "ITALICA";
1903 stringaLa = "LATINA";
1904 stringaBL = "BELLUNI";
1905 stringaBV = "VENETIAE";
1906 stringaEN = "ANGLICVS";
1907 stringaModificaOpzioni = "OPTIONES NOVARE";
1908 stringaInformazioni = "INFORMATIONES";
1909 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";
1910 stringaSuono = "SONVS";
1911 stringaPunteggio = "NVMERI";
1912 stringaCartePassate = "CHARTAS ITAS";
1913 stringaSfondo = "COLOR";
1914 stringaTasti = "TASTI RAPIDI";
1915 stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE";
1916 stringaTrucchi = "CODICES";
1917 stringaInserisciCodice = "CODICEM INSCRIBE:";
1918 stringaTruccoAttivato = "CODEX INCIPIVIT!";
1919 stringaTruccoSbagliato = "ERROR CODICIS";
1920 stringaCheCartaVuoi = "QUAM CHARTAM VOLIS?";
1921 stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST";
1922 stringaAggiornamentiSi = "VERSIO RECENTIOR EST: ";
1923 stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST";
1924 stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html";
1925 stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
1926 }
1927 if ( lang.equals( "bl" ) ) {
1928 semi[0] = "Bastoi";
1929 semi[1] = "Coppe";
1930 semi[2] = "Danari";
1931 semi[3] = "Spade";
1932 stringaBriscola = "Briscola";
1933 stringaBottonePrendi = "Cio' su/lasa le carte";
1934 stringaPrimaGioca = "Prima Duga!";
1935 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1936 stringaVinto = "Te ha vint!";
1937 stringaPerso = "Te ha pers";
1938 stringaPareggio = "Pari";
1939 stringaGiocatore = "Dugador: ";
1940 stringaComputer = "\nComputer: ";
1941 stringaNuovaPartita = "Taca n'altra partida";
1942 stringaNuovaPartitaAiTrenta = "Taca na partida ai 30";
1943 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1944 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1945 stringaSi = "Si";
1946 stringaNo = "No";
1947 stringaOpzioni = "Opzioni...";
1948 stringaEsci = "Stusa su";
1949 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1950 stringaLingua = "Lengua";
1951 stringaAnnulla = "Annulla";
1952 stringaIt = "Italian";
1953 stringaLa = "Latin";
1954 stringaBL = "Dialeto de Belun";
1955 stringaBV = "Dialeto de la basa";
1956 stringaEN = "Inglese";
1957 stringaModificaOpzioni = "Modifica Opzioni";
1958 stringaInformazioni = "Informazioni";
1959 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";
1960 stringaSuono = "Efeti sonori";
1961 stringaPunteggio = "Varda i punti";
1962 stringaCartePassate = "Carte pasade";
1963 stringaSfondo = "Sfondo";
1964 stringaTasti = "Tasti rapidi";
1965 stringaAggiornamenti = "Varda se ghe ne' na version pi nova";
1966 stringaTrucchi = "Truchi";
1967 stringaInserisciCodice = "Scrivi al codice:";
1968 stringaTruccoAttivato = "Truco ativa'!";
1969 stringaTruccoSbagliato = "Truco sbaia'";
1970 stringaCheCartaVuoi = "Che carta utu alora?";
1971 stringaAggiornamentiSi = "Ghe ne' na version pi nova: ";
1972 stringaAggiornamentiNo = "No ghe ne na version pi nova";
1973 stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1974 stringaNoInternet = "Erore: no te se su internet";
1975 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 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
1976 }
1977 if ( lang.equals( "bv" ) ) {
1978 semi[0] = "Bastoni";
1979 semi[1] = "Coppe";
1980 semi[2] = "Danari";
1981 semi[3] = "Spade";
1982 stringaBriscola = "Briscola";
1983 stringaBottonePrendi = "Ciapa su/lasa e carte";
1984 stringaPrimaGioca = "Prima Zuga!";
1985 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1986 stringaVinto = "Ti ga vinto!";
1987 stringaPerso = "Ti ga perso";
1988 stringaPareggio = "Pari";
1989 stringaGiocatore = "Zugador: ";
1990 stringaComputer = "\nComputer: ";
1991 stringaNuovaPartita = "N'altra Partida";
1992 stringaNuovaPartitaAiTrenta = "Na Partida ai 30";
1993 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1994 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1995 stringaSi = "Si";
1996 stringaNo = "No";
1997 stringaOpzioni = "Opzioni...";
1998 stringaEsci = "Stusa su";
1999 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
2000 stringaLingua = "Lengua";
2001 stringaAnnulla = "Annulla";
2002 stringaIt = "Italian";
2003 stringaLa = "Latin";
2004 stringaBL = "Dialeto Belumat";
2005 stringaBV = "Dialeto Veneto";
2006 stringaEN = "Inglese";
2007 stringaModificaOpzioni = "Modifica Opzioni";
2008 stringaInformazioni = "Informasioni";
2009 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";
2010 stringaSuono = "Efeti sonori";
2011 stringaPunteggio = "Varda i punti";
2012 stringaCartePassate = "Carte pasade";
2013 stringaSfondo = "Sfondo";
2014 stringaTasti = "Tasti rapidi";
2015 stringaAggiornamenti = "Varda se ghe xe na versione pi nova";
2016 stringaTrucchi = "Truchi";
2017 stringaInserisciCodice = "Scrivi al codice:";
2018 stringaTruccoAttivato = "Truco ativa'!";
2019 stringaTruccoSbagliato = "Truco sbaia'";
2020 stringaCheCartaVuoi = "Che carta utu alora?";
2021 stringaAggiornamentiSi = "Ghe xe na versione pi nova: ";
2022 stringaAggiornamentiNo = "No ghe xe na versione pi nova";
2023 stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
2024 stringaNoInternet = "Erore: no ti xe su internet";
2025 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 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
2026 }
2027 if ( lang.equals( "en" ) ) {
2028 semi[0] = "Sticks";
2029 semi[1] = "Cups";
2030 semi[2] = "Golds";
2031 semi[3] = "Swords";
2032 stringaBriscola = "Briscola";
2033 stringaBottonePrendi = "Take/leave cards";
2034 stringaPrimaGioca = "Play your card before!";
2035 stringaUltime4 = "Last card - keep your eye on the briscola!";
2036 stringaVinto = "You won!";
2037 stringaPerso = "You lost";
2038 stringaPareggio = "Sixty - sixty!";
2039 stringaGiocatore = "Palyer: ";
2040 stringaComputer = "\nComputer: ";
2041 stringaNuovaPartita = "New Game";
2042 stringaNuovaPartitaAiTrenta = "New Game - 30 Points";
2043 stringaVuoiDavveroIniziare = "Do you really want to start a new game?";
2044 stringaVuoiDavveroUscire = "Do you really want to exit?";
2045 stringaSi = "Yes";
2046 stringaNo = "No";
2047 stringaOpzioni = "Options...";
2048 stringaEsci = "Exit";
2049 stringaImpossibileConfigurare = "Couldn't write to the configuration file.\nPlease report the bug to: sebastiano@luganega.org\n\nException:\n";
2050 stringaLingua = "Lang";
2051 stringaAnnulla = "Cancel";
2052 stringaIt = "Italian";
2053 stringaLa = "Latin";
2054 stringaBL = "Belluno dialect";
2055 stringaBV = "Venice dialect";
2056 stringaEN = "English";
2057 stringaModificaOpzioni = "Change options";
2058 stringaInformazioni = "Information";
2059 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";
2060 stringaSuono = "Sound";
2061 stringaPunteggio = "Score";
2062 stringaCartePassate = "Played cards";
2063 stringaSfondo = "Background";
2064 stringaTasti = "Hot keys";
2065 stringaAggiornamenti = "Check updates";
2066 stringaTrucchi = "Cheats";
2067 stringaInserisciCodice = "Insert cheat:";
2068 stringaTruccoAttivato = "Cheat actived!";
2069 stringaTruccoSbagliato = "Wrong cheat";
2070 stringaCheCartaVuoi = "So what card do you want?";
2071 stringaAggiornamentiSi = "Update available: ";
2072 stringaAggiornamentiNo = "No updates available";
2073 stringaScarica = "You can get the latest version from the site\nhttp://porkynator.altervista.org/programmi.html";
2074 stringaNoInternet = "Error: no internet connection";
2075 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 " + stringaCartePassate + "\nF6 " + stringaInformazioni + "\nF7 " + stringaAggiornamenti + "\nF8 " + stringaNuovaPartitaAiTrenta + "\nF9 " + stringaTrucchi + "\nq " + stringaEsci;
2076 }
2077 sound = ( soundString.equals( "suono=si" ) );
2078 keys = ( keysString.equals( "tasti=si" ) );
2079 color = new Color( r, g, b );
2080 if ( frame != null ) {
2081 frame.pannello.repaint();
2082 frame.pannello2.repaint();
2083 frame.repaint();
2084 }
2085 }
2086}
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/OptionFrame.java b/JBriscola/all_versions/0.3/0.3.2/src/OptionFrame.java
new file mode 100755
index 0000000..30359f0
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/OptionFrame.java
@@ -0,0 +1,169 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public 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.3/0.3.2/src/Pannello.java b/JBriscola/all_versions/0.3/0.3.2/src/Pannello.java
new file mode 100755
index 0000000..1dde670
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/Pannello.java
@@ -0,0 +1,88 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25/* Questa classe dispone semplicemente le carte
26 * sulla finestra e imposta la sfondo. */
27public class Pannello extends JPanel {
28
29 public static Main main;
30
31 public static Color color;
32
33 public Pannello() { }
34
35 public void paint( Graphics g ) {
36
37 super.paint( g );
38
39 setBackground( main.color );
40
41 if ( main.frame.ultimaCarta != null )
42 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
43
44 if ( main.frame.mazzo )
45 main.frame.retro2.paintIcon( this, g, 17, 256 );
46
47 if ( main.carteScoperte ) {
48
49 if ( main.frame.carteCPU[0] != null )
50 main.frame.carteCPU[0].paintIcon( this, g, 230, 5 );
51
52 if ( main.frame.carteCPU[1] != null )
53 main.frame.carteCPU[1].paintIcon( this, g, 300, 5 );
54
55 if ( main.frame.carteCPU[2] != null )
56 main.frame.carteCPU[2].paintIcon( this, g, 370, 5 );
57
58 } else {
59
60 if ( main.frame.carteCPU[0] != null )
61 main.frame.retro1.paintIcon( this, g, 230, 5 );
62
63 if ( main.frame.carteCPU[1] != null )
64 main.frame.retro1.paintIcon( this, g, 300, 5 );
65
66 if ( main.frame.carteCPU[2] != null )
67 main.frame.retro1.paintIcon( this, g, 370, 5 );
68
69 }
70
71 if ( main.frame.carteInMano[0] != null )
72 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
73
74 if ( main.frame.carteInMano[1] != null )
75 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
76
77 if ( main.frame.carteInMano[2] != null )
78 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
79
80 if ( main.frame.giocata[0] != null )
81 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
82
83 if ( main.frame.giocata[1] != null )
84 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
85
86 }
87}
88
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/PannelloCartePassate.java b/JBriscola/all_versions/0.3/0.3.2/src/PannelloCartePassate.java
new file mode 100755
index 0000000..fef9666
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/PannelloCartePassate.java
@@ -0,0 +1,49 @@
1/*
2Copyright 2009-2010 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25public class PannelloCartePassate extends JPanel {
26
27 public static int posto[][] = new int[40][2];
28
29 public static Main main;
30
31 public PannelloCartePassate() { }
32
33 public void paint( Graphics g ) {
34
35 super.paint( g );
36
37 for( int i = 0; i < 40; i++ ) {
38 posto[i][0] = ( i % 10 ) * 70;
39 posto[i][1] = ( i / 10 ) * 136;
40 }
41
42 for ( int i = 0; i < main.mano*2; i++ )
43 if ( main.frame.arrayCartePassate[i] != null )
44 main.frame.arrayCartePassate[i].paintIcon( this, g, posto[i][0], posto[i][1] );
45
46
47 }
48
49}
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/1-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/1-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/1-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/1-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/10-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/10-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/10-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/10-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/2-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/2-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/2-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/2-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/3-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/3-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/3-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/3-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/4-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/4-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/4-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/4-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/5-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/5-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/5-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/5-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/6-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/6-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/6-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/6-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/7-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/7-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/7-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/7-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/8-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/8-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/8-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/8-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/9-1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/9-2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/9-3.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/9-4.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/Thumbs.db b/JBriscola/all_versions/0.3/0.3.2/src/img/Thumbs.db
new file mode 100755
index 0000000..d9b6bc5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/Thumbs.db
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/carte.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/retro1.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3.2/src/img/retro2.jpg b/JBriscola/all_versions/0.3/0.3.2/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3.2/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/Frame.java b/JBriscola/all_versions/0.3/0.3/src/Frame.java
new file mode 100755
index 0000000..21c4858
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/Frame.java
@@ -0,0 +1,523 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import javax.sound.sampled.*;
24import java.io.*;
25import java.net.*;
26import java.awt.*;
27import java.awt.event.*;
28
29public 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, nuovaPartitaAiTrenta, opzioni, esci, informazioni, punti, aggiornamenti, trucchi, tastiRapidi, briscola;
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, 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 /* Avvisa che si è arrivati alla quartultima mano. */
82 if ( main.mano == 16 )
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 ( main.aiTrenta &&
97 ( ( main.punteggio >= 30 || main.punteggioCPU >= 30 ) ) ) ) {
98
99 String titolo = "";
100 String suonoFinale = "";
101
102 if ( main.punteggio > main.punteggioCPU ) {
103 titolo = main.stringaVinto;
104 suonoFinale = "sounds/perso.wav";
105 }
106 if ( main.punteggio < main.punteggioCPU ) {
107 titolo = main.stringaPerso;
108 suonoFinale = "sounds/vinto.wav";
109 }
110 if ( main.punteggio == main.punteggioCPU ) {
111 titolo = main.stringaPareggio;
112 suonoFinale = "sounds/pareggio.wav";
113 }
114
115 if ( main.sound ) {
116 try {
117 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource( suonoFinale ) );
118 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource( suonoFinale ) );
119 AudioFormat af = aff.getFormat();
120 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
121 Clip ol = ( Clip ) AudioSystem.getLine( info );
122 ol.open(ais);
123 ol.loop( 0 );
124 } catch ( Exception ex ) {
125 System.err.println( e );
126 }
127 }
128
129 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, titolo, JOptionPane.INFORMATION_MESSAGE );
130
131 main.pulisciTavolo();
132
133 }
134 if ( main.toccaAllaCPU )
135 if ( main.aiTrenta )
136 main.giocaCPUAiTrenta();
137 else
138 main.giocaCPU();
139 }
140 } );
141 button.addKeyListener( new KeyAdapter() {
142 /* Aggiunge il keyListener per le scorciatoie da tastiera. Dato
143 * che il bottone prendi/lascia è l'unico componente effettivo
144 * della finestra, avrà obbligatoriamente il focus ed è necessario
145 * che sia lui a gestire gli eventi della tastiera. */
146 public void keyReleased( KeyEvent key ) {
147
148 if ( main.keys ) {
149 switch ( key.getKeyCode() ) {
150 case KeyEvent.VK_1:
151 if ( mettiCarta( 231, 500 ) ) {
152 if ( !main.CPUHaGiocato )
153 if ( main.aiTrenta )
154 main.giocaCPUAiTrenta();
155 else
156 main.giocaCPU();
157 }
158 break;
159
160 case KeyEvent.VK_2:
161 if ( mettiCarta( 301, 500 ) ) {
162 if ( !main.CPUHaGiocato )
163 if ( main.aiTrenta )
164 main.giocaCPUAiTrenta();
165 else
166 main.giocaCPU();
167 }
168 break;
169
170 case KeyEvent.VK_3:
171 if ( mettiCarta( 371, 500 ) ) {
172 if ( !main.CPUHaGiocato )
173 if ( main.aiTrenta )
174 main.giocaCPUAiTrenta();
175 else
176 main.giocaCPU();
177 }
178 break;
179
180 case KeyEvent.VK_F1:
181 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
182 break;
183
184 case KeyEvent.VK_F2:
185 if ( main.mano == 20 ) {
186 main.aiTrenta = false;
187 main.mischia();
188 pannello.repaint();
189 repaint();
190 }
191 else {
192 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 );
193 if ( selezione == JOptionPane.YES_OPTION ) {
194 main.aiTrenta = false;
195 main.mischia();
196 pannello.repaint();
197 repaint();
198 }
199 }
200 break;
201
202 case KeyEvent.VK_F3:
203 OptionFrame optionFrame = new OptionFrame();
204 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
205 optionFrame.setResizable( false );
206 optionFrame.setAlwaysOnTop( true );
207 optionFrame.setSize( 300, 200 );
208 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
209 optionFrame.setVisible( true );
210 break;
211
212 case KeyEvent.VK_F4:
213 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
214 break;
215
216 case KeyEvent.VK_F5:
217 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
218 break;
219
220 case KeyEvent.VK_F6:
221 String latest = main.version;
222 try {
223 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
224 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
225 latest = latestIsReader.readLine();
226 } catch ( Exception ex ) {
227 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
228 }
229 if ( latest.equals( main.version ) )
230 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
231 else
232 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
233 break;
234
235 case KeyEvent.VK_F7:
236 if ( main.mano == 20 ) {
237 main.aiTrenta = true;
238 main.mischia();
239 pannello.repaint();
240 repaint();
241 }
242 else {
243 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 );
244 if ( selezione == JOptionPane.YES_OPTION ) {
245 main.aiTrenta = true;
246 main.mischia();
247 pannello.repaint();
248 repaint();
249 }
250 }
251 break;
252
253 case KeyEvent.VK_F8:
254 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
255 break;
256
257 case KeyEvent.VK_Q:
258 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 );
259 if ( selezione == JOptionPane.YES_OPTION )
260 Frame.this.dispose();
261 break;
262 }
263 }
264 }
265 } );
266
267 barraMenu = new JMenuBar();
268
269 file = new JMenu( "File" );
270
271 nuovaPartita = new JMenuItem( main.stringaNuovaPartita );
272 nuovaPartita.addActionListener( new ActionListener() {
273 /* Avvia una nuova partita, chiedendo prima conferma se ce n'è
274 * già una in corso. */
275 public void actionPerformed( ActionEvent e ) {
276 if ( main.mano == 20 ) {
277 main.aiTrenta = false;
278 main.mischia();
279 pannello.repaint();
280 repaint();
281 }
282
283 else {
284 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 );
285 if ( selezione == JOptionPane.YES_OPTION ) {
286 main.aiTrenta = false;
287 main.mischia();
288 pannello.repaint();
289 repaint();
290 }
291 }
292 }
293 });
294
295 nuovaPartitaAiTrenta = new JMenuItem( main.stringaNuovaPartitaAiTrenta );
296 nuovaPartitaAiTrenta.addActionListener( new ActionListener() {
297 /* Avvia una nuova partita ai 30, chiedendo prima conferma se
298 * ce n'è già una in corso. */
299 public void actionPerformed( ActionEvent e ) {
300 if ( main.mano == 20 ) {
301 main.aiTrenta = true;
302 main.mischia();
303 pannello.repaint();
304 repaint();
305 }
306
307 else {
308 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 );
309 if ( selezione == JOptionPane.YES_OPTION ) {
310 main.aiTrenta = true;
311 main.mischia();
312 pannello.repaint();
313 repaint();
314 }
315 }
316 }
317 });
318
319 trucchi = new JMenuItem( main.stringaTrucchi );
320 trucchi.addActionListener( new ActionListener() {
321 public void actionPerformed( ActionEvent e ) {
322 /* Esegue il trucco */
323 main.trucco( JOptionPane.showInputDialog( Frame.this, main.stringaInserisciCodice, "JBriscola - " + main.version, JOptionPane.PLAIN_MESSAGE ) );
324 }
325 } );
326
327 opzioni = new JMenuItem( main.stringaOpzioni );
328 opzioni.addActionListener( new ActionListener() {
329 /* Apre una OptionFrame per modificare le opzioni. */
330 public void actionPerformed( ActionEvent e ) {
331
332 OptionFrame optionFrame = new OptionFrame();
333 optionFrame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
334 optionFrame.setResizable( false );
335 optionFrame.setAlwaysOnTop( true );
336 optionFrame.setSize( 300, 200 );
337 optionFrame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 300) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 150) / 2);
338 optionFrame.setVisible( true );
339 }
340 });
341
342 esci = new JMenuItem( main.stringaEsci );
343 esci.addActionListener( new ActionListener() {
344 /* Ciede conferma prima di uscire. */
345 public void actionPerformed( ActionEvent e ) {
346 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 );
347 if ( selezione == JOptionPane.YES_OPTION )
348 Frame.this.dispose();
349 }
350 });
351
352 file.add( nuovaPartita );
353 file.add( nuovaPartitaAiTrenta );
354 file.add( trucchi );
355 file.add( opzioni );
356 file.addSeparator();
357 file.add( esci );
358
359 puntoInterrogativo = new JMenu( "?" );
360
361 informazioni = new JMenuItem( main.stringaInformazioni );
362 informazioni.addActionListener( new ActionListener() {
363 /* Visualizza le informazioni. */
364 public void actionPerformed( ActionEvent e ) {
365 JOptionPane.showMessageDialog( Frame.this, main.stringaInformazioni2, main.stringaInformazioni, JOptionPane.PLAIN_MESSAGE );
366 }
367 } );
368
369 tastiRapidi = new JMenuItem( main.stringaTasti );
370 tastiRapidi.addActionListener( new ActionListener() {
371 /* Visualizza i tasti rapidi. */
372 public void actionPerformed( ActionEvent e ) {
373 JOptionPane.showMessageDialog( Frame.this, main.stringaTasti2, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
374 }
375 } );
376
377 briscola = new JMenuItem( main.stringaBriscola );
378 briscola.addActionListener( new ActionListener() {
379 /* Visualizza il seme di briscola corrente. */
380 public void actionPerformed( ActionEvent e ) {
381 JOptionPane.showMessageDialog( Frame.this, main.stringaBriscola + ": " + main.semi[main.semeBriscola], "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
382 }
383 });
384
385 punti = new JMenuItem( main.stringaPunteggio );
386 punti.addActionListener( new ActionListener() {
387 /* Visualizza il punteggio. */
388 public void actionPerformed( ActionEvent e ) {
389 JOptionPane.showMessageDialog( Frame.this, main.stringaGiocatore + main.punteggio + main.stringaComputer + main.punteggioCPU, main.stringaPunteggio, JOptionPane.INFORMATION_MESSAGE );
390 }
391 } );
392
393 aggiornamenti = new JMenuItem( main.stringaAggiornamenti );
394 aggiornamenti.addActionListener( new ActionListener() {
395 /* Cerca aggiornamenti sul sito http://porkynator.altervista.org,
396 * confrontando la versione del programma con quella scritta nel
397 * file jbriscola-latest.is (online). */
398 public void actionPerformed( ActionEvent e ) {
399 String latest = main.version;
400 try {
401 URL latestIs = new URL( "http://porkynator.altervista.org/jbriscola-latest.is" );
402 BufferedReader latestIsReader = new BufferedReader( new InputStreamReader( latestIs.openStream() ) );
403 latest = latestIsReader.readLine();
404 } catch ( Exception ex ) {
405 JOptionPane.showMessageDialog( Frame.this, main.stringaNoInternet, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
406 }
407 if ( latest.equals( main.version ) )
408 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiNo, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
409 else
410 JOptionPane.showMessageDialog( Frame.this, main.stringaAggiornamentiSi + "\n" + main.version + " ==> " + latest + "\n\n" + main.stringaScarica, "JBriscola - " + main.version, JOptionPane.INFORMATION_MESSAGE );
411 }
412 } );
413
414 puntoInterrogativo.add( punti );
415 puntoInterrogativo.add( briscola );
416 puntoInterrogativo.add( tastiRapidi );
417 puntoInterrogativo.add( informazioni );
418 puntoInterrogativo.add( aggiornamenti );
419
420 barraMenu.add( file );
421 barraMenu.add( puntoInterrogativo );
422
423 setJMenuBar( barraMenu );
424
425 /* Inizializza le immagini del retro delle carte. */
426 retro1 = new ImageIcon( ClassLoader.getSystemResource( "img/retro1.jpg" ) );
427 retro2 = new ImageIcon( ClassLoader.getSystemResource( "img/retro2.jpg" ) );
428
429 /* Inizializza tutte le immagini delle carte scorrendo l'array bidimensionale. */
430 for (int i = 0; i < 10; i++)
431 for (int j = 0; j < 4; j++)
432 arrayCarte[i][j] = new ImageIcon( ClassLoader.getSystemResource( "img/" + (i+1) + "-" + (j+1) + ".jpg" ) );
433
434 /* Mischia le carte. */
435 main.mischia();
436
437 /* Aggiunge i vari componenti. */
438 pannello2.add( button );
439 setLayout( new BorderLayout() );
440 add( pannello, BorderLayout.CENTER );
441 add( pannello2, BorderLayout.SOUTH );
442
443 /* Chiama il metodo mettiCarta se l'utente clicca. */
444 addMouseListener(
445 new MouseAdapter() {
446 public void mouseClicked ( MouseEvent e ) {
447 if ( mettiCarta( e.getX(), e.getY() ) ) {
448 if ( !main.CPUHaGiocato )
449 if ( main.aiTrenta )
450 main.giocaCPUAiTrenta();
451 else
452 main.giocaCPU();
453 }
454 }
455 }
456 );
457
458 /* Chiede conferma prima di uscire quando viene chiusa la finestra. */
459 addWindowListener(
460 new WindowAdapter() {
461 public void windowClosing( WindowEvent e ) {
462 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 );
463 if ( selezione == JOptionPane.YES_OPTION )
464 System.exit( 0 );
465 }
466 }
467 );
468 }
469
470 /* Se il giocatore ha cliccato su una carta la gioca e riproduce un suono casuale. */
471 public boolean mettiCarta( int x, int y ) {
472
473 if ( !main.toccaAllaCPU && giocata[0] == null ) {
474 if ( main.sound &&
475 ( ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) ||
476 ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) ||
477 ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) ) ) {
478 try {
479
480 double a = Math.random() * 6;
481 int i = (int) a;
482
483 AudioFileFormat aff = AudioSystem.getAudioFileFormat( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
484 AudioInputStream ais = AudioSystem.getAudioInputStream( ClassLoader.getSystemResource("sounds/" + i + ".wav") );
485 AudioFormat af = aff.getFormat();
486 DataLine.Info info = new DataLine.Info( Clip.class, ais.getFormat(), ( (int) ais.getFrameLength() * af.getFrameSize() ) );
487 Clip ol = ( Clip ) AudioSystem.getLine( info );
488
489 ol.open(ais);
490 ol.loop( 0 );
491
492 } catch ( Exception e ) {
493 System.err.println( e );
494 }
495 }
496
497 if ( x > 230 && x < 290 && y > 340 && y < 566 && carteInMano[0] != null ) {
498 giocata[0] = carteInMano[0];
499 carteInMano[0] = null;
500 pannello.repaint();
501 return true;
502 }
503
504 if ( x > 300 && x < 360 && y > 340 && y < 566 && carteInMano[1] != null ) {
505 giocata[0] = carteInMano[1];
506 carteInMano[1] = null;
507 pannello.repaint();
508 return true;
509 }
510
511 if ( x > 370 && x < 430 && y > 340 && y < 566 && carteInMano[2] != null ) {
512 giocata[0] = carteInMano[2];
513 carteInMano[2] = null;
514 pannello.repaint();
515 return true;
516 }
517 }
518
519 return false;
520 }
521}
522
523
diff --git a/JBriscola/all_versions/0.3/0.3/src/Main.java b/JBriscola/all_versions/0.3/0.3/src/Main.java
new file mode 100755
index 0000000..4907374
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/Main.java
@@ -0,0 +1,1702 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.io.*;
23import java.util.*;
24import javax.swing.*;
25import java.awt.*;
26
27public 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 * aiTrenta serve per determinare se la partida che si sta giocando è
43 * normale o ai 30.
44 * carteScoperte serve se viene attivato il trucco per mostrare le
45 * carte della CPU.
46 * sound e keys riguardano le opzioni (souno si o no, tasti rapidi si
47 * o no) salvate nel file di configurazione. */
48 public static boolean toccaAllaCPU = false;
49 public static boolean CPUHaGiocato = false;
50 public static boolean haGiocatoPrima = true;
51 public static boolean aiTrenta = false;
52 public static boolean carteScoperte = false;
53 public static boolean sound = true;
54 public static boolean keys = true;
55
56 /* frame è la finestra principale del gioco, color il colore dello sfondo.
57 * lang, soundString e keysString servono a leggere le opzioni dal file
58 * di configurazione. */
59 public static Frame frame;
60 public static Color color = new Color( 0, 150, 0 );
61 public static String lang, soundString, keysString;
62
63 /* Tutte le stringhe che vengono utilizzate durante il gioco sono
64 * inizializzate qui, per poter essere tradotte in altre lingue. */
65 public static String version = "0.3";
66 public static String semi[] = { "Bastoni", "Coppe", "Denari", "Spade" };
67 public static String stringaBriscola = "Briscola";
68 public static String stringaBottonePrendi = "Prendi/Lascia carte";
69 public static String stringaPrimaGioca = "Prima Gioca!";
70 public static String stringaUltime4 = "Ultima carta - Occhio alla briscola!";
71 public static String stringaVinto = "Hai Vinto!";
72 public static String stringaPerso = "Hai Perso";
73 public static String stringaPareggio = "Pareggio";
74 public static String stringaGiocatore = "Giocatore: ";
75 public static String stringaComputer = "\nComputer: ";
76 public static String stringaNuovaPartita = "Nuova Partita";
77 public static String stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
78 public static String stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
79 public static String stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
80 public static String stringaSi = "Si";
81 public static String stringaNo = "No";
82 public static String stringaOpzioni = "Opzioni...";
83 public static String stringaEsci = "Esci";
84 public static String stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
85 public static String stringaLingua = "Lingua";
86 public static String stringaAnnulla = "Annulla";
87 public static String stringaIt = "Italiano";
88 public static String stringaLa = "Latino";
89 public static String stringaBL = "Dialetto Bellunese";
90 public static String stringaBV = "Dialetto Basso Veneto";
91 public static String stringaEN = "Inglese";
92 public static String stringaModificaOpzioni = "Modifica Opzioni";
93 public static String stringaInformazioni = "Informazioni";
94 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";
95 public static String stringaSuono = "Effetti Sonori";
96 public static String stringaPunteggio = "Punteggio";
97 public static String stringaSfondo = "Sfondo";
98 public static String stringaTasti = "Tasti rapidi";
99 public static String stringaAggiornamenti = "Cerca aggiornamenti";
100 public static String stringaTrucchi = "Trucchi";
101 public static String stringaInserisciCodice = "Inserisci il codice:";
102 public static String stringaTruccoAttivato = "Trucco attivato!";
103 public static String stringaTruccoSbagliato = "Trucco non valido";
104 public static String stringaCheCartaVuoi = "E allora che carta vuoi?";
105 public static String stringaAggiornamentiSi = "Aggiornamento disponibile: ";
106 public static String stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
107 public static String stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
108 public static String stringaNoInternet = "Errore: nessuna connessione internet";
109 public static String stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
110
111 public static void main( String args[] ) {
112
113 /* Chiama il metodo settaOpzioni per leggere le impostazioni
114 * dell'utente da un eventuale file di configurazione */
115 settaOpzioni();
116
117 /* Crea la finestra principale del gioco e la posiziona al centro
118 * dello schermo. */
119 frame = new Frame();
120 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
121 frame.setResizable( false );
122 frame.setSize( 600, 600 );
123 frame.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width - 600) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - 600) / 2);
124 frame.setVisible( true );
125 }
126
127 /* Algoritmo per mischiare il mazzo: prende due carte a caso e le
128 * inverte di posto, utilizzando una variabile aux. Ripete il procedimento
129 * per 391 volte. */
130 public void mischia() {
131
132 ImageIcon aux;
133
134 mano = 0;
135 punteggio = 0;
136 punteggioCPU = 0;
137 cartaDaPescare = 6;
138 frame.mazzo = true;
139 toccaAllaCPU = false;
140 CPUHaGiocato = false;
141 haGiocatoPrima = true;
142 frame.mazzo = true;
143
144 /* Inizializza l'array di carte mescolate ordinato */
145 for ( int i = 0, k = 0; i < 10; i++ )
146 for ( int j = 0; j < 4; j++, k++ )
147 frame.arrayCarteMescolate[k] = frame.arrayCarte[i][j];
148
149 /* Mescola le carte utilizzando il metodo sopra citato */
150 for ( int i = 0; i < 391; i++ ) {
151 double a = Math.random() * 40;
152 int x = (int) a;
153 double b = Math.random() * 40;
154 int y = (int) b;
155 aux = frame.arrayCarteMescolate[x];
156 frame.arrayCarteMescolate[x] = frame.arrayCarteMescolate[y];
157 frame.arrayCarteMescolate[y] = aux;
158 }
159
160 /* Imposta il seme della briscola leggendo il nome dell'ultima carta
161 * utilizzando un array ausiliare */
162 char auxChar[] = frame.arrayCarteMescolate[39].toString().toCharArray();
163 semeBriscola = auxChar[auxChar.length-5] - 49;
164
165 /* Distribuisce le carte */
166 frame.carteInMano[0] = frame.arrayCarteMescolate[0];
167 frame.carteInMano[1] = frame.arrayCarteMescolate[1];
168 frame.carteInMano[2] = frame.arrayCarteMescolate[2];
169 frame.carteCPU[0] = frame.arrayCarteMescolate[3];
170 frame.carteCPU[1] = frame.arrayCarteMescolate[4];
171 frame.carteCPU[2] = frame.arrayCarteMescolate[5];
172 frame.ultimaCarta = frame.arrayCarteMescolate[39];
173 frame.giocata[0] = null;
174 frame.giocata[1] = null;
175 }
176
177 /* Viene chiamato a fine partita. */
178 public void pulisciTavolo() {
179
180 punteggio = 0;
181 punteggioCPU = 0;
182 cartaDaPescare = 6;
183 toccaAllaCPU = false;
184 CPUHaGiocato = false;
185 haGiocatoPrima = true;
186
187 frame.mazzo = false;
188 frame.ultimaCarta = null;
189 for ( int i = 0; i < 3; i++ ) {
190 frame.carteCPU[i] = null;
191 frame.carteInMano[i] = null;
192 }
193
194 frame.pannello.repaint();
195 frame.repaint();
196
197 }
198
199 /* Fa giocare la CPU. Questo metodo contiene l'intelligenza artificiale
200 * del gioco. Ho preferito non commentare molto il corpo del metodo per
201 * due motivi; il primo è che abbastanza intuitivo: basta sapere che i
202 * vari metodi vaiLiscio(), vaiTaglio() ecc... tentano di fare ciò che
203 * ovviamente dice il loro nome, se ci riescono restituiscono true,
204 * in caso contrario false.*/
205 public void giocaCPU() {
206
207 /* Nelle prime 16 mani ragiona in maniera diversa*/
208 if ( mano < 16 ) {
209
210 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
211 if ( frame.giocata[0] == null ) {
212 if ( vaiPunti() );
213 else if ( vaiLiscio() );
214 else if ( vaiTaglio() );
215 else if ( vaiBriscolaAlta() );
216 else if ( vaiCarico() );
217 else if ( vaiTre() );
218 else if ( vaiAsso() );
219 else;
220 }
221
222 /* Valuta cosa fare quando invece il giocatore ha giocato */
223 else {
224 if ( haLisciato() ) {
225 if ( vaiSopra() );
226 else if ( vaiLiscio() );
227 else if ( vaiPunti() );
228 else if ( vaiTaglio() );
229 else if ( vaiTre() );
230 else if ( vaiBriscolaAlta() );
231 else if ( vaiCarico() );
232 else if ( vaiAsso() );
233 } else if ( haMessoPunti() ) {
234 if ( vaiSopra() );
235 else if ( vaiLiscio() );
236 else if ( vaiTaglio() );
237 else if ( vaiPunti() );
238 else if ( vaiTre() );
239 else if ( vaiBriscolaAlta() );
240 else if ( vaiCarico() );
241 else if ( vaiAsso() );
242 } else if ( haTagliato() ) {
243 if ( vaiLiscio() );
244 else if ( vaiPunti() );
245 else if ( vaiTaglio() );
246 else if ( vaiTre() );
247 else if ( vaiBriscolaAlta() );
248 else if ( vaiCarico() );
249 else if ( vaiAsso() );
250 } else if ( haMessoBriscolaAlta() ) {
251 if ( vaiLiscio() );
252 else if ( vaiPunti() );
253 else if ( vaiTre() );
254 else if ( vaiTaglio() );
255 else if ( vaiBriscolaAlta() );
256 else if ( vaiCarico() );
257 else if ( vaiAsso() );
258 } else if ( haMessoTre() ) {
259 if ( vaiAsso() );
260 else if ( vaiLiscio() );
261 else if ( vaiPunti() );
262 else if ( vaiTaglio() );
263 else if ( vaiBriscolaAlta() );
264 else if ( vaiCarico() );
265 } else if ( haMessoAsso() ) {
266 if ( vaiLiscio() );
267 else if ( vaiPunti() );
268 else if ( vaiTaglio() );
269 else if ( vaiBriscolaAlta() );
270 else if ( vaiCarico() );
271 else if ( vaiTre() );
272 } else if ( haCaricato() ) {
273 if ( vaiSopra() );
274 else if ( vaiTre() );
275 else if ( vaiBriscolaAlta() );
276 else if ( vaiTaglio() );
277 else if ( vaiAsso() );
278 else if ( vaiLiscio() );
279 else if ( vaiPunti() );
280 else if ( vaiCarico() );
281 }
282 }
283 }
284
285 /* Nella penultima mano (prima di pescare l'ultima carta) */
286 else if ( mano == 16 ) {
287
288 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
289 if ( frame.giocata[0] == null ) {
290 char aux[];
291 aux = frame.ultimaCarta.toString().toCharArray();
292 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
293 if ( vaiCarico() );
294 else if ( vaiPunti() );
295 else if ( vaiLiscio() );
296 else if ( vaiTaglio() );
297 else if ( vaiBriscolaAlta() );
298 else if ( vaiTre() );
299 else if ( vaiAsso() );
300 else;
301 } else {
302 if ( vaiPunti() );
303 else if ( vaiLiscio() );
304 else if ( vaiTaglio() );
305 else if ( vaiBriscolaAlta() );
306 else if ( vaiCarico() );
307 else if ( vaiTre() );
308 else if ( vaiAsso() );
309 else;
310 }
311 }
312
313 /* Valuta cosa fare quando invece il giocatore ha giocato */
314 else {
315 char aux[];
316 aux = frame.ultimaCarta.toString().toCharArray();
317 if ( aux[aux.length-7] - 48 == 3 || aux[aux.length-7] - 48 == 1 ) {
318 if ( haCaricato() ) {
319 if ( vaiSopra() );
320 else if ( vaiLiscio() );
321 else if ( vaiPunti() );
322 else if ( vaiTre() );
323 else if ( vaiTaglio() );
324 else if ( vaiBriscolaAlta() );
325 else if ( vaiAsso() );
326 else if ( vaiCarico() );
327 }
328 } else {
329 if ( haLisciato() ) {
330 if ( vaiSopra() );
331 else if ( vaiLiscio() );
332 else if ( vaiPunti() );
333 else if ( vaiTaglio() );
334 else if ( vaiTre() );
335 else if ( vaiBriscolaAlta() );
336 else if ( vaiCarico() );
337 else if ( vaiAsso() );
338 } else if ( haMessoPunti() ) {
339 if ( vaiSopra() );
340 else if ( vaiLiscio() );
341 else if ( vaiTaglio() );
342 else if ( vaiPunti() );
343 else if ( vaiTre() );
344 else if ( vaiBriscolaAlta() );
345 else if ( vaiCarico() );
346 else if ( vaiAsso() );
347 } else if ( haTagliato() ) {
348 if ( vaiLiscio() );
349 else if ( vaiPunti() );
350 else if ( vaiTaglio() );
351 else if ( vaiTre() );
352 else if ( vaiBriscolaAlta() );
353 else if ( vaiCarico() );
354 else if ( vaiAsso() );
355 } else if ( haMessoBriscolaAlta() ) {
356 if ( vaiLiscio() );
357 else if ( vaiPunti() );
358 else if ( vaiTre() );
359 else if ( vaiTaglio() );
360 else if ( vaiBriscolaAlta() );
361 else if ( vaiCarico() );
362 else if ( vaiAsso() );
363 } else if ( haMessoTre() ) {
364 if ( vaiAsso() );
365 else if ( vaiLiscio() );
366 else if ( vaiPunti() );
367 else if ( vaiTaglio() );
368 else if ( vaiBriscolaAlta() );
369 else if ( vaiCarico() );
370 } else if ( haMessoAsso() ) {
371 if ( vaiLiscio() );
372 else if ( vaiPunti() );
373 else if ( vaiTaglio() );
374 else if ( vaiBriscolaAlta() );
375 else if ( vaiCarico() );
376 else if ( vaiTre() );
377 } else if ( haCaricato() ) {
378 if ( vaiSopra() );
379 else if ( vaiTre() );
380 else if ( vaiBriscolaAlta() );
381 else if ( vaiAsso() );
382 else if ( vaiTaglio() );
383 else if ( vaiLiscio() );
384 else if ( vaiPunti() );
385 else if ( vaiCarico() );
386 }
387 }
388 }
389
390 } else if ( mano == 17 ) {
391
392 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
393 if ( frame.giocata[0] == null ) {
394 if ( hoAsso() ) {
395 if ( vaiTre() );
396 else if ( vaiBriscolaAlta() );
397 else if ( vaiTaglio() );
398 else if ( vaiLiscio() );
399 else if ( vaiPunti() );
400 else if ( vaiAsso() );
401 else if ( vaiCarico() );
402 } else {
403 if ( vaiLiscio() );
404 else if ( vaiPunti() );
405 else if ( vaiTaglio() );
406 else if ( vaiBriscolaAlta() );
407 else if ( vaiCarico() );
408 else if ( vaiTre() );
409 }
410 }
411
412 /* Valuta cosa fare quando invece il giocatore ha giocato */
413 else {
414 if ( haLisciato() ) {
415 if ( vaiSopra() );
416 else if ( vaiLiscio() );
417 else if ( vaiPunti() );
418 else if ( vaiTaglio() );
419 else if ( vaiTre() );
420 else if ( vaiBriscolaAlta() );
421 else if ( vaiCarico() );
422 else if ( vaiAsso() );
423 } else if ( haMessoPunti() ) {
424 if ( vaiSopra() );
425 else if ( vaiLiscio() );
426 else if ( vaiTaglio() );
427 else if ( vaiPunti() );
428 else if ( vaiTre() );
429 else if ( vaiBriscolaAlta() );
430 else if ( vaiCarico() );
431 else if ( vaiAsso() );
432 } else if ( haTagliato() ) {
433 if ( vaiLiscio() );
434 else if ( vaiPunti() );
435 else if ( vaiTaglio() );
436 else if ( vaiTre() );
437 else if ( vaiBriscolaAlta() );
438 else if ( vaiCarico() );
439 else if ( vaiAsso() );
440 } else if ( haMessoBriscolaAlta() ) {
441 if ( vaiLiscio() );
442 else if ( vaiPunti() );
443 else if ( vaiTre() );
444 else if ( vaiTaglio() );
445 else if ( vaiBriscolaAlta() );
446 else if ( vaiCarico() );
447 else if ( vaiAsso() );
448 } else if ( haMessoTre() ) {
449 if ( vaiAsso() );
450 else if ( vaiLiscio() );
451 else if ( vaiPunti() );
452 else if ( vaiTaglio() );
453 else if ( vaiBriscolaAlta() );
454 else if ( vaiCarico() );
455 } else if ( haMessoAsso() ) {
456 if ( vaiLiscio() );
457 else if ( vaiPunti() );
458 else if ( vaiTaglio() );
459 else if ( vaiBriscolaAlta() );
460 else if ( vaiCarico() );
461 else if ( vaiTre() );
462 } else if ( haCaricato() ) {
463 if ( vaiSopra() );
464 else if ( vaiTre() );
465 else if ( vaiBriscolaAlta() );
466 else if ( vaiAsso() );
467 else if ( vaiTaglio() );
468 else if ( vaiLiscio() );
469 else if ( vaiPunti() );
470 else if ( vaiCarico() );
471 }
472 }
473
474 } else if ( mano == 18 ) {
475
476 /* Valuta cosa fare se il giocatore non ha ancora giocato. */
477 if ( frame.giocata[0] == null ) {
478 if ( vaiAsso() );
479 else if ( vaiCarico() );
480 else if ( vaiBriscolaAlta() );
481 else if ( vaiTaglio() );
482 else if ( vaiPunti() );
483 else if ( vaiLiscio() );
484 else if ( vaiTre() );
485 }
486
487 /* Valuta cosa fare quando invece il giocatore ha giocato */
488 else {
489 if ( haLisciato() ) {
490 if ( vaiSopra() );
491 else if ( vaiLiscio() );
492 else if ( vaiPunti() );
493 else if ( vaiTaglio() );
494 else if ( vaiTre() );
495 else if ( vaiBriscolaAlta() );
496 else if ( vaiCarico() );
497 else if ( vaiAsso() );
498 } else if ( haMessoPunti() ) {
499 if ( vaiSopra() );
500 else if ( vaiLiscio() );
501 else if ( vaiTaglio() );
502 else if ( vaiPunti() );
503 else if ( vaiTre() );
504 else if ( vaiBriscolaAlta() );
505 else if ( vaiCarico() );
506 else if ( vaiAsso() );
507 } else if ( haTagliato() ) {
508 if ( vaiLiscio() );
509 else if ( vaiPunti() );
510 else if ( vaiTaglio() );
511 else if ( vaiTre() );
512 else if ( vaiBriscolaAlta() );
513 else if ( vaiCarico() );
514 else if ( vaiAsso() );
515 } else if ( haMessoBriscolaAlta() ) {
516 if ( vaiLiscio() );
517 else if ( vaiPunti() );
518 else if ( vaiTre() );
519 else if ( vaiTaglio() );
520 else if ( vaiBriscolaAlta() );
521 else if ( vaiCarico() );
522 else if ( vaiAsso() );
523 } else if ( haMessoTre() ) {
524 if ( vaiAsso() );
525 else if ( vaiLiscio() );
526 else if ( vaiPunti() );
527 else if ( vaiTaglio() );
528 else if ( vaiBriscolaAlta() );
529 else if ( vaiCarico() );
530 } else if ( haMessoAsso() ) {
531 if ( vaiLiscio() );
532 else if ( vaiPunti() );
533 else if ( vaiTaglio() );
534 else if ( vaiBriscolaAlta() );
535 else if ( vaiCarico() );
536 else if ( vaiTre() );
537 } else if ( haCaricato() ) {
538 if ( vaiSopra() );
539 else if ( vaiTre() );
540 else if ( vaiBriscolaAlta() );
541 else if ( vaiAsso() );
542 else if ( vaiTaglio() );
543 else if ( vaiLiscio() );
544 else if ( vaiPunti() );
545 else if ( vaiCarico() );
546 }
547 }
548
549 /* All'ultima mano è inutile ragionare, dato che ha una sola carta */
550 } else {
551 if ( vaiTre() );
552 else if ( vaiBriscolaAlta() );
553 else if ( vaiAsso() );
554 else if ( vaiTaglio() );
555 else if ( vaiLiscio() );
556 else if ( vaiPunti() );
557 else if ( vaiCarico() );
558 }
559
560 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
561 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
562 frame.carteCPU[cartaDaGiocare] = null;
563 frame.pannello.repaint();
564
565 CPUHaGiocato = true;
566
567 if ( frame.giocata[0] == null )
568 toccaAllaCPU = false;
569 }
570
571 /* Fa giocare una partita ai 30. È analogo al metodo precedente, cambia
572 * solo la tecnica di gioco, quindi non è commentato. */
573 public void giocaCPUAiTrenta() {
574
575 if ( punteggio <= 20 ) {
576
577 if ( frame.giocata[0] == null ) {
578 if ( vaiPunti() );
579 else if ( vaiLiscio() );
580 else if ( vaiTaglio() );
581 else if ( vaiBriscolaAlta() );
582 else if ( vaiCarico() );
583 else if ( vaiTre() );
584 else if ( vaiAsso() );
585 else;
586 }
587
588 /* Valuta cosa fare quando invece il giocatore ha giocato */
589 else {
590 if ( haLisciato() ) {
591 if ( vaiSopra() );
592 else if ( vaiLiscio() );
593 else if ( vaiTre() );
594 else if ( vaiBriscolaAlta() );
595 else if ( vaiTaglio() );
596 else if ( vaiPunti() );
597 else if ( vaiAsso() );
598 else if ( vaiCarico() );
599 } else if ( haMessoPunti() ) {
600 if ( vaiSopra() );
601 else if ( vaiTre() );
602 else if ( vaiBriscolaAlta() );
603 else if ( vaiTaglio() );
604 else if ( vaiLiscio() );
605 else if ( vaiPunti() );
606 else if ( vaiAsso() );
607 else if ( vaiCarico() );
608 } else if ( haTagliato() ) {
609 if ( vaiLiscio() );
610 else if ( vaiPunti() );
611 else if ( vaiTaglio() );
612 else if ( vaiTre() );
613 else if ( vaiBriscolaAlta() );
614 else if ( vaiAsso() );
615 else if ( vaiCarico() );
616 } else if ( haMessoBriscolaAlta() ) {
617 if ( vaiLiscio() );
618 else if ( vaiPunti() );
619 else if ( vaiTre() );
620 else if ( vaiTaglio() );
621 else if ( vaiBriscolaAlta() );
622 else if ( vaiAsso() );
623 else if ( vaiCarico() );
624 } else if ( haMessoTre() ) {
625 if ( vaiAsso() );
626 else if ( vaiLiscio() );
627 else if ( vaiPunti() );
628 else if ( vaiTaglio() );
629 else if ( vaiBriscolaAlta() );
630 else if ( vaiCarico() );
631 } else if ( haMessoAsso() ) {
632 if ( vaiLiscio() );
633 else if ( vaiPunti() );
634 else if ( vaiTaglio() );
635 else if ( vaiBriscolaAlta() );
636 else if ( vaiCarico() );
637 else if ( vaiTre() );
638 } else if ( haCaricato() ) {
639 if ( vaiSopra() );
640 else if ( vaiTre() );
641 else if ( vaiBriscolaAlta() );
642 else if ( vaiTaglio() );
643 else if ( vaiAsso() );
644 else if ( vaiLiscio() );
645 else if ( vaiPunti() );
646 else if ( vaiCarico() );
647 }
648 }
649 }
650
651 else {
652
653 if ( frame.giocata[0] == null ) {
654 if ( vaiLiscio() );
655 else if ( vaiPunti() );
656 else if ( vaiTaglio() );
657 else if ( vaiBriscolaAlta() );
658 else if ( vaiAsso() );
659 else if ( vaiTre() );
660 else if ( vaiCarico() );
661 else;
662 }
663
664 /* Valuta cosa fare quando invece il giocatore ha giocato */
665 else {
666 if ( haLisciato() ) {
667 if ( vaiSopra() );
668 else if ( vaiLiscio() );
669 else if ( vaiTre() );
670 else if ( vaiBriscolaAlta() );
671 else if ( vaiTaglio() );
672 else if ( vaiAsso() );
673 else if ( vaiPunti() );
674 else if ( vaiCarico() );
675 } else if ( haMessoPunti() ) {
676 if ( vaiSopra() );
677 else if ( vaiTre() );
678 else if ( vaiBriscolaAlta() );
679 else if ( vaiTaglio() );
680 else if ( vaiAsso() );
681 else if ( vaiLiscio() );
682 else if ( vaiPunti() );
683 else if ( vaiCarico() );
684 } else if ( haTagliato() ) {
685 if ( vaiLiscio() );
686 else if ( vaiTaglio() );
687 else if ( vaiTre() );
688 else if ( vaiBriscolaAlta() );
689 else if ( vaiAsso() );
690 else if ( vaiPunti() );
691 else if ( vaiCarico() );
692 } else if ( haMessoBriscolaAlta() ) {
693 if ( vaiLiscio() );
694 else if ( vaiTre() );
695 else if ( vaiTaglio() );
696 else if ( vaiAsso() );
697 else if ( vaiBriscolaAlta() );
698 else if ( vaiPunti() );
699 else if ( vaiCarico() );
700 } else if ( haMessoTre() ) {
701 if ( vaiAsso() );
702 else if ( vaiLiscio() );
703 else if ( vaiPunti() );
704 else if ( vaiTaglio() );
705 else if ( vaiBriscolaAlta() );
706 else if ( vaiCarico() );
707 } else if ( haMessoAsso() ) {
708 if ( vaiLiscio() );
709 else if ( vaiTaglio() );
710 else if ( vaiPunti() );
711 else if ( vaiBriscolaAlta() );
712 else if ( vaiCarico() );
713 else if ( vaiTre() );
714 } else if ( haCaricato() ) {
715 if ( vaiSopra() );
716 else if ( vaiTre() );
717 else if ( vaiBriscolaAlta() );
718 else if ( vaiTaglio() );
719 else if ( vaiAsso() );
720 else if ( vaiLiscio() );
721 else if ( vaiPunti() );
722 else if ( vaiCarico() );
723 }
724 }
725 }
726
727 /* Gioca la carta e aggiorna la finestra con il metodo repaint() */
728 frame.giocata[1] = frame.carteCPU[cartaDaGiocare];
729 frame.carteCPU[cartaDaGiocare] = null;
730 frame.pannello.repaint();
731
732 CPUHaGiocato = true;
733
734 if ( frame.giocata[0] == null )
735 toccaAllaCPU = false;
736 }
737
738 /* Determina se ha preso la CPU o il giocatore */
739 public void chiPrende() {
740 char aux[], auxCPU[];
741 aux = frame.giocata[0].toString().toCharArray();
742 auxCPU = frame.giocata[1].toString().toCharArray();
743
744 /* Chiama il metodo giocatorePrende( boolean giocatore ) con parametro
745 * true se ha preso il giocatore, false se ha preso la CPU */
746 giocatorePrende( ( (aux[aux.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) )
747 || ( (aux[aux.length-5] == auxCPU[auxCPU.length-5]) && laPrimaEPiuAlta( aux[aux.length-7] - 48, auxCPU[auxCPU.length-7] - 48 ) )
748 || ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (aux[aux.length-5] != auxCPU[auxCPU.length-5]) && haGiocatoPrima ) );
749 }
750
751 /* Confronta due carte per decidere quale ha più valore di presa.
752 * Restituisce true se è la prima, false se è la seconda */
753 public boolean laPrimaEPiuAlta( int prima, int seconda ) {
754 int a, b;
755 switch ( prima ) {
756 case 0:
757 a = 10;
758 break;
759 case 1:
760 a = 12;
761 break;
762 case 3:
763 a = 11;
764 break;
765 default:
766 a = prima;
767 break;
768 }
769 switch ( seconda ) {
770 case 0:
771 b = 10;
772 break;
773 case 1:
774 b = 12;
775 break;
776 case 3:
777 b = 11;
778 break;
779 default:
780 b = seconda;
781 break;
782 }
783 return a > b;
784 }
785
786 /* Viene chiamato con parametro true se ha preso il giocatore, false se
787 * ha preso la CPU */
788 public void giocatorePrende( boolean giocatore ) {
789 if ( giocatore ) {
790 toccaAllaCPU = CPUHaGiocato = false;
791 haGiocatoPrima = true;
792 }
793 else {
794 toccaAllaCPU = true;
795 CPUHaGiocato = haGiocatoPrima = false;
796 }
797 daiPunti( giocatore );
798 }
799
800 /* Da i punti (true al giocatore, false alla CPU) e fa pescare le carte*/
801 public void daiPunti( boolean giocatore ) {
802
803 char aux[], auxCPU[];
804 aux = frame.giocata[0].toString().toCharArray();
805 auxCPU = frame.giocata[1].toString().toCharArray();
806 int punti = 0;
807
808 switch( aux[aux.length-7] - 48 ) {
809 case 0:
810 punti += 4;
811 break;
812 case 1:
813 punti += 11;
814 break;
815 case 3:
816 punti += 10;
817 break;
818 case 8:
819 punti += 2;
820 break;
821 case 9:
822 punti += 3;
823 break;
824 default:
825 break;
826 }
827 switch( auxCPU[auxCPU.length-7] - 48 ) {
828 case 0:
829 punti += 4;
830 break;
831 case 1:
832 punti += 11;
833 break;
834 case 3:
835 punti += 10;
836 break;
837 case 8:
838 punti += 2;
839 break;
840 case 9:
841 punti += 3;
842 break;
843 default:
844 break;
845 }
846
847 frame.giocata[0] = frame.giocata[1] = null;
848
849 if ( giocatore ) {
850 punteggio += punti;
851 if ( mano < 18 ) {
852 if ( frame.carteInMano[0] == null )
853 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
854 if ( frame.carteInMano[1] == null )
855 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
856 if ( frame.carteInMano[2] == null )
857 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
858 cartaDaPescare++;
859 if ( frame.carteCPU[0] == null )
860 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
861 if ( frame.carteCPU[1] == null )
862 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
863 if ( frame.carteCPU[2] == null )
864 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
865 cartaDaPescare++;
866 }
867 }
868
869 else {
870 punteggioCPU += punti;
871 if ( mano < 18 ) {
872 if ( frame.carteCPU[0] == null )
873 frame.carteCPU[0] = frame.arrayCarteMescolate[cartaDaPescare];
874 if ( frame.carteCPU[1] == null )
875 frame.carteCPU[1] = frame.arrayCarteMescolate[cartaDaPescare];
876 if ( frame.carteCPU[2] == null )
877 frame.carteCPU[2] = frame.arrayCarteMescolate[cartaDaPescare];
878 cartaDaPescare++;
879 if ( frame.carteInMano[0] == null )
880 frame.carteInMano[0] = frame.arrayCarteMescolate[cartaDaPescare];
881 if ( frame.carteInMano[1] == null )
882 frame.carteInMano[1] = frame.arrayCarteMescolate[cartaDaPescare];
883 if ( frame.carteInMano[2] == null )
884 frame.carteInMano[2] = frame.arrayCarteMescolate[cartaDaPescare];
885 cartaDaPescare++;
886 }
887 }
888
889 /* Aggiorna la finestra */
890 frame.pannello.repaint();
891 frame.repaint();
892 }
893
894 /* Vari metodi che determinano che tipo di carta ha giocato il giocatore.
895 * Per farlo leggono il nome dell'immagine dal file. Dato che ogni carta
896 * a un nome del tipo 1-1.jpg (asso di coppe) o 10-3 (re di denari) e
897 * così via, è facile riconoscerle. */
898 public boolean haLisciato() {
899 char auxCPU[];
900 auxCPU = frame.giocata[0].toString().toCharArray();
901 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
902 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
903 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) );
904 }
905
906 public boolean haMessoPunti() {
907 char auxCPU[];
908 auxCPU = frame.giocata[0].toString().toCharArray();
909 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
910 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) ||
911 (auxCPU[auxCPU.length-7] - 48 == 9 ) ) );
912 }
913
914 public boolean haTagliato() {
915 char auxCPU[];
916 auxCPU = frame.giocata[0].toString().toCharArray();
917 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
918 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
919 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) );
920 }
921
922 public boolean haMessoBriscolaAlta() {
923 char auxCPU[];
924 auxCPU = frame.giocata[0].toString().toCharArray();
925 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
926 ( (auxCPU[auxCPU.length-7] - 48 == 0) || (auxCPU[auxCPU.length-7] - 48 == 8) ||
927 (auxCPU[auxCPU.length-7] - 48 == 9) ) );
928 }
929
930 public boolean haMessoTre() {
931 char auxCPU[];
932 auxCPU = frame.giocata[0].toString().toCharArray();
933 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
934 (auxCPU[auxCPU.length-7] - 48 == 3) );
935 }
936
937 public boolean haMessoAsso() {
938 char auxCPU[];
939 auxCPU = frame.giocata[0].toString().toCharArray();
940 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
941 (auxCPU[auxCPU.length-7] - 48 == 1) );
942 }
943
944 public boolean haCaricato() {
945 char auxCPU[];
946 auxCPU = frame.giocata[0].toString().toCharArray();
947 return ( (frame.giocata[0] != null) && (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
948 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) );
949 }
950
951 /* I metodi seguenti cercano di andare liscio - dare punti - mettere
952 * un taglio - ecc... e restituiscono true se hanno avuto successo,
953 * false altrimenti. */
954 public boolean vaiLiscio() {
955
956 char auxCPU[];
957
958 for ( int i = 0; i < 3; i++ ) {
959 if ( frame.carteCPU[i] != null ) {
960 auxCPU = frame.carteCPU[i].toString().toCharArray();
961 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
962 (auxCPU[auxCPU.length-7] - 48 != 0 ) && (auxCPU[auxCPU.length-7] - 48 != 1 ) &&
963 (auxCPU[auxCPU.length-7] - 48 != 3 ) && (auxCPU[auxCPU.length-7] - 48 < 8 ) ) {
964 cartaDaGiocare = i;
965 return true;
966 }
967 }
968 }
969
970 return false;
971 }
972
973 public boolean vaiPunti() {
974 /* Cerca di dare punti, cercando di darne il meno possibile (meglio
975 * un fante di re). */
976
977 char[] auxCPU;
978
979 for ( int i = 0; i < 3; i++ ) {
980 if ( frame.carteCPU[i] != null ) {
981 auxCPU = frame.carteCPU[i].toString().toCharArray();
982 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
983 cartaDaGiocare = i;
984 return true;
985 }
986 }
987 }
988
989 for ( int i = 0; i < 3; i++ ) {
990 if ( frame.carteCPU[i] != null ) {
991 auxCPU = frame.carteCPU[i].toString().toCharArray();
992 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
993 cartaDaGiocare = i;
994 return true;
995 }
996 }
997 }
998
999 for ( int i = 0; i < 3; i++ ) {
1000 if ( frame.carteCPU[i] != null ) {
1001 auxCPU = frame.carteCPU[i].toString().toCharArray();
1002 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
1003 cartaDaGiocare = i;
1004 return true;
1005 }
1006 }
1007 }
1008
1009 return false;
1010 }
1011 public boolean vaiTaglio() {
1012
1013 char auxCPU[];
1014
1015 for ( int i = 0; i < 3; i++ ) {
1016 if ( frame.carteCPU[i] != null ) {
1017 auxCPU = frame.carteCPU[i].toString().toCharArray();
1018 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola &&
1019 (auxCPU[auxCPU.length-7] - 48 != 0) && (auxCPU[auxCPU.length-7] - 48 != 1) &&
1020 (auxCPU[auxCPU.length-7] - 48 != 3) && (auxCPU[auxCPU.length-7] - 48 <= 7) ) {
1021 cartaDaGiocare = i;
1022 return true;
1023 }
1024 }
1025 }
1026
1027 return false;
1028 }
1029 public boolean vaiBriscolaAlta() {
1030
1031 char[] auxCPU;
1032
1033 for ( int i = 0; i < 3; i++ ) {
1034 if ( frame.carteCPU[i] != null ) {
1035 auxCPU = frame.carteCPU[i].toString().toCharArray();
1036 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 8 ) ) {
1037 cartaDaGiocare = i;
1038 return true;
1039 }
1040 }
1041 }
1042
1043 for ( int i = 0; i < 3; i++ ) {
1044 if ( frame.carteCPU[i] != null ) {
1045 auxCPU = frame.carteCPU[i].toString().toCharArray();
1046 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 9 ) ) {
1047 cartaDaGiocare = i;
1048 return true;
1049 }
1050 }
1051 }
1052
1053 for ( int i = 0; i < 3; i++ ) {
1054 if ( frame.carteCPU[i] != null ) {
1055 auxCPU = frame.carteCPU[i].toString().toCharArray();
1056 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 0 ) ) {
1057 cartaDaGiocare = i;
1058 return true;
1059 }
1060 }
1061 }
1062
1063 return false;
1064 }
1065 public boolean vaiTre() {
1066
1067 char auxCPU[];
1068
1069 for ( int i = 0; i < 3; i++ ) {
1070 if ( frame.carteCPU[i] != null ) {
1071 auxCPU = frame.carteCPU[i].toString().toCharArray();
1072 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 3) ) {
1073 cartaDaGiocare = i;
1074 return true;
1075 }
1076 }
1077 }
1078
1079 return false;
1080 }
1081 public boolean vaiAsso() {
1082
1083 char auxCPU[];
1084
1085 for ( int i = 0; i < 3; i++ ) {
1086 if ( frame.carteCPU[i] != null ) {
1087 auxCPU = frame.carteCPU[i].toString().toCharArray();
1088 if ( auxCPU[auxCPU.length-5] - 49 == semeBriscola && (auxCPU[auxCPU.length-7] - 48 == 1) ) {
1089 cartaDaGiocare = i;
1090 return true;
1091 }
1092 }
1093 }
1094
1095 return false;
1096 }
1097 public boolean vaiCarico() {
1098
1099 char[] auxCPU;
1100
1101 for ( int i = 0; i < 3; i++ ) {
1102 if ( frame.carteCPU[i] != null ) {
1103 auxCPU = frame.carteCPU[i].toString().toCharArray();
1104 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
1105 cartaDaGiocare = i;
1106 return true;
1107 }
1108 }
1109 }
1110
1111 for ( int i = 0; i < 3; i++ ) {
1112 if ( frame.carteCPU[i] != null ) {
1113 auxCPU = frame.carteCPU[i].toString().toCharArray();
1114 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
1115 cartaDaGiocare = i;
1116 return true;
1117 }
1118 }
1119 }
1120
1121 return false;
1122 }
1123 public boolean vaiSopra() {
1124 /* Innanzitutto controlla se il giocatore ha giocato (non dovrebbe
1125 * essere possibile, in quanto quando questo metodo viene chiamato
1126 * tale condizione è già stata verificata, ma è sempre meglio un
1127 * controllo in più che uno in meno) e restituisce false in caso
1128 * contrario */
1129 if ( frame.giocata[0] == null )
1130 return false;
1131
1132 /* Tre variabili intere che serviranno a valutare quali delle tre
1133 * carte è meglio giocare, se più di una può andare sopra. */
1134 int a = -1;
1135 int b = -1;
1136 int c = -1;
1137
1138 /* Tre booleane che verificano quali delle tre carte possono
1139 * andare sopra. */
1140 boolean laPrimaPuoAndareSopra = false;
1141 boolean laSecondaPuoAndareSopra = false;
1142 boolean laTerzaPuoAndareSopra = false;
1143
1144 /* E tre array di caratteri ausiliari per leggere il nome delle
1145 * carte, più quello per la carta giocata dal giocatore.*/
1146 char[] auxCPU1 = new char[1024];
1147 char[] auxCPU2 = new char[1024];
1148 char[] auxCPU3 = new char[1024];
1149 char[] aux = frame.giocata[0].toString().toCharArray();
1150
1151 /* Se il giocatore ha giocato un asso, restituisce direttamente false. */
1152 if ( aux[aux.length-7] - 48 == 1 )
1153 return false;
1154
1155 /* Valuta quali delle tre carte possono andare sopra, dopo essersi
1156 * accertato di averle: nelle ultime mani non si hanno tutte le carte
1157 * in mano, e noi non vogliamo una NullPointerException sul più bello
1158 * di una partita, vero?! */
1159 if ( frame.carteCPU[0] != null ) {
1160 auxCPU1 = frame.carteCPU[0].toString().toCharArray();
1161 a = auxCPU1[auxCPU1.length-7] - 48;
1162 if ( (auxCPU1[auxCPU1.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( a, aux[aux.length-7] - 48 ) )
1163 laPrimaPuoAndareSopra = true;
1164 }
1165
1166 if ( frame.carteCPU[1] != null ) {
1167 auxCPU2 = frame.carteCPU[1].toString().toCharArray();
1168 b = auxCPU2[auxCPU2.length-7] - 48;
1169 if ( (auxCPU2[auxCPU2.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( b, aux[aux.length-7] - 48 ) )
1170 laSecondaPuoAndareSopra = true;
1171 }
1172
1173 if ( frame.carteCPU[2] != null ) {
1174 auxCPU3 = frame.carteCPU[2].toString().toCharArray();
1175 c = auxCPU3[auxCPU3.length-7] - 48;
1176 if ( (auxCPU3[auxCPU3.length-5] - 49 == aux[aux.length-5] - 49) && laPrimaEPiuAlta( c, aux[aux.length-7] - 48 ) )
1177 laTerzaPuoAndareSopra = true;
1178 }
1179
1180 /* Se nessuna carta può andare sopra, restituisce false. Se una
1181 * sola delle tre può andare sopra la imposta come carta da giocare. */
1182 if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1183 return false;
1184 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1185 cartaDaGiocare = 0;
1186 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1187 cartaDaGiocare = 1;
1188 else if ( !laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1189 cartaDaGiocare = 2;
1190
1191 /* Se più di una carta può andare sopra, valuta quale è più alta. */
1192 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && !laTerzaPuoAndareSopra )
1193 if ( laPrimaEPiuAlta( a, b ) )
1194 cartaDaGiocare = 0;
1195 else
1196 cartaDaGiocare = 1;
1197 else if ( !laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1198 if ( laPrimaEPiuAlta( b, c ) )
1199 cartaDaGiocare = 1;
1200 else
1201 cartaDaGiocare = 2;
1202 else if ( laPrimaPuoAndareSopra && !laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1203 if ( laPrimaEPiuAlta( a, c ) )
1204 cartaDaGiocare = 0;
1205 else
1206 cartaDaGiocare = 2;
1207 else if ( laPrimaPuoAndareSopra && laSecondaPuoAndareSopra && laTerzaPuoAndareSopra )
1208 if ( laPrimaEPiuAlta( a, b ) )
1209 if ( laPrimaEPiuAlta( a, c ) )
1210 cartaDaGiocare = 0;
1211 else
1212 cartaDaGiocare = 2;
1213 else
1214 if ( laPrimaEPiuAlta( b, c ) )
1215 cartaDaGiocare = 1;
1216 else
1217 cartaDaGiocare = 2;
1218
1219 /* Controlla che la carta con cui sta cercando di andare sopra
1220 * sia una figura o un carico. Non vogliamo mica prendere delle
1221 * scartelle con delle scartelle, giusto?! */
1222 aux = frame.carteCPU[cartaDaGiocare].toString().toCharArray();
1223 if ( (aux[aux.length-7] - 48 != 0) && (aux[aux.length-7] - 48 != 1) &&
1224 (aux[aux.length-7] - 48 != 3) && (aux[aux.length-7] - 48 <= 7) )
1225 return false;
1226
1227 return true;
1228 }
1229
1230 /* I metodi seguenti valutano le carte che la CPU ha in mano. */
1231 public boolean hoCarico() {
1232
1233 char auxCPU[];
1234
1235 for ( int i = 0; i < 3; i++ ) {
1236 if ( frame.carteCPU[i] != null ) {
1237 auxCPU = frame.carteCPU[i].toString().toCharArray();
1238 if ( (auxCPU[auxCPU.length-5] - 49 != semeBriscola) &&
1239 ( (auxCPU[auxCPU.length-7] - 48 == 1 ) || (auxCPU[auxCPU.length-7] - 48 == 3 ) ) ) {
1240 return true;
1241 }
1242 }
1243 }
1244
1245 return false;
1246 }
1247 public boolean hoAsso() {
1248
1249 char auxCPU[];
1250
1251 for ( int i = 0; i < 3; i++ ) {
1252 if ( frame.carteCPU[i] != null ) {
1253 auxCPU = frame.carteCPU[i].toString().toCharArray();
1254 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 1 ) ) {
1255 return true;
1256 }
1257 }
1258 }
1259
1260 return false;
1261 }
1262 public boolean hoTre() {
1263
1264 char auxCPU[];
1265
1266 for ( int i = 0; i < 3; i++ ) {
1267 if ( frame.carteCPU[i] != null ) {
1268 auxCPU = frame.carteCPU[i].toString().toCharArray();
1269 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) && (auxCPU[auxCPU.length-7] - 48 == 3 ) ) {
1270 return true;
1271 }
1272 }
1273 }
1274
1275 return false;
1276 }
1277 public boolean hoBriscolaAlta() {
1278
1279 char auxCPU[];
1280
1281 for ( int i = 0; i < 3; i++ ) {
1282 if ( frame.carteCPU[i] != null ) {
1283 auxCPU = frame.carteCPU[i].toString().toCharArray();
1284 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
1285 ( (auxCPU[auxCPU.length-7] - 48 == 0 ) || (auxCPU[auxCPU.length-7] - 48 == 8 ) || (auxCPU[auxCPU.length-7] - 48 == 9 ) ) ) {
1286 return true;
1287 }
1288 }
1289 }
1290
1291 return false;
1292 }
1293 public boolean hoTaglio() {
1294
1295 char auxCPU[];
1296
1297 for ( int i = 0; i < 3; i++ ) {
1298 if ( frame.carteCPU[i] != null ) {
1299 auxCPU = frame.carteCPU[i].toString().toCharArray();
1300 if ( (auxCPU[auxCPU.length-5] - 49 == semeBriscola) &&
1301 (auxCPU[auxCPU.length-7] - 48 < 8 ) && (auxCPU[auxCPU.length-7] - 48 != 3 )
1302 && (auxCPU[auxCPU.length-7] - 48 != 1 ) && (auxCPU[auxCPU.length-7] - 48 != 0 ) ) {
1303 return true;
1304 }
1305 }
1306 }
1307
1308 return false;
1309 }
1310
1311 /* I vari trucchi del gioco. */
1312 public static void trucco( String trucco ) {
1313
1314 byte[] truccoByte = trucco.getBytes();
1315 char[] truccoChar = new char[ truccoByte.length ];
1316 for ( int i = 0; i < truccoChar.length; i++ )
1317 truccoChar[i] = (char)truccoByte[i];
1318
1319 String attivato = stringaTruccoSbagliato;
1320
1321 /* Carta che vuoi dove vuoi. Esempio: x251 sostituisce
1322 * la terza carta (2) con il 6 (5) di coppe (1). */
1323 if ( truccoChar[0] == 'x' && truccoChar.length == 4 ) {
1324
1325 attivato = stringaTruccoAttivato;
1326
1327 String aS = "" + truccoChar[1];
1328 String xS = "" + truccoChar[2];
1329 String yS = "" + truccoChar[3];
1330
1331 int a, x, y;
1332
1333 try {
1334
1335 a = Integer.parseInt( aS );
1336 x = Integer.parseInt( xS );
1337 y = Integer.parseInt( yS );
1338
1339 frame.carteInMano[a] = frame.arrayCarte[x][y];
1340
1341 } catch ( Exception e ) {
1342 attivato = stringaTruccoSbagliato;
1343 }
1344 }
1345
1346 /* Mostra le carte del computer. */
1347 if ( trucco.equalsIgnoreCase( "Kill Devil Hill" ) ) {
1348
1349 attivato = stringaTruccoAttivato;
1350
1351 carteScoperte = true;
1352
1353 }
1354
1355 /* Scambia le carte con il computer. */
1356 if ( trucco.equalsIgnoreCase( "Darkside of Aquarius" ) ) {
1357
1358 attivato = stringaTruccoAttivato;
1359
1360 ImageIcon aux = null;
1361
1362 for ( int i = 0; i < 3; i++ ) {
1363
1364 aux = frame.carteInMano[i];
1365 frame.carteInMano[i] = frame.carteCPU[i];
1366 frame.carteCPU[i] = aux;
1367
1368 }
1369 }
1370
1371 /* Cambia il seme di briscola con uno a caso, senza dire quale.
1372 * L'ultima carta non cambia. È possibile comunque capire
1373 * qual'è la briscola dal menu ?->Briscola*/
1374 if ( trucco.equalsIgnoreCase( "Change of Heart" ) ) {
1375
1376 attivato = stringaTruccoAttivato;
1377
1378 semeBriscola = (int) ( Math.random() * 4 );
1379
1380 }
1381
1382 /* Asso Tre e Re di Briscola tutti in mano (anche in caso di doppioni). */
1383 if ( trucco.equalsIgnoreCase( "Tears of The Dragon" ) ) {
1384
1385 attivato = stringaTruccoAttivato;
1386
1387 frame.carteInMano[0] = frame.arrayCarte[9][semeBriscola];
1388 frame.carteInMano[1] = frame.arrayCarte[2][semeBriscola];
1389 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1390
1391 }
1392
1393 /* Tre assi di briscola. */
1394 if ( trucco.equalsIgnoreCase( "Navigate The Seas of The Sun" ) ) {
1395
1396 attivato = stringaTruccoAttivato;
1397
1398 frame.carteInMano[0] = frame.arrayCarte[0][semeBriscola];
1399 frame.carteInMano[1] = frame.arrayCarte[0][semeBriscola];
1400 frame.carteInMano[2] = frame.arrayCarte[0][semeBriscola];
1401
1402 }
1403
1404 /* Fa finire la partita al prossimo piglio. */
1405 if ( trucco.equalsIgnoreCase( "Omega" ) ) {
1406
1407 attivato = stringaTruccoAttivato;
1408
1409 mano = 19;
1410
1411 }
1412
1413 JOptionPane.showMessageDialog( frame, attivato, "JBriscola - " + version, JOptionPane.INFORMATION_MESSAGE );
1414 frame.pannello.repaint();
1415 frame.repaint();
1416
1417 }
1418
1419 /* Imposta le opzioni dell'utente cercando di leggerle dal file di configurazione. */
1420 public static void settaOpzioni() {
1421
1422 /* Impostazioni predefinite. */
1423 lang = "it";
1424 soundString = "suono=si";
1425 keysString = "tasti=si";
1426 int r = 0;
1427 int g = 150;
1428 int b = 0;
1429
1430 /* Cerca di leggere il file per impostare le opzioni. */
1431 Scanner scanner = null;
1432 File file = new File( "JBriscolaConfig.txt" );
1433 if ( file.exists() ) {
1434 try {
1435 scanner = new Scanner( file );
1436 } catch ( FileNotFoundException e ) { }
1437 try {
1438 lang = scanner.next();
1439 soundString = scanner.next();
1440 keysString = scanner.next();
1441 r = scanner.nextInt();
1442 g = scanner.nextInt();
1443 b = scanner.nextInt();
1444 } catch ( NoSuchElementException e ) { }
1445 }
1446
1447 /* Modifica le opzioni. */
1448 if ( lang.equals( "it" ) ) {
1449 semi[0] = "Bastoni";
1450 semi[1] = "Coppe";
1451 semi[2] = "Denari";
1452 semi[3] = "Spade";
1453 stringaBriscola = "Briscola";
1454 stringaBottonePrendi = "Prendi/Lascia carte";
1455 stringaPrimaGioca = "Prima Gioca!";
1456 stringaUltime4 = "Ultima carta - Occhio alla briscola!";
1457 stringaVinto = "Hai Vinto!";
1458 stringaPerso = "Hai Perso";
1459 stringaPareggio = "Pareggio";
1460 stringaGiocatore = "Giocatore: ";
1461 stringaComputer = "\nComputer: ";
1462 stringaNuovaPartita = "Nuova Partita";
1463 stringaNuovaPartitaAiTrenta = "Nuova Partita Ai 30";
1464 stringaVuoiDavveroIniziare = "Vuoi davvero iniziare una nuova partita?";
1465 stringaVuoiDavveroUscire = "Vuoi davvero uscire?";
1466 stringaSi = "Si";
1467 stringaNo = "No";
1468 stringaOpzioni = "Opzioni...";
1469 stringaEsci = "Esci";
1470 stringaImpossibileConfigurare = "Impossibile modificare il file di configurazione.\nSegnalare il bug a: sebastiano@luganega.org\n\nEccezione:\n";
1471 stringaLingua = "Lingua";
1472 stringaAnnulla = "Annulla";
1473 stringaIt = "Italiano";
1474 stringaLa = "Latino";
1475 stringaBL = "Dialetto Bellunese";
1476 stringaBV = "Dialetto Basso Veneto";
1477 stringaEN = "Inglese";
1478 stringaModificaOpzioni = "Modifica Opzioni";
1479 stringaInformazioni = "Informazioni";
1480 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";
1481 stringaSuono = "Effetti sonori";
1482 stringaPunteggio = "Punteggio";
1483 stringaSfondo = "Sfondo";
1484 stringaTasti = "Tasti rapidi";
1485 stringaAggiornamenti = "Cerca aggiornamenti";
1486 stringaTrucchi = "Trucchi";
1487 stringaInserisciCodice = "Inserisci il codice:";
1488 stringaTruccoAttivato = "Trucco attivato!";
1489 stringaTruccoSbagliato = "Trucco non valido";
1490 stringaCheCartaVuoi = "E allora che carta vuoi?";
1491 stringaAggiornamentiSi = "Aggiornamento disponibile: ";
1492 stringaAggiornamentiNo = "Nessun aggiornamento disponibile";
1493 stringaScarica = "E' possibile scaricare la versione più recente\ndal sito http://porkynator.altervista.org/programmi.html";
1494 stringaNoInternet = "Errore: nessuna connessione internet";
1495 stringaTasti2 = "1 Gioca la prima carta\n2 Gioca la seconda carta\n3 Gioca la terza carta\nF1 Visualizza questo messaggio\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1496 }
1497 else if ( lang.equals( "la" ) ) {
1498 semi[0] = "BACULI";
1499 semi[1] = "CALICES";
1500 semi[2] = "DENARII";
1501 semi[3] = "GLADII";
1502 stringaBriscola = "BRISCOLA";
1503 stringaBottonePrendi = "CAPIS/RELINQVIS CHARTAS";
1504 stringaPrimaGioca = "ANTE CHARTAM PONE!";
1505 stringaUltime4 = "CHARTA POSTREMA - INTVERE BRISCOLAM!";
1506 stringaVinto = "VICISTI!";
1507 stringaPerso = "PERDIDISTI";
1508 stringaPareggio = "AEQVATIO!";
1509 stringaGiocatore = "LVSOR: ";
1510 stringaComputer = "\nCOMPVTER: ";
1511 stringaNuovaPartita = "NOVA LVSO";
1512 stringaNuovaPartitaAiTrenta = "NOVA LVSO XXX";
1513 stringaVuoiDavveroIniziare = "NOVAM LVSIONEM INCIPERE?";
1514 stringaVuoiDavveroUscire = "EXIRE?";
1515 stringaSi = "ID VOLO";
1516 stringaNo = "NOLO";
1517 stringaOpzioni = "OPTIONES...";
1518 stringaEsci = "EXIRE";
1519 stringaImpossibileConfigurare = "CONFIGVRATIONIS FILE SCRIBERE NON POTVI.\nERROREM ME CERTIOREM FACITE: sebastiano@luganega.org\n\nEXCEPTIO:\n";
1520 stringaLingua = "LINGVA";
1521 stringaAnnulla = "ABROGA";
1522 stringaIt = "ITALICA";
1523 stringaLa = "LATINA";
1524 stringaBL = "BELLUNI";
1525 stringaBV = "VENETIAE";
1526 stringaEN = "ANGLICVS";
1527 stringaModificaOpzioni = "OPTIONES NOVARE";
1528 stringaInformazioni = "INFORMATIONES";
1529 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";
1530 stringaSuono = "SONVS";
1531 stringaPunteggio = "NVMERI";
1532 stringaSfondo = "COLOR";
1533 stringaTasti = "TASTI RAPIDI";
1534 stringaAggiornamenti = "VERSIONEM RECENTIOREM QVAERERE";
1535 stringaTrucchi = "CODICES";
1536 stringaInserisciCodice = "CODICEM INSCRIBE:";
1537 stringaTruccoAttivato = "CODEX INCIPIVIT!";
1538 stringaTruccoSbagliato = "ERROR CODICIS";
1539 stringaCheCartaVuoi = "QUAM CHARTAM VOLIS?";
1540 stringaNoInternet = "ERROR: INTERNETIS CONIVCTIO NON EST";
1541 stringaAggiornamentiSi = "VERSIO RECENTIOR EST: ";
1542 stringaAggiornamentiNo = "VERSIO RECENTIOR NON EST";
1543 stringaScarica = "VERSIONEM RECENTIOREM CEPTA ESSE POTEST:\nhttp://porkynator.altervista.org/programmi.html";
1544 stringaTasti2 = "1 PONE CHARTAM PRIMAM\n2 PONE CHARTAM SECUNDAM\n3 PONE CHARTAM TERTIAM\nF1 HEAC INFORMATIONES\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1545 }
1546 if ( lang.equals( "bl" ) ) {
1547 semi[0] = "Bastoi";
1548 semi[1] = "Coppe";
1549 semi[2] = "Danari";
1550 semi[3] = "Spade";
1551 stringaBriscola = "Briscola";
1552 stringaBottonePrendi = "Cio' su/lasa le carte";
1553 stringaPrimaGioca = "Prima Duga!";
1554 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1555 stringaVinto = "Te ha vint!";
1556 stringaPerso = "Te ha pers";
1557 stringaPareggio = "Pari";
1558 stringaGiocatore = "Dugador: ";
1559 stringaComputer = "\nComputer: ";
1560 stringaNuovaPartita = "Taca n'altra partida";
1561 stringaNuovaPartitaAiTrenta = "Taca na partida ai 30";
1562 stringaVuoiDavveroIniziare = "Utu sul serio scuminziar n'altra partida?";
1563 stringaVuoiDavveroUscire = "Utu sul serio stusar su?";
1564 stringaSi = "Si";
1565 stringaNo = "No";
1566 stringaOpzioni = "Opzioni...";
1567 stringaEsci = "Stusa su";
1568 stringaImpossibileConfigurare = "No ghe ho riva' a scrivere al file de configurazion.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1569 stringaLingua = "Lengua";
1570 stringaAnnulla = "Annulla";
1571 stringaIt = "Italian";
1572 stringaLa = "Latin";
1573 stringaBL = "Dialeto de Belun";
1574 stringaBV = "Dialeto de la basa";
1575 stringaEN = "Inglese";
1576 stringaModificaOpzioni = "Modifica Opzioni";
1577 stringaInformazioni = "Informazioni";
1578 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";
1579 stringaSuono = "Efeti sonori";
1580 stringaPunteggio = "Varda i punti";
1581 stringaSfondo = "Sfondo";
1582 stringaTasti = "Tasti rapidi";
1583 stringaAggiornamenti = "Varda se ghe ne' na version pi nova";
1584 stringaTrucchi = "Truchi";
1585 stringaInserisciCodice = "Scrivi al codice:";
1586 stringaTruccoAttivato = "Truco ativa'!";
1587 stringaTruccoSbagliato = "Truco sbaia'";
1588 stringaCheCartaVuoi = "Che carta utu alora?";
1589 stringaAggiornamentiSi = "Ghe ne' na version pi nova: ";
1590 stringaAggiornamentiNo = "No ghe ne na version pi nova";
1591 stringaScarica = "Te pol scaricar le version pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1592 stringaNoInternet = "Erore: no te se su internet";
1593 stringaTasti2 = "1 Duga la prima carta\n2 Duga la seconda carta\n3 Duga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1594 }
1595 if ( lang.equals( "bv" ) ) {
1596 semi[0] = "Bastoni";
1597 semi[1] = "Coppe";
1598 semi[2] = "Danari";
1599 semi[3] = "Spade";
1600 stringaBriscola = "Briscola";
1601 stringaBottonePrendi = "Ciapa su/lasa e carte";
1602 stringaPrimaGioca = "Prima Zuga!";
1603 stringaUltime4 = "Ultima carta - Ocio a la briscola!";
1604 stringaVinto = "Ti ga vinto!";
1605 stringaPerso = "Ti ga perso";
1606 stringaPareggio = "Pari";
1607 stringaGiocatore = "Zugador: ";
1608 stringaComputer = "\nComputer: ";
1609 stringaNuovaPartita = "N'altra Partida";
1610 stringaNuovaPartitaAiTrenta = "Na Partida ai 30";
1611 stringaVuoiDavveroIniziare = "Ti vol sul serio scuminziar n'altra partida?";
1612 stringaVuoiDavveroUscire = "Ti vol sul serio stusar su?";
1613 stringaSi = "Si";
1614 stringaNo = "No";
1615 stringaOpzioni = "Opzioni...";
1616 stringaEsci = "Stusa su";
1617 stringaImpossibileConfigurare = "No ghe son riusito a scrivere al file de configurazione.\nMandeme na mail a: sebastiano@luganega.org\n\nEcezion:\n";
1618 stringaLingua = "Lengua";
1619 stringaAnnulla = "Annulla";
1620 stringaIt = "Italian";
1621 stringaLa = "Latin";
1622 stringaBL = "Dialeto Belumat";
1623 stringaBV = "Dialeto Veneto";
1624 stringaEN = "Inglese";
1625 stringaModificaOpzioni = "Modifica Opzioni";
1626 stringaInformazioni = "Informasioni";
1627 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";
1628 stringaSuono = "Efeti sonori";
1629 stringaPunteggio = "Varda i punti";
1630 stringaSfondo = "Sfondo";
1631 stringaTasti = "Tasti rapidi";
1632 stringaAggiornamenti = "Varda se ghe xe na versione pi nova";
1633 stringaTrucchi = "Truchi";
1634 stringaInserisciCodice = "Scrivi al codice:";
1635 stringaTruccoAttivato = "Truco ativa'!";
1636 stringaTruccoSbagliato = "Truco sbaia'";
1637 stringaCheCartaVuoi = "Che carta utu alora?";
1638 stringaAggiornamentiSi = "Ghe xe na versione pi nova: ";
1639 stringaAggiornamentiNo = "No ghe xe na versione pi nova";
1640 stringaScarica = "Te pol scaricar le versione pi nova\ndal sito http://porkynator.altervista.org/programmi.html";
1641 stringaNoInternet = "Erore: no ti xe su internet";
1642 stringaTasti2 = "1 Zuga la prima carta\n2 Zuga la seconda carta\n3 Zuga la terza carta\nF1 Tasti rapidi\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1643 }
1644 if ( lang.equals( "en" ) ) {
1645 semi[0] = "Sticks";
1646 semi[1] = "Cups";
1647 semi[2] = "Golds";
1648 semi[3] = "Swords";
1649 stringaBriscola = "Briscola";
1650 stringaBottonePrendi = "Take/leave cards";
1651 stringaPrimaGioca = "Play your card before!";
1652 stringaUltime4 = "Last card - keep your eye on the briscola!";
1653 stringaVinto = "You won!";
1654 stringaPerso = "You lost";
1655 stringaPareggio = "Sixty - sixty!";
1656 stringaGiocatore = "Palyer: ";
1657 stringaComputer = "\nComputer: ";
1658 stringaNuovaPartita = "New Game";
1659 stringaNuovaPartitaAiTrenta = "New Game - 30 Points";
1660 stringaVuoiDavveroIniziare = "Do you really want to start a new game?";
1661 stringaVuoiDavveroUscire = "Do you really want to exit?";
1662 stringaSi = "Yes";
1663 stringaNo = "No";
1664 stringaOpzioni = "Options...";
1665 stringaEsci = "Exit";
1666 stringaImpossibileConfigurare = "Couldn't write to the configuration file.\nPlease report the bug to: sebastiano@luganega.org\n\nException:\n";
1667 stringaLingua = "Lang";
1668 stringaAnnulla = "Cancel";
1669 stringaIt = "Italian";
1670 stringaLa = "Latin";
1671 stringaBL = "Belluno dialect";
1672 stringaBV = "Venice dialect";
1673 stringaEN = "English";
1674 stringaModificaOpzioni = "Change options";
1675 stringaInformazioni = "Information";
1676 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";
1677 stringaSuono = "Sound";
1678 stringaPunteggio = "Score";
1679 stringaSfondo = "Background";
1680 stringaTasti = "Hot keys";
1681 stringaAggiornamenti = "Check updates";
1682 stringaTrucchi = "Cheats";
1683 stringaInserisciCodice = "Insert cheat:";
1684 stringaTruccoAttivato = "Cheat actived!";
1685 stringaTruccoSbagliato = "Wrong cheat";
1686 stringaCheCartaVuoi = "So what card do you want?";
1687 stringaAggiornamentiSi = "Update available: ";
1688 stringaAggiornamentiNo = "No updates available";
1689 stringaScarica = "You can get the latest version from the site\nhttp://porkynator.altervista.org/programmi.html";
1690 stringaNoInternet = "Error: no internet connection";
1691 stringaTasti2 = "1 Play the first card\n2 Play the second card\n3 Play the third card\nF1 Get this message\nF2 " + stringaNuovaPartita + "\nF3 " + stringaOpzioni + "\nF4 " + stringaPunteggio + "\nF5 " + stringaInformazioni + "\nF6 " + stringaAggiornamenti + "\nF7 " + stringaNuovaPartitaAiTrenta + "\nF8 " + stringaTrucchi + "\nq " + stringaEsci;
1692 }
1693 sound = ( soundString.equals( "suono=si" ) );
1694 keys = ( keysString.equals( "tasti=si" ) );
1695 color = new Color( r, g, b );
1696 if ( frame != null ) {
1697 frame.pannello.repaint();
1698 frame.pannello2.repaint();
1699 frame.repaint();
1700 }
1701 }
1702}
diff --git a/JBriscola/all_versions/0.3/0.3/src/OptionFrame.java b/JBriscola/all_versions/0.3/0.3/src/OptionFrame.java
new file mode 100755
index 0000000..d89745b
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/OptionFrame.java
@@ -0,0 +1,169 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public 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.3/0.3/src/Pannello.java b/JBriscola/all_versions/0.3/0.3/src/Pannello.java
new file mode 100755
index 0000000..ca9e9c6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/Pannello.java
@@ -0,0 +1,88 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This 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
22import javax.swing.*;
23import java.awt.*;
24
25/* Questa classe dispone semplicemente le carte
26 * sulla finestra e imposta la sfondo. */
27public class Pannello extends JPanel {
28
29 public static Main main;
30
31 public static Color color;
32
33 public Pannello() { }
34
35 public void paint( Graphics g ) {
36
37 super.paint( g );
38
39 setBackground( main.color );
40
41 if ( main.frame.ultimaCarta != null )
42 main.frame.ultimaCarta.paintIcon( this, g, 50, 180 );
43
44 if ( main.frame.mazzo )
45 main.frame.retro2.paintIcon( this, g, 17, 256 );
46
47 if ( main.carteScoperte ) {
48
49 if ( main.frame.carteCPU[0] != null )
50 main.frame.carteCPU[0].paintIcon( this, g, 230, 5 );
51
52 if ( main.frame.carteCPU[1] != null )
53 main.frame.carteCPU[1].paintIcon( this, g, 300, 5 );
54
55 if ( main.frame.carteCPU[2] != null )
56 main.frame.carteCPU[2].paintIcon( this, g, 370, 5 );
57
58 } else {
59
60 if ( main.frame.carteCPU[0] != null )
61 main.frame.retro1.paintIcon( this, g, 230, 5 );
62
63 if ( main.frame.carteCPU[1] != null )
64 main.frame.retro1.paintIcon( this, g, 300, 5 );
65
66 if ( main.frame.carteCPU[2] != null )
67 main.frame.retro1.paintIcon( this, g, 370, 5 );
68
69 }
70
71 if ( main.frame.carteInMano[0] != null )
72 main.frame.carteInMano[0].paintIcon( this, g, 230, 340 );
73
74 if ( main.frame.carteInMano[1] != null )
75 main.frame.carteInMano[1].paintIcon( this, g, 300, 340 );
76
77 if ( main.frame.carteInMano[2] != null )
78 main.frame.carteInMano[2].paintIcon( this, g, 370, 340 );
79
80 if ( main.frame.giocata[0] != null )
81 main.frame.giocata[0].paintIcon( this, g, 250, 200 );
82
83 if ( main.frame.giocata[1] != null )
84 main.frame.giocata[1].paintIcon( this, g, 325, 150 );
85
86 }
87}
88
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/1-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/1-1.jpg
new file mode 100755
index 0000000..ae43510
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/1-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/1-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/1-2.jpg
new file mode 100755
index 0000000..3f7c75a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/1-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/1-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/1-3.jpg
new file mode 100755
index 0000000..9e1ead7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/1-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/1-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/1-4.jpg
new file mode 100755
index 0000000..710f879
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/1-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/10-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/10-1.jpg
new file mode 100755
index 0000000..9aba45a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/10-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/10-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/10-2.jpg
new file mode 100755
index 0000000..037eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/10-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/10-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/10-3.jpg
new file mode 100755
index 0000000..8780b72
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/10-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/10-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/10-4.jpg
new file mode 100755
index 0000000..587dc0f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/10-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/2-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/2-1.jpg
new file mode 100755
index 0000000..5dcb7db
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/2-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/2-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/2-2.jpg
new file mode 100755
index 0000000..ea9eeb7
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/2-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/2-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/2-3.jpg
new file mode 100755
index 0000000..8cb22dd
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/2-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/2-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/2-4.jpg
new file mode 100755
index 0000000..b3e7898
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/2-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/3-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/3-1.jpg
new file mode 100755
index 0000000..dcb435c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/3-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/3-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/3-2.jpg
new file mode 100755
index 0000000..1e5b6ec
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/3-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/3-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/3-3.jpg
new file mode 100755
index 0000000..9202cfe
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/3-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/3-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/3-4.jpg
new file mode 100755
index 0000000..5436a8d
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/3-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/4-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/4-1.jpg
new file mode 100755
index 0000000..3bab6d5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/4-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/4-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/4-2.jpg
new file mode 100755
index 0000000..b4901a6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/4-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/4-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/4-3.jpg
new file mode 100755
index 0000000..d754ad8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/4-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/4-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/4-4.jpg
new file mode 100755
index 0000000..3a54b96
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/4-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/5-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/5-1.jpg
new file mode 100755
index 0000000..3f7ba1f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/5-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/5-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/5-2.jpg
new file mode 100755
index 0000000..fcacb75
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/5-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/5-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/5-3.jpg
new file mode 100755
index 0000000..ce32f9f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/5-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/5-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/5-4.jpg
new file mode 100755
index 0000000..b86b09a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/5-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/6-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/6-1.jpg
new file mode 100755
index 0000000..f90cd81
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/6-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/6-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/6-2.jpg
new file mode 100755
index 0000000..cf2a67a
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/6-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/6-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/6-3.jpg
new file mode 100755
index 0000000..2cd2fe2
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/6-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/6-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/6-4.jpg
new file mode 100755
index 0000000..73f410f
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/6-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/7-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/7-1.jpg
new file mode 100755
index 0000000..08cd397
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/7-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/7-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/7-2.jpg
new file mode 100755
index 0000000..a168ff8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/7-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/7-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/7-3.jpg
new file mode 100755
index 0000000..5cda411
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/7-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/7-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/7-4.jpg
new file mode 100755
index 0000000..5d63229
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/7-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/8-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/8-1.jpg
new file mode 100755
index 0000000..a6faa7b
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/8-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/8-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/8-2.jpg
new file mode 100755
index 0000000..0d9edbb
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/8-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/8-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/8-3.jpg
new file mode 100755
index 0000000..91f8354
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/8-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/8-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/8-4.jpg
new file mode 100755
index 0000000..cc0089c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/8-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/9-1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/9-1.jpg
new file mode 100755
index 0000000..be9c6bf
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/9-1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/9-2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/9-2.jpg
new file mode 100755
index 0000000..e25da4c
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/9-2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/9-3.jpg b/JBriscola/all_versions/0.3/0.3/src/img/9-3.jpg
new file mode 100755
index 0000000..cd384f8
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/9-3.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/9-4.jpg b/JBriscola/all_versions/0.3/0.3/src/img/9-4.jpg
new file mode 100755
index 0000000..441210e
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/9-4.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/Thumbs.db b/JBriscola/all_versions/0.3/0.3/src/img/Thumbs.db
new file mode 100755
index 0000000..d9b6bc5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/Thumbs.db
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/carte.jpg b/JBriscola/all_versions/0.3/0.3/src/img/carte.jpg
new file mode 100755
index 0000000..838ffac
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/carte.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/retro1.jpg b/JBriscola/all_versions/0.3/0.3/src/img/retro1.jpg
new file mode 100755
index 0000000..9651b06
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/retro1.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/img/retro2.jpg b/JBriscola/all_versions/0.3/0.3/src/img/retro2.jpg
new file mode 100755
index 0000000..c5d3925
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/img/retro2.jpg
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/0.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/0.wav
new file mode 100755
index 0000000..67d9abd
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/0.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/1.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/1.wav
new file mode 100755
index 0000000..9357c97
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/1.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/2.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/2.wav
new file mode 100755
index 0000000..92b1541
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/2.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/3.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/3.wav
new file mode 100755
index 0000000..45a6e42
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/3.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/4.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/4.wav
new file mode 100755
index 0000000..1f7ec90
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/4.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/5.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/5.wav
new file mode 100755
index 0000000..3627f96
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/5.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/pareggio.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/pareggio.wav
new file mode 100755
index 0000000..ff978e6
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/pareggio.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/perso.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/perso.wav
new file mode 100755
index 0000000..a454ba4
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/perso.wav
Binary files differ
diff --git a/JBriscola/all_versions/0.3/0.3/src/sounds/vinto.wav b/JBriscola/all_versions/0.3/0.3/src/sounds/vinto.wav
new file mode 100755
index 0000000..a6f3ac5
--- /dev/null
+++ b/JBriscola/all_versions/0.3/0.3/src/sounds/vinto.wav
Binary files differ
diff --git a/JBriscola/trucchi.txt b/JBriscola/trucchi.txt
new file mode 100644
index 0000000..c2974e0
--- /dev/null
+++ b/JBriscola/trucchi.txt
@@ -0,0 +1,18 @@
1Tutti i trucchi vanno inseriti (dal menu file->trucchi) senza virgolette e con gli spazi. Il programma non distingue tra lettere maiuscole e minuscole.
2
3"Kill Devil Hill" - La CPU gioca a carte scoperte
4
5"Darkside of Aquarius" - Scambia le proprie carte con quelle della CPU
6
7"Change of Heart" - Cambia il seme di briscola con uno a caso, senza dire quale. L'ultima carta non cambia. È possibile comunque capire qual'è la briscola dal menu ?->Briscola
8
9"Tears of The Dragon" - Asso Tre e Re di Briscola tutti in mano (anche in caso di doppioni).
10
11"Navigate The Seas of The Sun" - Tre assi di briscola in mano
12
13"Omega" - Fa finire la partita al prossimo piglio
14
15P.S.: Sì, sono tutti titoli di canzoni di Bruce Dickinson.
16P.P.S.: Se c'è qualche trucco che vi picerebbe avere, chiedete pure, e vedrò di implementarlo nella prossima versione :)
17
18per contattarmi: <i>sebastiano@luganega.org</i> \ No newline at end of file
diff --git a/PagaLavoro/PagaLavoro.bat b/PagaLavoro/PagaLavoro.bat
new file mode 100755
index 0000000..862e220
--- /dev/null
+++ b/PagaLavoro/PagaLavoro.bat
@@ -0,0 +1 @@
java PagaLavoro
diff --git a/PagaLavoro/PagaLavoro.class b/PagaLavoro/PagaLavoro.class
new file mode 100755
index 0000000..c91b61c
--- /dev/null
+++ b/PagaLavoro/PagaLavoro.class
Binary files differ
diff --git a/PagaLavoro/PagaLavoro.java b/PagaLavoro/PagaLavoro.java
new file mode 100755
index 0000000..726d356
--- /dev/null
+++ b/PagaLavoro/PagaLavoro.java
@@ -0,0 +1,55 @@
1/******Programma per calcolare i soldini che ti devono dare******/
2/******quei rompiscatole dei tuoi superiori a fine giornata******/
3/************************Tecnoteam Zonto*************************/
4
5/*cazzate iniziali...*/
6import java.util.Scanner;
7class PagaLavoro {
8 public static void main (String args[]) {
9
10 /*inizializziamo lo "scanner", per l'input di dati*/
11 Scanner in = new Scanner(System.in);
12
13 /*richiediamo i dati*/
14 System.out.println ("Lavoratore: ");
15 String nome = in.nextLine();
16 System.out.println ("Data (gg/mm/aaaa): ");
17 String data = in.nextLine();
18 System.out.println ("Paga (€/Ora): ");
19 double pagaOra = in.nextDouble();
20 System.out.println ("Ore di lavoro (numero intero): ");
21 int oreLavoro = in.nextInt();
22 System.out.println ("Minuti di lavoro (numero intero): ");
23 int minutiLavoro = in.nextInt();
24
25 /*Scriviamo il resoconto, con tanto di calcolo ipergalattico per l'approssimazione dal centesimo*/
26 System.out.println ("Il giorno " + data + ", " + nome + " ha lavorato " + oreLavoro + ":" + minutiLavoro + " ore, guadagnando " + (((double)((int)((pagaOra * oreLavoro + pagaOra / 60 * minutiLavoro)*100+0.5)))/100) + " €");
27
28 /*il try serve in caso di errore*/
29 try {
30 /*scriviamo un file .txt con il resoconto*/
31 FileOutputStream file = new FileOutputStream("Resoconto_lavoro_" + nome + ".txt");
32 PrintStream Output = new PrintStream(file);
33 Output.println ("***************************************");
34 Output.println ("**************Paga-Lavoro**************");
35 Output.println ("***************************************");
36 Output.println ("************Tecnoteam Zonto************");
37 Output.println ("***************************************");
38 Output.println ();
39 Output.println ("Resoconto del lavoro di " + nome);
40 Output.println ("Data: " + data);
41 Output.println ("Tempo di lavoro: " + oreLavoro + ":" + minutiLavoro + " ore");
42 Output.println ("Paga per ora: " + pagaOra + " €");
43 Output.println ("Paga totale: " + (((double)((int)((pagaOra * oreLavoro + pagaOra / 60 * minutiLavoro)*100+0.5)))/100) + " €");
44 Output.println ();
45 Output.println ("Resoconto giornaliero: ");
46 Output.println ("Il giorno " + data + ", " + nome + " ha lavorato " + oreLavoro + ":" + minutiLavoro + " ore, guadagnando " + (((double)((int)((pagaOra * oreLavoro + pagaOra / 60 * minutiLavoro)*100+0.5)))/100) + " €");
47
48 /*anche il catch serve in caso di errore*/
49 } catch (IOException e) {
50 System.out.println("Errore: " + e);
51 System.exit(1);
52 }
53
54 }
55}
diff --git a/PagaLavoro/PagaLavoro.sh b/PagaLavoro/PagaLavoro.sh
new file mode 100755
index 0000000..862e220
--- /dev/null
+++ b/PagaLavoro/PagaLavoro.sh
@@ -0,0 +1 @@
java PagaLavoro
diff --git a/PagaLavoro/Readme.txt b/PagaLavoro/Readme.txt
new file mode 100755
index 0000000..1b3a8a3
--- /dev/null
+++ b/PagaLavoro/Readme.txt
@@ -0,0 +1,2 @@
1Il vostro capo vi fa sgobbare e vi obbliga anche a farvi i conti della paga? se lavorate part-time potete usare questo comodo programma che calcolerà per voi quanti soldi vi spettano!
2Se usate windows aprite il file PagaLavoro.BAT, se usate linux PagaLavoro.sh \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..daab5e9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
1# Some of my earliest programs (2006-2010)
2
3In this repository you can find some of my earliest programs.
4All of them are written in Java - although I had previously written some
5[DarkBASIC](https://en.wikipedia.org/wiki/The_Game_Creators#DarkBASIC)
6code, I could not find the sources in my backup folders.
7
8For some of the programs you can find multiple versions of the source
9code, in separate folders. I did not use a version control system at
10the time. Binaries (`.class` files) are also in provided in this repo.
11
12If you want to check them out, do start from JBriscola,
13which is actually fun to play. It is an single-player game of
14[briscola](https://en.wikipedia.org/wiki/Briscola) with a decent AI
15and some fun extras (you can turn the sound effects off if you find
16them annoying).
17
18The code, comments and the readme files are all in Italian.
19
20## JBriscola
21
22A single-player game of
23[briscola](https://en.wikipedia.org/wiki/Briscola) with a decent AI.
24It supports the classic variant as well as 30-points games.
25
26Available in 5 languages (Italian, English, Latin,
27[Northern-Venetian](https://en.wikipedia.org/wiki/Venetian_language#Regional_variants)
28and Central-Venetian). Keyboard shortcuts, persistent settings,
29sound effects, you name it. And cheat codes too!
30
31## GiocoUno
32
33My first "game" (*GiocoUno* translates to *GameOne*), made with
34[Swing](https://en.wikipedia.org/wiki/Swing_(Java))
35`JOptionPane`s. Honestly it's pretty bad. It is only notable because
36it is my first GUI application, and possible the earliest piece of code
37of mine that I have not lost.
38
39## Robottino
40
41A more complex GUI application with a menu bar,
42images and animations. You can give commands to a
43[robot](https://en.wikipedia.org/wiki/Bender_(Futurama)) and change its
44position. This was the most complex application I wrote before JBriscola.
45
46## PagaLavoro
47
48Very simple wage calculator. I used this when helping my dad preparing firewood for the winter.
49But don't worry, I did not start doing lumberjack work when I was 12.
50
51I started when I was 6.
52
53## pbfi
54
55A [brainfuck](https://en.wikipedia.org/wiki/Brainfuck) interpreter.
56
57## SlackYouInterpreter
58
59An interpreter for an esoteric programming language inspirid by brainfuck.
60The syntax is explained in the README.txt.
diff --git a/SlackYouInterpreter/README.txt b/SlackYouInterpreter/README.txt
new file mode 100755
index 0000000..2585bf8
--- /dev/null
+++ b/SlackYouInterpreter/README.txt
@@ -0,0 +1,29 @@
1SlackYou è un linguaggio di programmazione esoterico, ispirato al famoso BrainFuck, ma con molte funzionalità in più.
2Innanzitutto in SlackYou l'array di byte è bidimensionale.
3Il linguaggio è case-sensitive. Ogni carattere che non è valido come comando può essere usato come commento,
4inclusi i caratteri-comando scritti in maiuscolo. Tutti gli altri comandi sono spiegati nella lista seguente:
5
6. Incrementa di 1 il byte al puntatore. Corrisponde al + in BF.
7, Decrementa di 1 il byte al puntatore. Corrisponde al - in BF.
8> Incrementa il puntatore orizzontale, come in BF.
9< Decrementa il puntatore orizzontale, come in BF.
10v Incrementa il puntatore verticale.
11^ Decrementa il puntatore verticale.
12+ Somma il byte al puntatore con il byte alla sua destra. Il risultato viene memorizzato nel byte al puntatore.
13- Come sopra, ma sottrae.
14* Come sopra, ma moltiplica.
15/ Come sopra, ma esegue una divisione euclidea (senza virgola e senza resto).
16% Come sopra, ma esegue l'operatore modulo (restituisce il resto della divisione euclidea).
17j Copia il byte al puntatore nel byte a destra e incrementa il puntatore orizzontale.
18g Copia il byte al puntatore nel byte a sinistra e decrementa il puntatore orizzontale.
19y Copia il byte al puntatore nel byte sopra e decrementa il puntatore verticale.
20h Copia il byte al puntatore nel byte sotto e incrementa il puntatore verticale.
21=xy Se x e y sono cifre esadecimali (da '0' a '9' e da 'a' a 'f') il byte al puntatore assume il valore esadecimale xy.
22r Memorizza nel byte al puntatore il codice ASCII del carattere digitato in input.
23w Scrive in output il byte al puntatore tradotto in carattere ASCII.
24? Se il byte al puntatore è 0, salta avanti fino all'istruzione dopo il corrispondente comando ; o :.
25! Se il byte al puntatore non è 0, salta avanti fino all'istruzione dopo il corrispondente comando : o ;.
26; Se il byte al puntatore non è 0, salta indietro fino all'istruzione dopo il corrispondente comando ? o !.
27: Se il byte al puntatore è 0, salta indietro fino all'istruzione dopo il corrispondedente comando ! o ?.
28
29Nella cartella src trovate alcuni esempi di programmi in questo linguaggio. \ No newline at end of file
diff --git a/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Frame.java b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Frame.java
new file mode 100755
index 0000000..c163980
--- /dev/null
+++ b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Frame.java
@@ -0,0 +1,209 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of SlackYouInterpreter.
5
6 SlackYouInterpreter 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 SlackYouInterpreter 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 SlackYouInterpreter; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.BorderLayout;
24import java.awt.event.*;
25import java.io.*;
26
27public class Frame extends JFrame {
28 public static int valoreChooser;
29 public static boolean firstSave;
30 public static String defaultSave;
31 public static Main main;
32 public static JTextArea textArea;
33 public static JButton runButton;
34 public static JMenuBar bar;
35 public static JMenu menuFile, menuAiuto;
36 public static JMenuItem esci, esegui, salva, salvaConNome, apri, info;
37 public static JFileChooser chooser;
38 public static FileInputStream in;
39 public static FileOutputStream out;
40 public Frame() {
41 super( "Porky's SlackYouInterpreter - v1.1" );
42 firstSave = true;
43 main = new Main();
44 defaultSave = "";
45 chooser = new JFileChooser();
46 textArea = new JTextArea( "Digitare qui il codice SlackYou", 15, 15 );
47 bar = new JMenuBar();
48 menuFile = new JMenu( "File" );
49 menuAiuto = new JMenu( "?" );
50 esci = new JMenuItem( "Esci" );
51 esegui = new JMenuItem( "Esegui" );
52 salva = new JMenuItem( "Salva" );
53 salvaConNome = new JMenuItem( "Salva con nome" );
54 apri = new JMenuItem( "Apri" );
55 info = new JMenuItem( "Aiuto" );
56 menuFile.setMnemonic( 'F' );
57 menuAiuto.setMnemonic( '?' );
58 esci.setMnemonic( 'E' );
59 esegui.setMnemonic( 's' );
60 salva.setMnemonic( 'a' );
61 salvaConNome.setMnemonic( 'n' );
62 apri.setMnemonic( 'p' );
63 info.setMnemonic( 'i' );
64 esci.addActionListener(
65 new ActionListener() {
66 public void actionPerformed ( ActionEvent e ) {
67 System.exit( 0 );
68 }
69 }
70 );
71 esegui.addActionListener(
72 new ActionListener() {
73 public void actionPerformed ( ActionEvent e ) {
74 main.run( textArea.getText() );
75 }
76 }
77 );
78 salva.addActionListener(
79 new ActionListener() {
80 public void actionPerformed ( ActionEvent e ) {
81 if ( firstSave ) {
82 valoreChooser = chooser.showSaveDialog( Frame.this );
83 switch ( valoreChooser ) {
84 case JFileChooser.APPROVE_OPTION:
85 try {
86 out = new FileOutputStream( chooser.getSelectedFile().getPath() );
87 defaultSave = chooser.getSelectedFile().getPath();
88 char caratteri[];
89 byte bytes[];
90 caratteri = textArea.getText().toCharArray();
91 bytes = new byte[caratteri.length];
92 for ( int i = 0; i < caratteri.length; i++ )
93 bytes[i] = ( byte ) caratteri[i];
94 out.write( bytes );
95 } catch ( Exception ex ) {
96 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
97 }
98 break;
99 case JFileChooser.ERROR_OPTION:
100 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
101 break;
102 //case JFileChooser.CANCEL_OPTION:
103 }
104 firstSave = false;
105 } else {
106 try {
107 out = new FileOutputStream( defaultSave );
108 char caratteri[];
109 byte bytes[];
110 caratteri = textArea.getText().toCharArray();
111 bytes = new byte[caratteri.length];
112 for ( int i = 0; i < caratteri.length; i++ )
113 bytes[i] = ( byte ) caratteri[i];
114 out.write( bytes );
115 } catch ( Exception ex ) {
116 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
117 }
118 }
119 }
120 }
121 );
122 salvaConNome.addActionListener(
123 new ActionListener() {
124 public void actionPerformed ( ActionEvent e ) {
125 valoreChooser = chooser.showSaveDialog( Frame.this );
126 switch ( valoreChooser ) {
127 case JFileChooser.APPROVE_OPTION:
128 try {
129 out = new FileOutputStream( chooser.getSelectedFile().getPath() );
130 defaultSave = chooser.getSelectedFile().getPath();
131 char caratteri[];
132 byte bytes[];
133 caratteri = textArea.getText().toCharArray();
134 bytes = new byte[caratteri.length];
135 for ( int i = 0; i < caratteri.length; i++ )
136 bytes[i] = ( byte ) caratteri[i];
137 out.write( bytes );
138 } catch ( Exception ex ) {
139 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
140 }
141 break;
142 case JFileChooser.ERROR_OPTION:
143 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
144 break;
145 //case JFileChooser.CANCEL_OPTION:
146 }
147 firstSave = false;
148 }
149 }
150 );
151 apri.addActionListener(
152 new ActionListener() {
153 public void actionPerformed ( ActionEvent e ) {
154 valoreChooser = chooser.showOpenDialog( Frame.this );
155 switch ( valoreChooser ) {
156 case JFileChooser.APPROVE_OPTION:
157 try {
158 String stringa;
159 byte bytes[];
160 char caratteri[];
161 in = new FileInputStream( chooser.getSelectedFile().getPath() );
162 bytes = new byte[in.available()];
163 caratteri = new char[in.available()];
164 in.read( bytes );
165 for ( int i = 0; i < bytes.length; i++ )
166 caratteri[i] = ( char ) bytes[i];
167 stringa = new String( caratteri );
168 textArea.setText( stringa );
169 } catch ( Exception ex ) {
170 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
171 }
172 break;
173 case JFileChooser.ERROR_OPTION:
174 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "SlackYou - Errore", JOptionPane.ERROR_MESSAGE );
175 break;
176 //case JFileChooser.CANCEL_OPTION:
177 }
178 }
179 }
180 );
181 info.addActionListener(
182 new ActionListener() {
183 public void actionPerformed ( ActionEvent e ) {
184 JOptionPane.showMessageDialog( Frame.this, "SlackYou è un linguaggio di programmazione esoterico,\n ispirato al famoso BrainFuck, ma con molte funzionalità in più.\nInnanzitutto in SlackYou l'array di byte è bidimensionale.\nIl linguaggio è case-sensitive. Ogni carattere che non è valido\ncome comando può essere usato come commento,\ninclusi i caratteri-comando scritti in maiuscolo.\nTutti gli altri comandi sono spiegati nella lista seguente:\n\n. Incrementa di 1 il byte al puntatore. Corrisponde al + in BF.\n, Decrementa di 1 il byte al puntatore. Corrisponde al - in BF.\n> Incrementa il puntatore orizzontale, come in BF.\n< Decrementa il puntatore orizzontale, come in BF.\nv Incrementa il puntatore verticale.\n^ Decrementa il puntatore verticale.\n+ Somma il byte al puntatore con il byte alla sua destra. Il risultato viene memorizzato nel byte al puntatore.\n- Come sopra, ma sottrae.\n* Come sopra, ma moltiplica.\n/ Come sopra, ma esegue una divisione euclidea (senza virgola e senza resto).\n% Come sopra, ma esegue l'operatore modulo (restituisce il resto della divisione euclidea).\nj Copia il byte al puntatore nel byte a destra e incrementa il puntatore orizzontale.\ng Copia il byte al puntatore nel byte a sinistra e decrementa il puntatore orizzontale.\ny Copia il byte al puntatore nel byte sopra e decrementa il puntatore verticale.\nh Copia il byte al puntatore nel byte sotto e incrementa il puntatore verticale.\n=xy Se x e y sono cifre esadecimali (da '0' a '9' e da 'a' a 'f') il byte al puntatore assume il valore esadecimale xy.\nr Memorizza nel byte al puntatore il codice ASCII del carattere digitato in input.\nw Scrive in output il byte al puntatore tradotto in carattere ASCII.\n? Se il byte al puntatore è 0, salta avanti fino all'istruzione dopo il corrispondente comando ; o :.\n! Se il byte al puntatore non è 0, salta avanti fino all'istruzione dopo il corrispondente comando : o ;.\n; Se il byte al puntatore non è 0, salta indietro fino all'istruzione dopo il corrispondente comando ? o !.\n: Se il byte al puntatore è 0, salta indietro fino all'istruzione dopo il corrispondente comando ! o ?.\n\nNella cartella src trovate un esempio di Hello World in questo linguaggio.\n\nPer maggiori informazioni visitate la pagina:\nhttp://porkynator.altervista.org/SlackYou.html\no contattatemi al mio indirizzo e-mail:\nsebastiano@luganega.org", "SlackYou - informazioni", JOptionPane.INFORMATION_MESSAGE );
185 }
186 }
187 );
188 menuFile.add( esegui );
189 menuFile.add( salva );
190 menuFile.add( salvaConNome );
191 menuFile.add( apri );
192 menuFile.add( esci );
193 menuAiuto.add( info );
194 bar.add( menuFile );
195 bar.add( menuAiuto );
196 runButton = new JButton( "Esegui" );
197 runButton.addActionListener(
198 new ActionListener() {
199 public void actionPerformed( ActionEvent e ) {
200 main.run( textArea.getText() );
201 }
202 }
203 );
204 setLayout( new BorderLayout() );
205 setJMenuBar( bar );
206 add( new JScrollPane( textArea ), BorderLayout.CENTER );
207 add( runButton, BorderLayout.SOUTH );
208 }
209} \ No newline at end of file
diff --git a/SlackYouInterpreter/SlackYouInterpreter-1.1/src/HelloWorld.sky b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/HelloWorld.sky
new file mode 100755
index 0000000..5a34281
--- /dev/null
+++ b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/HelloWorld.sky
@@ -0,0 +1,12 @@
1QUESTO È UN ESEMPIO DI HELLO WORLD IN SLACKYOU
2=48w
3=65w
4=6cww
5...w
6=20w
7=57w
8=6fw
9...w
10,,,,,,w
11=64w
12=21w \ No newline at end of file
diff --git a/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Main.java b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Main.java
new file mode 100755
index 0000000..879efc1
--- /dev/null
+++ b/SlackYouInterpreter/SlackYouInterpreter-1.1/src/Main.java
@@ -0,0 +1,325 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of SlackYouInterpreter.
5
6 SlackYouInterpreter 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 SlackYouInterpreter 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 SlackYouInterpreter; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23import java.util.Scanner;
24public class Main {
25 public static Scanner scanner;
26 public static char totalCode[], charCodeAux[], charCode[], chars;
27 public static int i, j;
28 public static byte a[][];
29 public static void main( String args[] ) {
30 System.out.println("");
31 Frame frame = new Frame();
32 frame.setSize( 200, 300 );
33 frame.setVisible( true );
34 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
35 }
36 public static void run( String code ) {
37 scanner = new Scanner( System.in );
38 a = new byte[1024][1024];
39 for ( int countX = 0; countX < a[0].length; countX++ )
40 for ( int countY = 0; countY < a.length; countY++ )
41 a[countX][countY] = 0;
42 chars = 'A';
43 int z = 0;
44 totalCode = code.toCharArray();
45 charCodeAux = new char[totalCode.length*2];
46 for ( int k = 0; k < totalCode.length; k++ ) {
47 switch ( totalCode[k] ) {
48 case '>':
49 case '<':
50 case '+':
51 case '-':
52 case '.':
53 case ',':
54 case '^':
55 case 'v':
56 case 'y':
57 case 'g':
58 case 'h':
59 case 'j':
60 case '*':
61 case '/':
62 case '%':
63 case '=':
64 case 'r':
65 case 'w':
66 case 'a':
67 case 'b':
68 case 'c':
69 case 'd':
70 case 'e':
71 case 'f':
72 case '0':
73 case '1':
74 case '2':
75 case '3':
76 case '4':
77 case '5':
78 case '6':
79 case '7':
80 case '8':
81 case '9':
82 charCodeAux[z] = totalCode[k];
83 z++;
84 break;
85 case '?':
86 case '!':
87 charCodeAux[z] = totalCode[k];
88 z++;
89 charCodeAux[z] = chars;
90 chars++;
91 z++;
92 break;
93 case ';':
94 case ':':
95 chars--;
96 charCodeAux[z] = chars;
97 z++;
98 charCodeAux[z] = totalCode[k];
99 z++;
100 break;
101 }
102 }
103 charCode = new char[z];
104 for ( int k = 0; k < charCode.length; k++ )
105 charCode[k] = charCodeAux[k];
106 i = 0;
107 j = 0;
108 execute( scanner, charCode, a, i, j, 0, charCode.length );
109 }
110 public static void execute( Scanner scanner, char charCode[], byte a[][], int i, int j, int start, int stop ) {
111
112 for (int count = start; count < stop; count++ ) {
113 switch ( charCode[count] ) {
114 case '>':
115 i++;
116 break;
117 case '<':
118 i--;
119 break;
120 case 'v':
121 j++;
122 break;
123 case '^':
124 j--;
125 break;
126 case '.':
127 a[j][i]++;
128 break;
129 case ',':
130 a[j][i]--;
131 break;
132 case 'y':
133 a[j-1][i] = a[j][i];
134 j--;
135 break;
136 case 'h':
137 a[j+1][i] = a[j][i];
138 j++;
139 break;
140 case 'g':
141 a[j][i-1] = a[j][i];
142 i--;
143 break;
144 case 'j':
145 a[j][i+1] = a[j][i];
146 i++;
147 break;
148 case '+':
149 a[j][i] += a[j][i+1];
150 break;
151 case '-':
152 a[j][i] -= a[j][i+1];
153 break;
154 case '*':
155 a[j][i] *= a[j][i+1];
156 break;
157 case '/':
158 a[j][i] /= a[j][i+1];
159 break;
160 case '%':
161 a[j][i] %= a[j][i+1];
162 break;
163 case 'w':
164 System.out.print( (char) a[j][i] );
165 break;
166 case 'r':
167 String stringa = scanner.nextLine();
168 char character[] = stringa.toCharArray();
169 switch ( character.length ) {
170 case 1:
171 a[j][i] = (byte) character[0];
172 break;
173 default:
174 count --;
175 break;
176 }
177 break;
178 case '=':
179 if ( (charCode[count+1] == '0' || charCode[count+1] == '1' || charCode[count+1] == '2' || charCode[count+1] == '3' ||
180 charCode[count+1] == '4' || charCode[count+1] == '5' || charCode[count+1] == '6' || charCode[count+1] == '7' ||
181 charCode[count+1] == '8' || charCode[count+1] == '9' || charCode[count+1] == 'a' || charCode[count+1] == 'b' ||
182 charCode[count+1] == 'c' || charCode[count+1] == 'd' || charCode[count+1] == 'e' || charCode[count+1] == 'f' ) &&
183 (charCode[count+2] == '0' || charCode[count+2] == '1' || charCode[count+2] == '2' || charCode[count+2] == '3' ||
184 charCode[count+2] == '4' || charCode[count+2] == '5' || charCode[count+2] == '6' || charCode[count+2] == '7' ||
185 charCode[count+2] == '8' || charCode[count+2] == '9' || charCode[count+2] == 'a' || charCode[count+2] == 'b' ||
186 charCode[count+2] == 'c' || charCode[count+2] == 'd' || charCode[count+2] == 'e' || charCode[count+2] == 'f' ) ) {
187 a[j][i] = 0;
188 switch ( charCode[count+1] ) {
189 case '0':
190 break;
191 case '1':
192 a[j][i] += 1 * 16;
193 break;
194 case '2':
195 a[j][i] += 2 * 16;
196 break;
197 case '3':
198 a[j][i] += 3 * 16;
199 break;
200 case '4':
201 a[j][i] += 4 * 16;
202 break;
203 case '5':
204 a[j][i] += 5 * 16;
205 break;
206 case '6':
207 a[j][i] += 6 * 16;
208 break;
209 case '7':
210 a[j][i] += 7 * 16;
211 break;
212 case '8':
213 a[j][i] += 8 * 16;
214 break;
215 case '9':
216 a[j][i] += 9 * 16;
217 break;
218 case 'a':
219 a[j][i] += 10 * 16;
220 break;
221 case 'b':
222 a[j][i] += 11 * 16;
223 break;
224 case 'c':
225 a[j][i] += 12 * 16;
226 break;
227 case 'd':
228 a[j][i] += 13 * 16;
229 break;
230 case 'e':
231 a[j][i] += 14 * 16;
232 break;
233 case 'f':
234 a[j][i] += 15 * 16;
235 break;
236 }
237 switch ( charCode[count+2] ) {
238 case '0':
239 break;
240 case '1':
241 a[j][i] += 1;
242 break;
243 case '2':
244 a[j][i] += 2;
245 break;
246 case '3':
247 a[j][i] += 3;
248 break;
249 case '4':
250 a[j][i] += 4;
251 break;
252 case '5':
253 a[j][i] += 5;
254 break;
255 case '6':
256 a[j][i] += 6;
257 break;
258 case '7':
259 a[j][i] += 7;
260 break;
261 case '8':
262 a[j][i] += 8;
263 break;
264 case '9':
265 a[j][i] += 9;
266 break;
267 case 'a':
268 a[j][i] += 10;
269 break;
270 case 'b':
271 a[j][i] += 11;
272 break;
273 case 'c':
274 a[j][i] += 12;
275 break;
276 case 'd':
277 a[j][i] += 13;
278 break;
279 case 'e':
280 a[j][i] += 14;
281 break;
282 case 'f':
283 a[j][i] += 15;
284 break;
285 }
286 }
287 break;
288 case '?':
289 if ( a[j][i] == 0 ) {
290 count++;
291 char key = charCode[count];
292 count++;
293 for ( ; charCode[count] != key; count++ ) ;
294 count++;
295 }
296 break;
297 case '!':
298 if ( a[j][i] != 0 ) {
299 count ++;
300 char key = charCode[count];
301 count ++;
302 for ( ; charCode[count] != key; count++ ) ;
303 count++;
304 }
305 break;
306 case ';':
307 if ( a[j][i] != 0 ) {
308 count --;
309 char key = charCode[count];
310 count --;
311 for ( ; charCode[count] != key; count-- ) ;
312 }
313 break;
314 case ':':
315 if ( a[j][i] == 0 ) {
316 count --;
317 char key = charCode[count];
318 count --;
319 for ( ; charCode[count] != key; count-- ) ;
320 }
321 break;
322 }
323 }
324 }
325} \ No newline at end of file
diff --git a/SlackYouInterpreter/SlackYouInterpreter.jar b/SlackYouInterpreter/SlackYouInterpreter.jar
new file mode 100755
index 0000000..fae131a
--- /dev/null
+++ b/SlackYouInterpreter/SlackYouInterpreter.jar
Binary files differ
diff --git a/pbfi/PBFI.jar b/pbfi/PBFI.jar
new file mode 100755
index 0000000..2af11ff
--- /dev/null
+++ b/pbfi/PBFI.jar
Binary files differ
diff --git a/pbfi/pbfi-1.0/src/Frame.java b/pbfi/pbfi-1.0/src/Frame.java
new file mode 100755
index 0000000..30f7f3c
--- /dev/null
+++ b/pbfi/pbfi-1.0/src/Frame.java
@@ -0,0 +1,49 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of PBFI (Porky's Brain F*** Interpreter).
5
6 PBFI 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 PBFI 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 PBFI; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23import javax.swing.JButton;
24import javax.swing.JTextArea;
25import javax.swing.JScrollPane;
26import java.awt.BorderLayout;
27import java.awt.event.*;
28
29public class Frame extends JFrame {
30 public static Main main;
31 public static JTextArea textArea;
32 public static JButton runButton;
33 public Frame() {
34 super( "Porky's Brain F*** Interpreter - v1.0" );
35 main = new Main();
36 textArea = new JTextArea( "Brain F*** source code here", 15, 15 );
37 runButton = new JButton( "Run" );
38 runButton.addActionListener(
39 new ActionListener() {
40 public void actionPerformed( ActionEvent e ) {
41 main.run( textArea.getText() );
42 }
43 }
44 );
45 setLayout( new BorderLayout() );
46 add( new JScrollPane( textArea ), BorderLayout.CENTER );
47 add( runButton, BorderLayout.SOUTH );
48 }
49} \ No newline at end of file
diff --git a/pbfi/pbfi-1.0/src/Main.java b/pbfi/pbfi-1.0/src/Main.java
new file mode 100755
index 0000000..c7fe81d
--- /dev/null
+++ b/pbfi/pbfi-1.0/src/Main.java
@@ -0,0 +1,119 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of PBFI (Porky's Brain F*** Interpreter).
5
6 PBFI 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 PBFI 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 PBFI; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23import java.util.Scanner;
24public class Main {
25 public static Scanner scanner;
26 public static char totalCode[], charCodeAux[], charCode[], chars;
27 public static byte a[];
28 public static int i;
29 public static void main( String args[] ) {
30 Frame frame = new Frame();
31 frame.setSize( 200, 300 );
32 frame.setVisible( true );
33 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
34 }
35 public static void run( String code ) {
36 chars = 'a';
37 int j = 0;
38 totalCode = code.toCharArray();
39 charCodeAux = new char[totalCode.length*2];
40 for ( int k = 0; k < totalCode.length; k++ ) {
41 switch ( totalCode[k] ) {
42 case '>':
43 case '<':
44 case '+':
45 case '-':
46 case '.':
47 case ',':
48 charCodeAux[j] = totalCode[k];
49 j++;
50 break;
51 case '[':
52 charCodeAux[j] = totalCode[k];
53 j++;
54 charCodeAux[j] = chars;
55 j++;
56 chars++;
57 break;
58 case ']':
59 chars--;
60 charCodeAux[j] = chars;
61 j++;
62 charCodeAux[j] = totalCode[k];
63 j++;
64 break;
65 }
66 }
67 charCode = new char[j];
68 for ( int k = 0; k < charCode.length; k++ )
69 charCode[k] = charCodeAux[k];
70 scanner = new Scanner( System.in );
71 a = new byte[30000];
72 for ( int count = 0; count < a.length; count++ )
73 a[count] = 0;
74 i = 0;
75 execute( scanner, charCode, a, i, 0, charCode.length );
76 }
77 public static void execute( Scanner scanner, char charCode[], byte a[], int i, int start, int stop ) {
78 for (int count = start; count < stop; count++ ) {
79 switch ( charCode[count] ) {
80 case '>':
81 i++;
82 break;
83 case '<':
84 i--;
85 break;
86 case '+':
87 a[i]++;
88 break;
89 case '-':
90 a[i]--;
91 break;
92 case '.':
93 System.out.print( (char) a[i] );
94 break;
95 case ',':
96 String stringa = scanner.nextLine();
97 a[i] = (byte) ( ( stringa.toCharArray() )[0] );
98 break;
99 case '[':
100 if ( a[i] == 0 ) {
101 count++;
102 char key = charCode[count];
103 count++;
104 for ( ; charCode[count] != key; count++ ) ;
105 count++;
106 }
107 break;
108 case ']':
109 if ( a[i] != 0 ) {
110 count --;
111 char key = charCode[count];
112 count --;
113 for ( ; charCode[count] != key; count-- ) ;
114 }
115 break;
116 }
117 }
118 }
119} \ No newline at end of file
diff --git a/pbfi/pbfi-1.1/src/99BottlesOfBeer.bfk b/pbfi/pbfi-1.1/src/99BottlesOfBeer.bfk
new file mode 100755
index 0000000..d9d65d9
--- /dev/null
+++ b/pbfi/pbfi-1.1/src/99BottlesOfBeer.bfk
@@ -0,0 +1,249 @@
1Programma che stampa il testo completo della canzone 99 bottles of beer
2
3##########################
4###
5### Severely updated version!
6### (now says "1 bottle" and
7### contains no extra "0" verse)
8###
9##########################
10### 99 Bottles of Beer ###
11### coded in Brainfuck ###
12### with explanations ###
13##########################
14#
15# This Bottles of Beer program
16# was written by Andrew Paczkowski
17# Coder Alias: thepacz
18# three_halves_plus_one at yahoo dot com
19#####
20
21> 0 in the zeroth cell
22+++++++>++++++++++[<+++++>-] 57 in the first cell or "9"
23+++++++>++++++++++[<+++++>-] 57 in second cell or "9"
24++++++++++ 10 in third cell
25>+++++++++ 9 in fourth cell
26
27##########################################
28### create ASCII chars in higher cells ###
29##########################################
30
31>>++++++++[<++++>-] " "
32>++++++++++++++[<+++++++>-] b
33+>+++++++++++[<++++++++++>-] o
34++>+++++++++++++++++++[<++++++>-] t
35++>+++++++++++++++++++[<++++++>-] t
36>++++++++++++[<+++++++++>-] l
37+>++++++++++[<++++++++++>-] e
38+>+++++++++++++++++++[<++++++>-] s
39>++++++++[<++++>-] " "
40+>+++++++++++[<++++++++++>-] o
41++>++++++++++[<++++++++++>-] f
42>++++++++[<++++>-] " "
43>++++++++++++++[<+++++++>-] b
44+>++++++++++[<++++++++++>-] e
45+>++++++++++[<++++++++++>-] e
46>+++++++++++++++++++[<++++++>-] r
47>++++++++[<++++>-] " "
48+>+++++++++++[<++++++++++>-] o
49>+++++++++++[<++++++++++>-] n
50>++++++++[<++++>-] " "
51++>+++++++++++++++++++[<++++++>-] t
52++++>++++++++++[<++++++++++>-] h
53+>++++++++++[<++++++++++>-] e
54>++++++++[<++++>-] " "
55++>+++++++++++++[<+++++++++>-] w
56+>++++++++++++[<++++++++>-] a
57>++++++++++++[<+++++++++>-] l
58>++++++++++++[<+++++++++>-] l
59>+++++[<++>-] LF
60++>+++++++++++++++++++[<++++++>-] t
61+>++++++++++++[<++++++++>-] a
62+++>+++++++++++++[<++++++++>-] k
63+>++++++++++[<++++++++++>-] e
64>++++++++[<++++>-] " "
65+>+++++++++++[<++++++++++>-] o
66>+++++++++++[<++++++++++>-] n
67+>++++++++++[<++++++++++>-] e
68>++++++++[<++++>-] " "
69>++++++++++[<++++++++++>-] d
70+>+++++++++++[<++++++++++>-] o
71++>+++++++++++++[<+++++++++>-] w
72>+++++++++++[<++++++++++>-] n
73>++++++++[<++++>-] " "
74+>++++++++++++[<++++++++>-] a
75>+++++++++++[<++++++++++>-] n
76>++++++++++[<++++++++++>-] d
77>++++++++[<++++>-] " "
78++>+++++++++++[<++++++++++>-] p
79+>++++++++++++[<++++++++>-] a
80+>+++++++++++++++++++[<++++++>-] s
81+>+++++++++++++++++++[<++++++>-] s
82>++++++++[<++++>-] " "
83+>+++++++++++++[<++++++++>-] i
84++>+++++++++++++++++++[<++++++>-] t
85>++++++++[<++++>-] " "
86+>++++++++++++[<++++++++>-] a
87>+++++++++++++++++++[<++++++>-] r
88+>+++++++++++[<++++++++++>-] o
89>+++++++++++++[<+++++++++>-] u
90>+++++++++++[<++++++++++>-] n
91>++++++++++[<++++++++++>-] d
92>+++++[<++>-] LF
93+++++++++++++ CR
94
95[<]>>>> go back to fourth cell
96
97#################################
98### initiate the display loop ###
99#################################
100
101[ loop
102 < back to cell 3
103 [ loop
104 [>]<< go to last cell and back to LF
105 .. output 2 newlines
106 [<]> go to first cell
107
108 ###################################
109 #### begin display of characters###
110 ###################################
111 #
112 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
113 #X X b o t t l e s o f b e e r
114 #.>.>.>.>.>.>.>.>.>.>.>.
115 #o n t h e w a l l N
116 #[<]> go to first cell
117 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
118 #X X b o t t l e s o f b e e r N
119 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
120 #t a k e o n e d o w n a n d p a s s
121 #.>.>.>.>.>.>.>.>.>.
122 #i t a r o u n d N
123 #####
124
125 [<]>> go to cell 2
126 - subtract 1 from cell 2
127 < go to cell 1
128
129 ########################
130 ### display last line ##
131 ########################
132 #
133 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
134 #X X b o t t l e s o f b e e r
135 #.>.>.>.>.>.>.>.>.>.>.
136 #o n t h e w a l l
137 #####
138
139 [<]>>>- go to cell 3/subtract 1
140 ] end loop when cell 3 is 0
141 ++++++++++ add 10 to cell 3
142 <++++++++++ back to cell 2/add 10
143 <- back to cell 1/subtract 1
144 [>]<. go to last line/carriage return
145 [<]> go to first line
146
147########################
148### correct last line ##
149########################
150#
151#.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
152#X X b o t t l e s o f b e e r
153#.>.>.>.>.>.>.>.>.>.>.
154#o n t h e w a l l
155#####
156
157 [<]>>>>- go to cell 4/subtract 1
158] end loop when cell 4 is 0
159
160##############################################################
161### By this point verses 99\10 are displayed but to work ###
162### with the lower numbered verses in a more readable way ###
163### we initiate a new loop for verses 9{CODE} that will not ###
164### use the fourth cell at all ###
165##############################################################
166
167+ add 1 to cell four (to keep it non\zero)
168<-- back to cell 3/subtract 2
169
170[ loop
171 [>]<< go to last cell and back to LF
172 .. output 2 newlines
173 [<]> go to first cell
174
175 ###################################
176 #### begin display of characters###
177 ###################################
178 #
179 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
180 # X b o t t l e s o f b e e r
181 #.>.>.>.>.>.>.>.>.>.>.>.
182 #o n t h e w a l l N
183 #[<]> go to first cell
184 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
185 # X b o t t l e s o f b e e r N
186 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
187 #t a k e o n e d o w n a n d p a s s
188 #.>.>.>.>.>.>.>.>.>.
189 #i t a r o u n d N
190 #####
191
192 [<]>> go to cell 2
193 - subtract 1 from cell 2
194
195 ########################
196 ### display last line ##
197 ########################
198 #
199 #.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
200 #X b o t t l e s o f b e e r
201 #.>.>.>.>.>.>.>.>.>.>.
202 #o n t h e w a l l
203 #####
204
205 [<]>>>- go to cell 3/subtract 1
206] end loop when cell 3 is 0
207+ add 1 to cell 3 to keep it non\zero
208
209[>]<. go to last line/carriage return
210[<]> go to first line
211
212########################
213### correct last line ##
214########################
215#
216#>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.>
217# X b o t t l e o f b e e r
218#.>.>.>.>.>.>.>.>.>.>.<<<<.
219#o n t h e w a l l
220#####
221
222[>]<< go to last cell and back to LF
223.. output 2 newlines
224[<]> go to first line
225
226#########################
227### the final verse ##
228#########################
229#
230#>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.>
231# X b o t t l e o f b e e r
232#.>.>.>.>.>.>.>.>.>.>.>.
233#o n t h e w a l l N
234#[<]> go to first cell
235#>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
236# X b o t t l e o f b e e r N
237#.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
238#t a k e o n e d o w n a n d p a s s
239#.>.>.>.>.>.>.>.>.>.
240#i t a r o u n d N
241#[>]< go to last line
242#<<<.<<.<<<.
243# n o
244#[<]>>>> go to fourth cell
245#>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
246# b o t t l e s o f b e e r
247#.>.>.>.>.>.>.>.>.>.>.>.
248#o n t h e w a l l N
249#####fin## \ No newline at end of file
diff --git a/pbfi/pbfi-1.1/src/Frame.java b/pbfi/pbfi-1.1/src/Frame.java
new file mode 100755
index 0000000..906a16b
--- /dev/null
+++ b/pbfi/pbfi-1.1/src/Frame.java
@@ -0,0 +1,209 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of PBFI (Porky's Brain F*** Interpreter).
5
6 PBFI 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 PBFI 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 PBFI; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.BorderLayout;
24import java.awt.event.*;
25import java.io.*;
26
27public class Frame extends JFrame {
28public static int valoreChooser;
29 public static boolean firstSave;
30 public static String defaultSave;
31 public static Main main;
32 public static JTextArea textArea;
33 public static JButton runButton;
34 public static JMenuBar bar;
35 public static JMenu menuFile, menuAiuto;
36 public static JMenuItem esci, esegui, salva, salvaConNome, apri, info;
37 public static JFileChooser chooser;
38 public static FileInputStream in;
39 public static FileOutputStream out;
40 public Frame() {
41 super( "Porky's BrainF** Interpreter - v1.1" );
42 firstSave = true;
43 main = new Main();
44 defaultSave = "";
45 chooser = new JFileChooser();
46 textArea = new JTextArea( "Digitare qui il codice BrainF***", 15, 15 );
47 bar = new JMenuBar();
48 menuFile = new JMenu( "File" );
49 menuAiuto = new JMenu( "?" );
50 esci = new JMenuItem( "Esci" );
51 esegui = new JMenuItem( "Esegui" );
52 salva = new JMenuItem( "Salva" );
53 salvaConNome = new JMenuItem( "Salva con nome" );
54 apri = new JMenuItem( "Apri" );
55 info = new JMenuItem( "Aiuto" );
56 menuFile.setMnemonic( 'F' );
57 menuAiuto.setMnemonic( '?' );
58 esci.setMnemonic( 'E' );
59 esegui.setMnemonic( 's' );
60 salva.setMnemonic( 'a' );
61 salvaConNome.setMnemonic( 'n' );
62 apri.setMnemonic( 'p' );
63 info.setMnemonic( 'i' );
64 esci.addActionListener(
65 new ActionListener() {
66 public void actionPerformed ( ActionEvent e ) {
67 System.exit( 0 );
68 }
69 }
70 );
71 esegui.addActionListener(
72 new ActionListener() {
73 public void actionPerformed ( ActionEvent e ) {
74 main.run( textArea.getText() );
75 }
76 }
77 );
78 salva.addActionListener(
79 new ActionListener() {
80 public void actionPerformed ( ActionEvent e ) {
81 if ( firstSave ) {
82 valoreChooser = chooser.showSaveDialog( Frame.this );
83 switch ( valoreChooser ) {
84 case JFileChooser.APPROVE_OPTION:
85 try {
86 out = new FileOutputStream( chooser.getSelectedFile().getPath() );
87 defaultSave = chooser.getSelectedFile().getPath();
88 char caratteri[];
89 byte bytes[];
90 caratteri = textArea.getText().toCharArray();
91 bytes = new byte[caratteri.length];
92 for ( int i = 0; i < caratteri.length; i++ )
93 bytes[i] = ( byte ) caratteri[i];
94 out.write( bytes );
95 } catch ( Exception ex ) {
96 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
97 }
98 break;
99 case JFileChooser.ERROR_OPTION:
100 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
101 break;
102 //case JFileChooser.CANCEL_OPTION:
103 }
104 firstSave = false;
105 } else {
106 try {
107 out = new FileOutputStream( defaultSave );
108 char caratteri[];
109 byte bytes[];
110 caratteri = textArea.getText().toCharArray();
111 bytes = new byte[caratteri.length];
112 for ( int i = 0; i < caratteri.length; i++ )
113 bytes[i] = ( byte ) caratteri[i];
114 out.write( bytes );
115 } catch ( Exception ex ) {
116 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
117 }
118 }
119 }
120 }
121 );
122 salvaConNome.addActionListener(
123 new ActionListener() {
124 public void actionPerformed ( ActionEvent e ) {
125 valoreChooser = chooser.showSaveDialog( Frame.this );
126 switch ( valoreChooser ) {
127 case JFileChooser.APPROVE_OPTION:
128 try {
129 out = new FileOutputStream( chooser.getSelectedFile().getPath() );
130 defaultSave = chooser.getSelectedFile().getPath();
131 char caratteri[];
132 byte bytes[];
133 caratteri = textArea.getText().toCharArray();
134 bytes = new byte[caratteri.length];
135 for ( int i = 0; i < caratteri.length; i++ )
136 bytes[i] = ( byte ) caratteri[i];
137 out.write( bytes );
138 } catch ( Exception ex ) {
139 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
140 }
141 break;
142 case JFileChooser.ERROR_OPTION:
143 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
144 break;
145 //case JFileChooser.CANCEL_OPTION:
146 }
147 firstSave = false;
148 }
149 }
150 );
151 apri.addActionListener(
152 new ActionListener() {
153 public void actionPerformed ( ActionEvent e ) {
154 valoreChooser = chooser.showOpenDialog( Frame.this );
155 switch ( valoreChooser ) {
156 case JFileChooser.APPROVE_OPTION:
157 try {
158 String stringa;
159 byte bytes[];
160 char caratteri[];
161 in = new FileInputStream( chooser.getSelectedFile().getPath() );
162 bytes = new byte[in.available()];
163 caratteri = new char[in.available()];
164 in.read( bytes );
165 for ( int i = 0; i < bytes.length; i++ )
166 caratteri[i] = ( char ) bytes[i];
167 stringa = new String( caratteri );
168 textArea.setText( stringa );
169 } catch ( Exception ex ) {
170 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + ex + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
171 }
172 break;
173 case JFileChooser.ERROR_OPTION:
174 JOptionPane.showMessageDialog( Frame.this, "Errore sconosciuto:\n\n" + e + "\n\nPer favore riportare il bug a sebastiano@luganega.org", "Errore", JOptionPane.ERROR_MESSAGE );
175 break;
176 //case JFileChooser.CANCEL_OPTION:
177 }
178 }
179 }
180 );
181 info.addActionListener(
182 new ActionListener() {
183 public void actionPerformed ( ActionEvent e ) {
184 JOptionPane.showMessageDialog( Frame.this, "Brainfuck è un linguaggio di programmazione esoterico per computer,\ncreato da Urban Müller intorno al 1993. Il linguaggio viene\nin taluni casi denominato Brainf*ck, Brainf***\no anche soltanto BF per evitare di offendere\nla sensibilità altrui.\nNella cartella src trovate alcuni esempi di programmi in questo linguaggio.\n\nPer maggiori informazioni visitate la pagina:\nhttp://it.wikipedia.org/wiki/Brainfuck", "BrainF*** - Informazioni", JOptionPane.INFORMATION_MESSAGE );
185 }
186 }
187 );
188 menuFile.add( esegui );
189 menuFile.add( salva );
190 menuFile.add( salvaConNome );
191 menuFile.add( apri );
192 menuFile.add( esci );
193 menuAiuto.add( info );
194 bar.add( menuFile );
195 bar.add( menuAiuto );
196 runButton = new JButton( "Esegui" );
197 runButton.addActionListener(
198 new ActionListener() {
199 public void actionPerformed( ActionEvent e ) {
200 main.run( textArea.getText() );
201 }
202 }
203 );
204 setLayout( new BorderLayout() );
205 setJMenuBar( bar );
206 add( new JScrollPane( textArea ), BorderLayout.CENTER );
207 add( runButton, BorderLayout.SOUTH );
208 }
209} \ No newline at end of file
diff --git a/pbfi/pbfi-1.1/src/HelloWorld.bfk b/pbfi/pbfi-1.1/src/HelloWorld.bfk
new file mode 100755
index 0000000..74025e4
--- /dev/null
+++ b/pbfi/pbfi-1.1/src/HelloWorld.bfk
@@ -0,0 +1,20 @@
1Questo è un esempio Hello World in BrainFuck (fonte: wikipedia)
2notare che tutti i caratteri diversi dagli 8 comandi sono considerati un commento
3
4++++++++++
5[
6 >+++++++>++++++++++>+++>+<<<<-
7]
8>++. Loop iniziale (dopo viene stampata una H)
9>+. e
10+++++++. l
11. l
12+++. o
13>++.
14<<+++++++++++++++.
15>.
16+++.
17------.
18--------.
19>+.
20>.
diff --git a/pbfi/pbfi-1.1/src/Main.java b/pbfi/pbfi-1.1/src/Main.java
new file mode 100755
index 0000000..597ae2a
--- /dev/null
+++ b/pbfi/pbfi-1.1/src/Main.java
@@ -0,0 +1,119 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of PBFI (Porky's Brain F*** Interpreter).
5
6 PBFI 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 PBFI 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 PBFI; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23import java.util.Scanner;
24public class Main {
25 public static Scanner scanner;
26 public static char totalCode[], charCodeAux[], charCode[], chars;
27 public static byte a[];
28 public static int i;
29 public static void main( String args[] ) {
30 Frame frame = new Frame();
31 frame.setSize( 200, 300 );
32 frame.setVisible( true );
33 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
34 }
35 public static void run( String code ) {
36 chars = 'a';
37 int j = 0;
38 totalCode = code.toCharArray();
39 charCodeAux = new char[totalCode.length*2];
40 for ( int k = 0; k < totalCode.length; k++ ) {
41 switch ( totalCode[k] ) {
42 case '>':
43 case '<':
44 case '+':
45 case '-':
46 case '.':
47 case ',':
48 charCodeAux[j] = totalCode[k];
49 j++;
50 break;
51 case '[':
52 charCodeAux[j] = totalCode[k];
53 j++;
54 charCodeAux[j] = chars;
55 chars++;
56 j++;
57 break;
58 case ']':
59 chars--;
60 charCodeAux[j] = chars;
61 j++;
62 charCodeAux[j] = totalCode[k];
63 j++;
64 break;
65 }
66 }
67 charCode = new char[j];
68 for ( int k = 0; k < charCode.length; k++ )
69 charCode[k] = charCodeAux[k];
70 scanner = new Scanner( System.in );
71 a = new byte[30000];
72 for ( int count = 0; count < a.length; count++ )
73 a[count] = 0;
74 i = 0;
75 execute( scanner, charCode, a, i, 0, charCode.length );
76 }
77 public static void execute( Scanner scanner, char charCode[], byte a[], int i, int start, int stop ) {
78 for ( int count = start; count < stop; count++ ) {
79 switch ( charCode[count] ) {
80 case '>':
81 i++;
82 break;
83 case '<':
84 i--;
85 break;
86 case '+':
87 a[i]++;
88 break;
89 case '-':
90 a[i]--;
91 break;
92 case '.':
93 System.out.print( (char) a[i] );
94 break;
95 case ',':
96 String stringa = scanner.nextLine();
97 a[i] = (byte) ( ( stringa.toCharArray() )[0] );
98 break;
99 case '[':
100 if ( a[i] == 0 ) {
101 count++;
102 char key = charCode[count];
103 count++;
104 for ( ; charCode[count] != key; count++ ) ;
105 count++;
106 }
107 break;
108 case ']':
109 if ( a[i] != 0 ) {
110 count --;
111 char key = charCode[count];
112 count --;
113 for ( ; charCode[count] != key; count-- ) ;
114 }
115 break;
116 }
117 }
118 }
119} \ No newline at end of file
diff --git a/pbfi/pbfi-1.1/src/Quine.bfk b/pbfi/pbfi-1.1/src/Quine.bfk
new file mode 100755
index 0000000..8456a6b
--- /dev/null
+++ b/pbfi/pbfi-1.1/src/Quine.bfk
@@ -0,0 +1,13 @@
1Questo programma è un esempio di quine (programma che mostra in output il suo codice sorgente) in BrainFuck (fonte: wikipedia)
2
3 ->+>+++>>+>++>+>+++>>+>++>>>+>+>+>++>+>>>>+++>+>>++>+>+++>>++>++>>+>>+>++>++>
4 +>>>>+++>+>>>>++>++>>>>+>>++>+>+++>>>++>>++++++>>+>>++>+>>>>+++>>+++++>>+>+++
5 >>>++>>++>>+>>++>+>+++>>>++>>+++++++++++++>>+>>++>+>+++>+>+++>>>++>>++++>>+>>
6 ++>+>>>>+++>>+++++>>>>++>>>>+>+>++>>+++>+>>>>+++>+>>>>+++>+>>>>+++>>++>++>+>+
7 ++>+>++>++>>>>>>++>+>+++>>>>>+++>>>++>+>+++>+>+>++>>>>>>++>>>+>>>++>+>>>>+++>
8 +>>>+>>++>+>++++++++++++++++++>>>>+>+>>>+>>++>+>+++>>>++>>++++++++>>+>>++>+>>
9 >>+++>>++++++>>>+>++>>+++>+>+>++>+>+++>>>>>+++>>>+>+>>++>+>+++>>>++>>++++++++
10 >>+>>++>+>>>>+++>>++++>>+>+++>>>>>>++>+>+++>>+>++>>>>+>+>++>+>>>>+++>>+++>>>+
11 [[->>+<<]<+]+++++[->+++++++++<]>.[+]>>[<<+++++++[->+++++++++<]>-
12 .------------------->-[-<.<+>>]<[+]<+>>>]<<<[-[-[-[>>+<++++++[->+++++<]]>++++
13 ++++++++++<]>+++<]++++++[->+++++++<]>+<<<-[->>>++<<<]>[->>.<<]<<]
diff --git a/robottino/Robottino.jar b/robottino/Robottino.jar
new file mode 100755
index 0000000..a3dc9e7
--- /dev/null
+++ b/robottino/Robottino.jar
Binary files differ
diff --git a/robottino/all_versions/Changelog.txt b/robottino/all_versions/Changelog.txt
new file mode 100755
index 0000000..575e94b
--- /dev/null
+++ b/robottino/all_versions/Changelog.txt
@@ -0,0 +1,20 @@
1v1.0: La prima versione.
2
3v2.0: Aggiunte funzionalità crea/rinomina/cambia robottino.
4
5v2.1: Sostituiti gli array con i Vector. Aggiunta funzionalità elimina robottino.
6
7v2.2: Agiunta la finestra.
8
9v2.3: Aggiunte le funzioni per dare comandi attraverso la finestra.
10
11 Non è più possibile dare comandi a linea di comando.
12v3.0: Aggiunta delle immagini.
13
14v4.0: Cambiata la grafica da awt a swing.
15 Finalmente ad ogni comando il robottino si muove e non è più presente
16 l'output a riga di comando. Molte delle vecchie funzioni devono essere re-implementate.
17
18v4.0.1: Fixato il bug di sfarfallio - immagini tagliate.
19
20v4.1: Re-implementate tute le vecchie funzioni.
diff --git a/robottino/all_versions/v1.0/Esegui.bat b/robottino/all_versions/v1.0/Esegui.bat
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v1.0/Esegui.bat
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v1.0/Esegui.sh b/robottino/all_versions/v1.0/Esegui.sh
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v1.0/Esegui.sh
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v1.0/Readme.txt b/robottino/all_versions/v1.0/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v1.0/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v1.0/bin/PartiDelRobot.class b/robottino/all_versions/v1.0/bin/PartiDelRobot.class
new file mode 100755
index 0000000..a7d1f7e
--- /dev/null
+++ b/robottino/all_versions/v1.0/bin/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v1.0/bin/Robottino.class b/robottino/all_versions/v1.0/bin/Robottino.class
new file mode 100755
index 0000000..770ae6b
--- /dev/null
+++ b/robottino/all_versions/v1.0/bin/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v1.0/src/PartiDelRobot.java b/robottino/all_versions/v1.0/src/PartiDelRobot.java
new file mode 100755
index 0000000..078f7a0
--- /dev/null
+++ b/robottino/all_versions/v1.0/src/PartiDelRobot.java
@@ -0,0 +1,9 @@
1class PartiDelRobot {
2 PartiDelRobot() { };
3 PartiDelRobot(boolean b, String s) {
4 this.stringaParte = s;
5 this.statoParte = b;
6 }
7 public String stringaParte;
8 public boolean statoParte;
9}
diff --git a/robottino/all_versions/v1.0/src/Robottino.java b/robottino/all_versions/v1.0/src/Robottino.java
new file mode 100755
index 0000000..e155613
--- /dev/null
+++ b/robottino/all_versions/v1.0/src/Robottino.java
@@ -0,0 +1,160 @@
1import java.util.Scanner;
2class Robottino extends PartiDelRobot {
3 public static void main(String argv[]) {
4 Robottino robot = new Robottino();
5 PartiDelRobot pdr[] = { new PartiDelRobot (false, "il braccio sinistro alzato"),
6 new PartiDelRobot (false, "il braccio destro alzato"),
7 new PartiDelRobot (false, "la gamba sinistra alzata"),
8 new PartiDelRobot (false, "la gamba destra alzata") };
9 Scanner sc = new Scanner(System.in);
10 String comando;
11 String nomeRobot[] = { "" };
12 System.out.println("**********************************************");
13 System.out.println("**********************************************");
14 System.out.println("*************Programma interattivo************");
15 System.out.println("**********************************************");
16 System.out.println("***Software realizzato da Sebastiano Tronto***");
17 System.out.println("**********************************************");
18 System.out.println("**********************************************");
19 System.out.println("Questo programma simula un robot al quale ven-");
20 System.out.println("gono assegnati ordini tramite comandi, simil-" );
21 System.out.println("mente a quanto bisognava fare con i computer " );
22 System.out.println("alcuni anni fa." );
23 System.out.println("Dato che all'epoca i comandi che dovevano es-" );
24 System.out.println("sere dati erano (e sono tutt'ora) in similin-" );
25 System.out.println("glese, ho cercato di mantenerli tali." );
26 System.out.println("Il programma non fa distinzioni tra lettere" );
27 System.out.println("maiuscole o minuscole." );
28 System.out.println("" );
29 System.out.println("Digita un comando e premi invio" );
30 System.out.println("l = legenda comandi" );
31 do {
32 comando = sc.nextLine();
33 System.out.println ("Siamo spiacenti, ma per motivi tecnici non sono in grado di visualizzare l'immagine del robot.");
34 System.out.println (robot.Azioni(comando, nomeRobot, pdr));
35 } while ( !(comando.equalsIgnoreCase("exit")) );
36 }
37 String Azioni(String comando, String nomeRobot[], PartiDelRobot pdr[]) {
38 Scanner sc2 = new Scanner(System.in);
39 int contatore = 0;
40 String stat[] = {"", "", "", ""};
41 String Return = "Errore - si consiglia di picchiare il programmatore";
42 if (comando.equalsIgnoreCase("leftarmmove"))
43 pdr[0].statoParte = !pdr[0].statoParte;
44 else if (comando.equalsIgnoreCase("rightarmmove"))
45 pdr[1].statoParte = !pdr[1].statoParte;
46 else if (comando.equalsIgnoreCase("leftlegmove"))
47 pdr[2].statoParte = !pdr[2].statoParte;
48 else if (comando.equalsIgnoreCase("rightlegmove"))
49 pdr[3].statoParte = !pdr[3].statoParte;
50 else if (comando.equalsIgnoreCase("leftarmon"))
51 pdr[0].statoParte = true;
52 else if (comando.equalsIgnoreCase("rightarmon"))
53 pdr[1].statoParte = true;
54 else if (comando.equalsIgnoreCase("leftlegon"))
55 pdr[2].statoParte = true;
56 else if (comando.equalsIgnoreCase("rightlegon"))
57 pdr[3].statoParte = true;
58 else if (comando.equalsIgnoreCase("leftarmoff"))
59 pdr[0].statoParte = false;
60 else if (comando.equalsIgnoreCase("rightarmoff"))
61 pdr[1].statoParte = false;
62 else if (comando.equalsIgnoreCase("leftlegoff"))
63 pdr[2].statoParte = false;
64 else if (comando.equalsIgnoreCase("rightlegoff"))
65 pdr[3].statoParte = false;
66 else if (comando.equalsIgnoreCase("exploud")) {
67 System.out.println ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot[0] + "! Aspetta che te ne faccio un altro");
68 System.out.println ("...");
69 for (int i = 0; i < pdr.length; i++) {
70 pdr[i].statoParte = false;
71 }
72 nomeRobot[0] = "";
73 return "Fatto, puoi continuare a giocare";
74 }
75 else if (comando.equalsIgnoreCase("bier")) {
76 System.out.println ("Il robottino " + nomeRobot[0] + "sta trangugiando una birra...");
77 System.out.println ("Buurrrrrrrrp!");
78 return "La birra analcolica fa schifo!";
79 }
80 else if (comando.equalsIgnoreCase("rename")) {
81 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot[0]);
82 System.out.println ("Digita il nuovo nome e premi invio per coninuare");
83 nomeRobot[0] = sc2.nextLine();
84 if (!(nomeRobot[0].equalsIgnoreCase("")))
85 nomeRobot[0] += " ";
86 return "Ora il robottino si chiama " + nomeRobot[0];
87 }
88 else if (comando.equalsIgnoreCase("porky")) {
89 System.out.println ("Porky è un grande");
90 System.out.println ("Per maggiori informazioni visita il sito");
91 return "http://kakati.forumfree.net/";
92 }
93 else if (comando.equalsIgnoreCase("xxx")) {
94 System.out.println ("Il robottino " + nomeRobot[0] + "ha incontrato una bella robottina...");
95 return "*Censura*";
96 }
97 else if (comando.equalsIgnoreCase("l")) {
98 System.out.println ("Legenda comandi");
99 System.out.println ("");
100 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
101 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
102 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
103 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
104 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
105 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
106 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
107 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
108 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
109 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
110 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
111 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
112 System.out.println ("Exit: esci dal programma");
113 System.out.println ("");
114 System.out.println ("Comandi a sorpresa:");
115 System.out.println ("");
116 System.out.println ("Exploud");
117 System.out.println ("Bier");
118 System.out.println ("Rename");
119 System.out.println ("Porky");
120 System.out.println ("xxx");
121 return "";
122
123 }
124 else
125 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
126 for (int i = 0, j = 0; i < pdr.length; i++) {
127 if (pdr[i].statoParte) {
128 contatore += 1;
129 stat[j++] = pdr[i].stringaParte;
130 }
131 }
132 switch (contatore) {
133 case 0:
134 Return = "Comunque il robottino " + nomeRobot[0] + "non sta facendo niente";
135 break;
136 case 1:
137 Return = "Immagini che il robottino " + nomeRobot[0] + "abbia " + stat[0] + ".";
138 break;
139 case 2:
140 Return = "Immagini che il robottino " + nomeRobot[0] + "abbia " + stat[0] + " e " + stat[1] + ".";
141 break;
142 case 3:
143 Return = "Immagini che il robottino " + nomeRobot[0] + "abbia " + stat[0] + ", " + stat[1] + " e " + stat[2] + ".";
144 break;
145 case 4:
146 Return = "Immagini che il robottino " + nomeRobot[0] + "abbia " + stat[0] + ", " + stat[1] + ", " + stat[2] + " e " + stat[3] + ".";
147 break;
148 }
149 return Return;
150 }
151}
152
153
154
155
156
157
158
159
160
diff --git a/robottino/all_versions/v2.0/Esegui.bat b/robottino/all_versions/v2.0/Esegui.bat
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v2.0/Esegui.bat
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v2.0/Esegui.sh b/robottino/all_versions/v2.0/Esegui.sh
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v2.0/Esegui.sh
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v2.0/Readme.txt b/robottino/all_versions/v2.0/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v2.0/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v2.0/bin/PartiDelRobot.class b/robottino/all_versions/v2.0/bin/PartiDelRobot.class
new file mode 100755
index 0000000..e6ffdb4
--- /dev/null
+++ b/robottino/all_versions/v2.0/bin/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v2.0/bin/Robottino.class b/robottino/all_versions/v2.0/bin/Robottino.class
new file mode 100755
index 0000000..e2228a1
--- /dev/null
+++ b/robottino/all_versions/v2.0/bin/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v2.0/src/PartiDelRobot.java b/robottino/all_versions/v2.0/src/PartiDelRobot.java
new file mode 100755
index 0000000..3399dbc
--- /dev/null
+++ b/robottino/all_versions/v2.0/src/PartiDelRobot.java
@@ -0,0 +1,9 @@
1public class PartiDelRobot {
2 PartiDelRobot() { };
3 PartiDelRobot(boolean b, String s) {
4 this.stringaParte = s;
5 this.statoParte = b;
6 }
7 public String stringaParte;
8 public boolean statoParte;
9}
diff --git a/robottino/all_versions/v2.0/src/Robottino.java b/robottino/all_versions/v2.0/src/Robottino.java
new file mode 100755
index 0000000..f1b0c49
--- /dev/null
+++ b/robottino/all_versions/v2.0/src/Robottino.java
@@ -0,0 +1,270 @@
1import java.util.Scanner;
2class Robottino extends PartiDelRobot {
3 static PartiDelRobot pdr[][] = {
4 {
5 new PartiDelRobot (false, "il braccio sinistro alzato"),
6 new PartiDelRobot (false, "il braccio destro alzato"),
7 new PartiDelRobot (false, "la gamba sinistra alzata"),
8 new PartiDelRobot (false, "la gamba destra alzata")
9 }
10 };
11 static String nomeRobot[] = { "" };
12 int robotIndex = 0;
13 public static void main(String argv[]) {
14 Scanner sc = new Scanner(System.in);
15 String comando;
16 Robottino robottino = new Robottino();
17 System.out.println ("**********************************************");
18 System.out.println ("**********************************************");
19 System.out.println ("*************Programma interattivo************");
20 System.out.println ("**********************************************");
21 System.out.println ("***Software realizzato da Sebastiano Tronto***");
22 System.out.println ("**********************************************");
23 System.out.println ("**********************************************");
24 System.out.println ("Questo programma simula un robot al quale ven-");
25 System.out.println ("gono assegnati ordini tramite comandi, simil-" );
26 System.out.println ("mente a quanto bisognava fare con i computer " );
27 System.out.println ("alcuni anni fa." );
28 System.out.println ("Dato che all'epoca i comandi che dovevano es-" );
29 System.out.println ("sere dati erano (e sono tutt'ora) in similin-" );
30 System.out.println ("glese, ho cercato di mantenerli tali." );
31 System.out.println ("Il programma non fa distinzioni tra lettere" );
32 System.out.println ("maiuscole o minuscole." );
33 System.out.println ("In questa versione non sono ancora disponibi-" );
34 System.out.println ("li immagini e/o effetti grafici." );
35 System.out.println ("" );
36 System.out.println ("Digita un comando e premi INVIO" );
37 System.out.println ("l = legenda comandi" );
38 System.out.println ("");
39 do {
40 comando = sc.nextLine();
41 System.out.println ("");
42 System.out.println (robottino.Azioni(comando, nomeRobot, pdr));
43 System.out.println ("");
44 } while ( !(comando.equalsIgnoreCase("exit")) );
45 }
46 String Azioni(String comando, String nomeRobot[], PartiDelRobot pdr[][]) {
47 Scanner sc2 = new Scanner(System.in);
48 int contatore = 0;
49 String stat[] = {"", "", "", ""};
50 String Return = "Errore - si consiglia di picchiare il programmatore";
51 if (comando.equalsIgnoreCase("leftarmmove"))
52 this.pdr[this.robotIndex][0].statoParte = !this.pdr[this.robotIndex][0].statoParte;
53 else if (comando.equalsIgnoreCase("rightarmmove"))
54 this.pdr[this.robotIndex][1].statoParte = !this.pdr[this.robotIndex][1].statoParte;
55 else if (comando.equalsIgnoreCase("leftlegmove"))
56 this.pdr[this.robotIndex][2].statoParte = !this.pdr[this.robotIndex][2].statoParte;
57 else if (comando.equalsIgnoreCase("rightlegmove"))
58 this.pdr[this.robotIndex][3].statoParte = !this.pdr[this.robotIndex][3].statoParte;
59 else if (comando.equalsIgnoreCase("leftarmon"))
60 this.pdr[this.robotIndex][0].statoParte = true;
61 else if (comando.equalsIgnoreCase("rightarmon"))
62 this.pdr[this.robotIndex][1].statoParte = true;
63 else if (comando.equalsIgnoreCase("leftlegon"))
64 this.pdr[this.robotIndex][2].statoParte = true;
65 else if (comando.equalsIgnoreCase("rightlegon"))
66 this.pdr[this.robotIndex][3].statoParte = true;
67 else if (comando.equalsIgnoreCase("leftarmoff"))
68 this.pdr[this.robotIndex][0].statoParte = false;
69 else if (comando.equalsIgnoreCase("rightarmoff"))
70 this.pdr[this.robotIndex][1].statoParte = false;
71 else if (comando.equalsIgnoreCase("leftlegoff"))
72 this.pdr[this.robotIndex][2].statoParte = false;
73 else if (comando.equalsIgnoreCase("rightlegoff"))
74 this.pdr[this.robotIndex][3].statoParte = false;
75 else if (comando.equalsIgnoreCase("exploud")) {
76 System.out.println ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot[this.robotIndex] + "! Aspetta che te ne faccio un altro");
77 System.out.println ("...");
78 for (int i = 0; i < pdr[this.robotIndex].length; i++) {
79 pdr[this.robotIndex][i].statoParte = false;
80 }
81 nomeRobot[this.robotIndex] = "";
82 return "Fatto, puoi continuare a giocare";
83 }
84 else if (comando.equalsIgnoreCase("bier")) {
85 System.out.println ("Il robottino " + nomeRobot[this.robotIndex] + "sta trangugiando una birra...");
86 System.out.println ("Buurrrrrrrrp!");
87 return "La birra analcolica fa schifo!";
88 }
89 else if (comando.equalsIgnoreCase("rename")) {
90 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot[this.robotIndex]);
91 System.out.println ("Digita il nuovo nome e premi invio per coninuare");
92 nomeRobot[this.robotIndex] = sc2.nextLine();
93 if (!(nomeRobot[this.robotIndex].equalsIgnoreCase("")))
94 nomeRobot[this.robotIndex] += " ";
95 return "Ora il robottino si chiama " + nomeRobot[this.robotIndex];
96 }
97 else if (comando.equalsIgnoreCase("porky")) {
98 System.out.println ("Porky è un grande");
99 System.out.println ("Per maggiori informazioni visita il sito");
100 return "http://kakati.forumfree.net/";
101 }
102 else if (comando.equalsIgnoreCase("xxx")) {
103 System.out.println ("Il robottino " + nomeRobot[this.robotIndex] + "ha incontrato una bella robottina...");
104 return "*Censura*";
105 }
106 else if (comando.equalsIgnoreCase("dance")) {
107 System.out.println ("Immagini che il robottino " + nomeRobot[this.robotIndex] + " stia ballando...");
108 System.out.println ("Il robottino ha smesso di ballare");
109 for (int i = 0; i < pdr[this.robotIndex].length; i++) {
110 pdr[0][i].statoParte = false;
111 }
112 return "Il robottino " + nomeRobot[this.robotIndex] + "si è fermato ed è tornato nella posizione originale";
113 }
114 else if (comando.equalsIgnoreCase("newrobot")) {
115 PartiDelRobot pdrAus[][] = new PartiDelRobot[(addRobot(this.pdr, this.pdr[this.robotIndex])).length][(addRobot(this.pdr, this.pdr[this.robotIndex]))[(addRobot(this.pdr, this.pdr[this.robotIndex])).length-1].length];
116 this.pdr = new PartiDelRobot[pdrAus.length][pdrAus[pdrAus.length-1].length];
117 for (int i=0; i<pdrAus.length; i++) {
118 for (int j=0; j<pdrAus[i].length; j++) {
119 pdrAus[i][j] = (addRobot(pdr, pdr[this.robotIndex]))[i][j];
120 pdrAus[i][j].stringaParte = (addRobot(pdr, pdr[this.robotIndex]))[i][j].stringaParte;
121 pdrAus[i][j].statoParte = (addRobot(pdr, pdr[this.robotIndex]))[i][j].statoParte;
122 }
123 }
124 for (int i=0; i<this.pdr.length; i++) {
125 for (int j=0; j<this.pdr[i].length; j++) {
126 this.pdr[i][j] = pdrAus[i][j];
127 this.pdr[i][j].stringaParte = pdrAus[i][j].stringaParte;
128 this.pdr[i][j].statoParte = pdrAus[i][j].statoParte;
129 }
130 }
131 System.out.println ("È stato creato un nuovo robot. Vuoi dare un nome al nuovo robot?");
132 System.out.println ("Inserisci il nuovo nome e premi INVIO oppure lascia vuoto e premi INVIO");
133 String newName = sc2.nextLine();
134 String nomeRobotAus[] = new String[(addName(this.nomeRobot, newName)).length];
135 this.nomeRobot = new String[nomeRobotAus.length];
136 for (int i=0; i<nomeRobotAus.length; i++) {
137 nomeRobotAus[i] = (addName(nomeRobot, newName))[i];
138 }
139 for (int i=0; i<nomeRobotAus.length; i++) {
140 this.nomeRobot[i] = nomeRobotAus[i];
141 }
142 return "È stato creato il robottino " + newName;
143 }
144 else if (comando.equalsIgnoreCase("deleterobot"))
145 return "Comando non disponibile in questa versione del programma";
146 else if (comando.equalsIgnoreCase("changerobot")) {
147 if (pdr.length==1) {
148 return "Hai solo un robottino, non puoi cambiarlo con un altro!";
149 }
150 else {
151 System.out.println ("A quale robottino vuoi dare i comandi?");
152 System.out.println ("");
153 for (int numRobot = 0; numRobot<this.pdr.length; numRobot++) {
154 System.out.println (numRobot + ". " + this.nomeRobot[numRobot]);
155 }
156 System.out.println ("");
157 System.out.println ("Digita il numero corrispondente alla tua scelta e premi INVIO");
158 this.robotIndex = sc2.nextInt();
159 if (this.robotIndex<this.pdr.length)
160 return "È stato selezionato il robottino numero " + this.robotIndex + ": " + this.nomeRobot[this.robotIndex];
161 else
162 return "Numero non valido";
163 }
164 }
165 else if (comando.equalsIgnoreCase("robotlist")) {
166 for (int numRobot = 0; numRobot<this.pdr.length; numRobot++) {
167 System.out.println (numRobot + ". " + this.nomeRobot[numRobot]);
168 }
169 return "";
170 }
171 else if (comando.equalsIgnoreCase("l")) {
172 System.out.println ("Legenda comandi");
173 System.out.println ("");
174 System.out.println ("Comandi relativi agli arti");
175 System.out.println ("");
176 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
177 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
178 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
179 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
180 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
181 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
182 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
183 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
184 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
185 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
186 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
187 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
188 System.out.println ("");
189 System.out.println ("Altri comandi:");
190 System.out.println ("");
191 System.out.println ("NewRobot: aggiunge un nuovo robot");
192 System.out.println ("ChangeRobot: cambia il robot attuale");
193 System.out.println ("RobotList: visualizza la lista dei robot");
194 System.out.println ("Rename: rinomina il robottino");
195 System.out.println ("");
196 System.out.println ("Comandi a sorpresa:");
197 System.out.println ("");
198 System.out.println ("Exploud");
199 System.out.println ("Bier");
200 System.out.println ("Porky");
201 System.out.println ("xxx");
202 System.out.println ("dance");
203 System.out.println ("");
204 System.out.println ("Exit: esci dal programma");
205 return "";
206
207 }
208 else if (comando.equalsIgnoreCase("exit"))
209 return "";
210 else
211 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
212 System.out.println ("");
213 for (int i = 0, j = 0; i < pdr[this.robotIndex].length; i++) {
214 if (pdr[robotIndex][i].statoParte) {
215 contatore += 1;
216 stat[j++] = pdr[this.robotIndex][i].stringaParte;
217 }
218 }
219 switch (contatore) {
220 case 0:
221 Return = "Comunque il robottino " + nomeRobot[this.robotIndex] + "non sta facendo niente";
222 break;
223 case 1:
224 Return = "Immagini che il robottino " + nomeRobot[this.robotIndex] + "abbia " + stat[0] + ".";
225 break;
226 case 2:
227 Return = "Immagini che il robottino " + nomeRobot[this.robotIndex] + "abbia " + stat[0] + " e " + stat[1] + ".";
228 break;
229 case 3:
230 Return = "Immagini che il robottino " + nomeRobot[this.robotIndex] + "abbia " + stat[0] + ", " + stat[1] + " e " + stat[2] + ".";
231 break;
232 case 4:
233 Return = "Immagini che il robottino " + nomeRobot[this.robotIndex] + "abbia " + stat[0] + ", " + stat[1] + ", " + stat[2] + " e " + stat[3] + ".";
234 break;
235 }
236 return Return;
237 }
238 static PartiDelRobot[][] addRobot(PartiDelRobot pdrOld[][], PartiDelRobot pdrElement[]) {
239 PartiDelRobot pdrNew[][] = new PartiDelRobot [pdrOld.length+1][pdrOld[pdrOld.length-1].length];
240 for (int i=0; i<pdrOld.length; i++) {
241 for (int j=0; j<pdrOld[i].length; j++) {
242 pdrNew[i][j] = new PartiDelRobot(pdrOld[i][j].statoParte, pdrOld[i][j].stringaParte);
243 }
244 }
245 for (int i=0; i<pdrElement.length; i++) {
246 pdrNew[pdrNew.length-1][i] = new PartiDelRobot(false, pdrElement[i].stringaParte);
247 }
248 return pdrNew;
249 }
250 static String[] addName(String nomeRobot[], String name) {
251 String nomeNewRobot[] = new String [nomeRobot.length+1];
252 for (int i=0; i<nomeRobot.length; i++) {
253 nomeNewRobot[i] = nomeRobot[i];
254 }
255 nomeNewRobot[nomeNewRobot.length-1] = name;
256 if (!(nomeNewRobot[nomeNewRobot.length-1].equalsIgnoreCase(""))) {
257 nomeNewRobot[nomeNewRobot.length-1] += " ";
258 }
259 return nomeNewRobot;
260 }
261}
262
263
264
265
266
267
268
269
270
diff --git a/robottino/all_versions/v2.1/Esegui.bat b/robottino/all_versions/v2.1/Esegui.bat
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v2.1/Esegui.bat
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v2.1/Esegui.sh b/robottino/all_versions/v2.1/Esegui.sh
new file mode 100755
index 0000000..1eb0b2e
--- /dev/null
+++ b/robottino/all_versions/v2.1/Esegui.sh
@@ -0,0 +1,2 @@
1cd ./bin
2java Robottino
diff --git a/robottino/all_versions/v2.1/Readme.txt b/robottino/all_versions/v2.1/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v2.1/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v2.1/bin/PartiDelRobot.class b/robottino/all_versions/v2.1/bin/PartiDelRobot.class
new file mode 100755
index 0000000..e6ffdb4
--- /dev/null
+++ b/robottino/all_versions/v2.1/bin/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v2.1/bin/Robottino.class b/robottino/all_versions/v2.1/bin/Robottino.class
new file mode 100755
index 0000000..b189de4
--- /dev/null
+++ b/robottino/all_versions/v2.1/bin/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v2.1/src/PartiDelRobot.java b/robottino/all_versions/v2.1/src/PartiDelRobot.java
new file mode 100755
index 0000000..3399dbc
--- /dev/null
+++ b/robottino/all_versions/v2.1/src/PartiDelRobot.java
@@ -0,0 +1,9 @@
1public class PartiDelRobot {
2 PartiDelRobot() { };
3 PartiDelRobot(boolean b, String s) {
4 this.stringaParte = s;
5 this.statoParte = b;
6 }
7 public String stringaParte;
8 public boolean statoParte;
9}
diff --git a/robottino/all_versions/v2.1/src/Robottino.java b/robottino/all_versions/v2.1/src/Robottino.java
new file mode 100755
index 0000000..550e027
--- /dev/null
+++ b/robottino/all_versions/v2.1/src/Robottino.java
@@ -0,0 +1,258 @@
1import java.util.Scanner;
2import java.util.Vector;
3class Robottino extends PartiDelRobot {
4 static Robottino robottino = new Robottino();
5 static Vector pdrA = new Vector(1);
6 static Vector pdrB = new Vector(4);
7 static PartiDelRobot leftArm = new PartiDelRobot(false, "il braccio sinistro alzato");
8 static PartiDelRobot rightArm = new PartiDelRobot(false, "il braccio destro alzato");
9 static PartiDelRobot leftLeg = new PartiDelRobot(false, "la gamba sinistra alzata");
10 static PartiDelRobot rightLeg = new PartiDelRobot(false, "la gamba destra alzata");
11 static Vector nomeRobot = new Vector(1);
12 static int robotIndex = 0;
13 public static void main(String argv[]) {
14 pdrB.addElement(leftArm);
15 pdrB.addElement(rightArm);
16 pdrB.addElement(leftLeg);
17 pdrB.addElement(rightLeg);
18 pdrA.addElement(pdrB);
19 nomeRobot.addElement("");
20 Scanner sc = new Scanner(System.in);
21 String comando;
22 System.out.println ("**********************************************");
23 System.out.println ("**********************************************");
24 System.out.println ("*************Programma interattivo************");
25 System.out.println ("**********************************************");
26 System.out.println ("***Software realizzato da Sebastiano Tronto***");
27 System.out.println ("**********************************************");
28 System.out.println ("**********************************************");
29 System.out.println ("Questo programma simula un robot al quale ven-");
30 System.out.println ("gono assegnati ordini tramite comandi, simil-" );
31 System.out.println ("mente a quanto bisognava fare con i computer " );
32 System.out.println ("alcuni anni fa." );
33 System.out.println ("Dato che all'epoca i comandi che dovevano es-" );
34 System.out.println ("sere dati erano (e sono tutt'ora) in similin-" );
35 System.out.println ("glese, ho cercato di mantenerli tali." );
36 System.out.println ("Il programma non fa distinzioni tra lettere" );
37 System.out.println ("maiuscole o minuscole." );
38 System.out.println ("In questa versione non sono ancora disponibi-" );
39 System.out.println ("li immagini e/o effetti grafici." );
40 System.out.println ("" );
41 System.out.println ("Digita un comando e premi INVIO" );
42 System.out.println ("l = legenda comandi" );
43 System.out.println ("");
44 do {
45 comando = sc.nextLine();
46 System.out.println ("");
47 System.out.println (robottino.Azioni(comando, nomeRobot, pdrA));
48 System.out.println ("");
49 } while ( !(comando.equalsIgnoreCase("exit")) );
50 }
51 String Azioni(String comando, Vector nomeRobot, Vector pdrA) {
52 Scanner sc2 = new Scanner(System.in);
53 int contatore = 0;
54 String stat[] = {"", "", "", ""};
55 String Return = "Errore - si consiglia di picchiare il programmatore";
56 if (comando.equalsIgnoreCase("leftarmmove"))
57 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte;
58 else if (comando.equalsIgnoreCase("rightarmmove"))
59 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte;
60 else if (comando.equalsIgnoreCase("leftlegmove"))
61 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte;
62 else if (comando.equalsIgnoreCase("rightlegmove"))
63 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte;
64 else if (comando.equalsIgnoreCase("leftarmon"))
65 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = true;
66 else if (comando.equalsIgnoreCase("rightarmon"))
67 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = true;
68 else if (comando.equalsIgnoreCase("leftlegon"))
69 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = true;
70 else if (comando.equalsIgnoreCase("rightlegon"))
71 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = true;
72 else if (comando.equalsIgnoreCase("leftarmoff"))
73 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = false;
74 else if (comando.equalsIgnoreCase("rightarmoff"))
75 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = false;
76 else if (comando.equalsIgnoreCase("leftlegoff"))
77 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = false;
78 else if (comando.equalsIgnoreCase("rightlegoff"))
79 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = false;
80 else if (comando.equalsIgnoreCase("exploud")) {
81 System.out.println ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot.elementAt(this.robotIndex) + "! Aspetta che te ne faccio un altro");
82 System.out.println ("...");
83 for (int i = 0; i < 4; i++) {
84 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
85 }
86 this.nomeRobot.setElementAt("", this.robotIndex);
87 return "Fatto, puoi continuare a giocare";
88 }
89 else if (comando.equalsIgnoreCase("bier")) {
90 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "sta trangugiando una birra...");
91 System.out.println ("Buurrrrrrrrp!");
92 return "La birra analcolica fa schifo!";
93 }
94 else if (comando.equalsIgnoreCase("rename")) {
95 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot.elementAt(this.robotIndex));
96 System.out.println ("Digita il nuovo nome e premi invio per coninuare");
97 this.nomeRobot.setElementAt(sc2.nextLine(), this.robotIndex);
98 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
99 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
100 return "Ora il robottino si chiama " + nomeRobot.elementAt(this.robotIndex);
101 }
102 else if (comando.equalsIgnoreCase("porky")) {
103 System.out.println ("Porky è un grande");
104 System.out.println ("Per maggiori informazioni visita il sito");
105 return "http://kakati.forumfree.net/";
106 }
107 else if (comando.equalsIgnoreCase("xxx")) {
108 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "ha incontrato una bella robottina...");
109 return "*Censura*";
110 }
111 else if (comando.equalsIgnoreCase("dance")) {
112 System.out.println ("Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + " stia ballando...");
113 System.out.println ("Il robottino ha smesso di ballare");
114 for (int i = 0; i < 4; i++) {
115 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
116 }
117 return "Il robottino " + nomeRobot.elementAt(this.robotIndex) + "si è fermato ed è tornato nella posizione originale";
118 }
119 else if (comando.equalsIgnoreCase("newrobot")) {
120 this.pdrA.addElement(pdrB);
121 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftArm);
122 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightArm);
123 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftLeg);
124 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightLeg);
125 System.out.println ("È stato creato un nuovo robot. Vuoi dare un nome al nuovo robot?");
126 System.out.println ("Inserisci il nuovo nome e premi INVIO oppure lascia vuoto e premi INVIO");
127 String newName = sc2.nextLine();
128 this.nomeRobot.addElement(newName);
129 return "È stato creato il robottino " + newName;
130 }
131 else if (comando.equalsIgnoreCase("deleterobot")) {
132 if (pdrA.size()>1) {
133 System.out.println ("Quale robottino vuoi eliminare?");
134 System.out.println ("");
135 for (int i = 0; i<this.pdrA.size(); i++) {
136 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
137 }
138 System.out.println ("");
139 System.out.println("Scegliere il robottino da eliminare digitando il numero corrispondente e premendo INVIO");
140 System.out.println("Digitare un qualunque altro numero e premere INVIO per annullare");
141 int num = sc2.nextInt();
142 if (num<this.pdrA.size()) {
143 this.pdrA.removeElementAt(num);
144 this.nomeRobot.removeElementAt(num);
145 return "È stato eliminato il robottino numero " + num;
146 }
147 else {
148 return "Operazione annullata";
149 }
150 }
151 else {
152 return "Hai solo un robottino, non puoi eliminarlo!";
153 }
154 }
155 else if (comando.equalsIgnoreCase("changerobot")) {
156 if (pdrA.size()>1) {
157 System.out.println ("A quale robottino vuoi dare i comandi?");
158 System.out.println ("");
159 for (int i = 0; i<this.pdrA.size(); i++) {
160 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
161 }
162 System.out.println ("");
163 System.out.println ("Digita il numero corrispondente alla tua scelta e premi INVIO");
164 this.robotIndex = sc2.nextInt();
165 if (this.robotIndex<this.pdrA.size())
166 return "È stato selezionato il robottino numero " + this.robotIndex + ": " +
167 this.nomeRobot.elementAt(this.robotIndex);
168 else
169 return "Numero non valido";
170 }
171 else {
172 return "Hai solo un robottino, non puoi cambiarlo con un altro!";
173 }
174 }
175 else if (comando.equalsIgnoreCase("robotlist")) {
176 for (int i = 0; i<this.pdrA.size(); i++) {
177 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
178 }
179 return "";
180 }
181 else if (comando.equalsIgnoreCase("l")) {
182 System.out.println ("Legenda comandi");
183 System.out.println ("");
184 System.out.println ("Comandi relativi agli arti");
185 System.out.println ("");
186 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
187 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
188 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
189 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
190 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
191 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
192 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
193 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
194 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
195 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
196 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
197 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
198 System.out.println ("");
199 System.out.println ("Altri comandi:");
200 System.out.println ("");
201 System.out.println ("NewRobot: aggiunge un nuovo robot");
202 System.out.println ("ChangeRobot: cambia il robot attuale");
203 System.out.println ("RobotList: visualizza la lista dei robot");
204 System.out.println ("Rename: rinomina il robottino");
205 System.out.println ("DeleteRobot: rimuovi un robottino");
206 System.out.println ("");
207 System.out.println ("Comandi a sorpresa:");
208 System.out.println ("");
209 System.out.println ("Exploud");
210 System.out.println ("Bier");
211 System.out.println ("Porky");
212 System.out.println ("xxx");
213 System.out.println ("dance");
214 System.out.println ("");
215 System.out.println ("Exit: esci dal programma");
216 return "";
217
218 }
219 else if (comando.equalsIgnoreCase("exit"))
220 return "";
221 else
222 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
223 System.out.println ("");
224 for (int i = 0, j = 0; i < ((Vector)pdrA.elementAt(this.robotIndex)).size(); i++) {
225 if (((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte) {
226 contatore += 1;
227 stat[j++] = ((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).stringaParte;
228 }
229 }
230 switch (contatore) {
231 case 0:
232 Return = "Comunque il robottino " + nomeRobot.elementAt(this.robotIndex) + "non sta facendo niente";
233 break;
234 case 1:
235 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ".";
236 break;
237 case 2:
238 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + " e " + stat[1] + ".";
239 break;
240 case 3:
241 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ", " + stat[1] + " e " + stat[2] + ".";
242 break;
243 case 4:
244 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ", " + stat[1] + ", " + stat[2] + " e " + stat[3] + ".";
245 break;
246 }
247 return Return;
248 }
249}
250
251
252
253
254
255
256
257
258
diff --git a/robottino/all_versions/v2.2/Esegui.bat b/robottino/all_versions/v2.2/Esegui.bat
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v2.2/Esegui.bat
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v2.2/Esegui.sh b/robottino/all_versions/v2.2/Esegui.sh
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v2.2/Esegui.sh
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v2.2/Readme.txt b/robottino/all_versions/v2.2/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v2.2/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v2.2/bin/RobottinoAzioni/RobottinoAzioni.class b/robottino/all_versions/v2.2/bin/RobottinoAzioni/RobottinoAzioni.class
new file mode 100755
index 0000000..16a771f
--- /dev/null
+++ b/robottino/all_versions/v2.2/bin/RobottinoAzioni/RobottinoAzioni.class
Binary files differ
diff --git a/robottino/all_versions/v2.2/bin/RobottinoMain/Robottino.class b/robottino/all_versions/v2.2/bin/RobottinoMain/Robottino.class
new file mode 100755
index 0000000..d65be46
--- /dev/null
+++ b/robottino/all_versions/v2.2/bin/RobottinoMain/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v2.2/bin/RobottinoUtils/Grafica.class b/robottino/all_versions/v2.2/bin/RobottinoUtils/Grafica.class
new file mode 100755
index 0000000..b5f50a9
--- /dev/null
+++ b/robottino/all_versions/v2.2/bin/RobottinoUtils/Grafica.class
Binary files differ
diff --git a/robottino/all_versions/v2.2/bin/RobottinoUtils/Listener.class b/robottino/all_versions/v2.2/bin/RobottinoUtils/Listener.class
new file mode 100755
index 0000000..d5b67f0
--- /dev/null
+++ b/robottino/all_versions/v2.2/bin/RobottinoUtils/Listener.class
Binary files differ
diff --git a/robottino/all_versions/v2.2/bin/RobottinoUtils/PartiDelRobot.class b/robottino/all_versions/v2.2/bin/RobottinoUtils/PartiDelRobot.class
new file mode 100755
index 0000000..fcc8e9e
--- /dev/null
+++ b/robottino/all_versions/v2.2/bin/RobottinoUtils/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v2.2/src/RobottinoAzioni/RobottinoAzioni.java b/robottino/all_versions/v2.2/src/RobottinoAzioni/RobottinoAzioni.java
new file mode 100755
index 0000000..96ad922
--- /dev/null
+++ b/robottino/all_versions/v2.2/src/RobottinoAzioni/RobottinoAzioni.java
@@ -0,0 +1,369 @@
1// Dichiaro che questa classa farà parte del package RobottinoAzioni, che verrà poi importato dalle classi Robottino e Grafica.
2package RobottinoAzioni;
3
4// Anche qui impoerto i package necessari.
5import java.util.Scanner;
6import java.util.Vector;
7import RobottinoUtils.*;
8
9public class RobottinoAzioni {
10
11 // Creo gli oggetti statici che riempiranno il vettore pdrA:
12 // pdrA è un vettore multidimensionale che a sua volta contiene vettori
13 // (il primo si chiama pdrB, i successivi non avranno nome) che coontengono
14 // 4 istanze di PartiDelRobot, cioè i 4 arti del robot.
15 // Poi creo un vettore che conterrà i nomi dei robot.
16 // Creo il vettore principale...
17 public static Vector pdrA = new Vector(1);
18
19 // ...e il "sottovettore" come istanze della classe Vector
20 public static Vector pdrB = new Vector(4);
21
22 // Creo le quattro istanze di PartidelRobot utilizzando l'apposito costruttore
23 // passo a tutte una stringa e un valore boleano che determina lo stato
24 // (alzato/a se true, abbassato/a se false).
25 public static PartiDelRobot leftArm = new PartiDelRobot(false, "il braccio sinistro alzato");
26 public static PartiDelRobot rightArm = new PartiDelRobot(false, "il braccio destro alzato");
27 public static PartiDelRobot leftLeg = new PartiDelRobot(false, "la gamba sinistra alzata");
28 public static PartiDelRobot rightLeg = new PartiDelRobot(false, "la gamba destra alzata");
29
30 // Il vettore nomeRobot per i nomi
31 // il vettore può contenere stringhe, poichè non sono tipi primitivi ma oggetti della classe String
32 public static Vector nomeRobot = new Vector(1);
33
34 // La variabile robotIndex serve a tenere in memoria su quale robot si sta operando:
35 // in seguito verrà usata quando l'utente deciderà di creare più di un robot
36 // e poi di dare comandi a uno o all'altro/i.
37 int robotIndex = 0;
38
39 // Dichiarazione del metodo Azioni.
40 public String Azioni(String comando, Vector nomeRobot, Vector pdrA) {
41
42 // Crea un'istanza della classe Scanner per
43 // ricevere gli input nel caso in cui debba essere dato il nome
44 // al robottino o scelto un robottino da una lista.
45 Scanner sc2 = new Scanner(System.in);
46
47 // La variabile contatore memorizza il numero di variabili "PartiDelRobot.statoParte"
48 // che hanno valore true, ossia il numero di arti alzati di un robottino
49 // in modo da poter scegliere la frase giusta da dare come output
50 // al posto dell'immagine del robottino con tali arti alzati.
51 int contatore = 0;
52
53 // Questo array ha il compito di memorizzare le stringhe corrispondenti agli alzati
54 // per motivi simili a quelli della variabile "contatore".
55 String stat[] = {"", "", "", ""};
56
57 // La stringa Return verrà successivamente modificata e restituita in alcuni casi.
58 String Return = "Errore - si consiglia di picchiare il programmatore";
59
60 // Per far si che il programma non distingua tra lettere maiuscole o minuscole per quanto riguardo gli input
61 // è stato usato il metodo "equalsIgnoreCase" della classe String.
62 // I quattro casi successivi cambiano il valore della varibalie "statoParte" relativa all'arto
63 // Che deve mouversi (quindi cambiare la sua posizione).
64 if (comando.equalsIgnoreCase("leftarmmove"))
65 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte =
66 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte;
67
68 else if (comando.equalsIgnoreCase("rightarmmove"))
69 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte =
70 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte;
71
72 else if (comando.equalsIgnoreCase("leftlegmove"))
73 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte =
74 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte;
75
76 else if (comando.equalsIgnoreCase("rightlegmove"))
77 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte =
78 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte;
79
80 // I casi successivi modificano il valore della varibile analogamente ai 4 precedenti.
81 else if (comando.equalsIgnoreCase("leftarmon"))
82 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = true;
83
84 else if (comando.equalsIgnoreCase("rightarmon"))
85 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = true;
86
87 else if (comando.equalsIgnoreCase("leftlegon"))
88 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = true;
89
90 else if (comando.equalsIgnoreCase("rightlegon"))
91 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = true;
92
93 else if (comando.equalsIgnoreCase("leftarmoff"))
94 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = false;
95
96 else if (comando.equalsIgnoreCase("rightarmoff"))
97 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = false;
98
99 else if (comando.equalsIgnoreCase("leftlegoff"))
100 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = false;
101
102 else if (comando.equalsIgnoreCase("rightlegoff"))
103 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = false;
104
105 // Il caso successi si verica quando il comando è "exploud".
106 else if (comando.equalsIgnoreCase("exploud")) {
107
108 // Scrive sullo schermo la seguente frase, che comprende il nome del robottino che non è ancora stato fatto eliminare
109 System.out.println
110 ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot.elementAt(this.robotIndex) + "! Aspetta che te ne faccio un altro");
111 System.out.println ("...");
112
113 // Con un ciclo for rendo false tutte le variabili "statoParte" per far sì che il robottino sia come nuovo.
114 for (int i = 0; i < 4; i++) {
115 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
116 }
117
118 // E azzero anche il nome del robot
119 this.nomeRobot.setElementAt("", this.robotIndex);
120
121 return "Fatto, puoi continuare a giocare";
122 }
123
124 // Caso per il comando "bier".
125 // La reazione a questo comando è un semplice output quasi totalmente scorrelato al robottino
126 // se non per il fatto che appare il nome del robottino attuale.
127 else if (comando.equalsIgnoreCase("bier")) {
128 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "sta trangugiando una birra...");
129 System.out.println ("Buurrrrrrrrp!");
130 return "La birra analcolica fa schifo!";
131 }
132
133 // Per il comando "rename", rinomina.
134 else if (comando.equalsIgnoreCase("rename")) {
135
136 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot.elementAt(this.robotIndex));
137 System.out.println ("Digita il nuovo nome e premi INVIO per coninuare");
138
139 // Cambia il nome del robottino attuale con quello dell'input.
140 this.nomeRobot.setElementAt(sc2.nextLine(), this.robotIndex);
141
142 // Se il nome non è vuoto, aggiunge un carattere di spazio per migliorare la visualizzazione nelle frasi di output.
143 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
144 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
145
146 // Semplice output con il nuovo nome.
147 return "Ora il robottino si chiama " + nomeRobot.elementAt(this.robotIndex);
148 }
149
150 // Per il comando "porky".
151 // Ancora meno che per "bier".
152 else if (comando.equalsIgnoreCase("porky")) {
153 System.out.println ("Porky è un grande");
154 System.out.println ("Per maggiori informazioni visita il sito");
155 return "http://kakati.forumfree.net/";
156 }
157
158 // Il comando "xxx" ha funzioni analoghe a bier.
159 else if (comando.equalsIgnoreCase("xxx")) {
160 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "ha incontrato una bella robottina...");
161 return "*Censura*";
162 }
163
164 // "dance" setta tutte le variabili "statoParte" a false...
165 else if (comando.equalsIgnoreCase("dance")) {
166
167 System.out.println ("Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + " stia ballando...");
168 System.out.println ("Il robottino ha smesso di ballare");
169
170 //...con questo ciclo for
171 for (int i = 0; i < 4; i++) {
172 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
173 }
174
175 return "Il robottino " + nomeRobot.elementAt(this.robotIndex) + "si è fermato ed è tornato nella posizione originale";
176
177 // Per il comando "newrobot", che crea un nuovo robottino.
178 }
179 else if (comando.equalsIgnoreCase("newrobot")) {
180
181 // Aggiunge un elemento a "pdrA" con il metodo "addElement", della classe Vector.
182 // È stata necessaria la dicitura this. per modificare realmente il vettore.
183 // Se non lo avessi fatto non sarebbe successo, in quanto i metodi operano
184 // su i valori e non sulle variabili/oggetti.
185 this.pdrA.addElement(pdrB);
186
187 // Aggiungo le 4 parti del robot.
188 // Forse avete già notato (ma quì sono più evidenti) alcuni cast che ho fatto:
189 // sono per far si che il compilatore capisca che il metodo viene invocato da un oggetto
190 // della classe vector, che senza cast considererebbe della classe Object.
191 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftArm);
192 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightArm);
193 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftLeg);
194 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightLeg);
195
196 // Semplice output con richiesta di nome per il nuovo robottino.
197 System.out.println ("È stato creato un nuovo robot. Vuoi dare un nome al nuovo robot?");
198 System.out.println ("Inserisci il nuovo nome e premi INVIO oppure lascia vuoto e premi INVIO");
199
200 String newName = sc2.nextLine();
201
202 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
203 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
204
205 this.nomeRobot.addElement(newName);
206
207 return "È stato creato il robottino " + newName;
208 }
209
210 // Il comando "deleterobot", per eliminare un robot.
211 else if (comando.equalsIgnoreCase("deleterobot")) {
212
213 // Se c'è più di un robot esegue l'eliminazione.
214 if (pdrA.size()>1) {
215 System.out.println ("Quale robottino vuoi eliminare?");
216 System.out.println ("");
217
218 // Con un ciclo for scrive i nomi di tutti i robot preceduti da un numero in sequenza.
219 // Il numero è il corrispondente del loro indice di vettore.
220 for (int i = 0; i<this.pdrA.size(); i++) {
221 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
222 }
223
224 // Dà le istruzioni all'utente affinché capisca come eliminare un robot.
225 System.out.println ("");
226 System.out.println("Scegliere il robottino da eliminare digitando il numero corrispondente e premendo INVIO");
227 System.out.println("Digitare un qualunque altro numero e premere INVIO per annullare");
228
229 // Riceve in input il numero e ne assegna il valore alla variabile "num".
230 int num = sc2.nextInt();
231
232 // Elimina gli elementi corrispondenti al robottino (nome e robot) dai
233 // rispettivi vettori con il metodo "removeElementAt" della classe Vector.
234 if (num<this.pdrA.size()) {
235 this.pdrA.removeElementAt(num);
236 this.nomeRobot.removeElementAt(num);
237 return "È stato eliminato il robottino numero " + num;
238 }
239
240 // Se il numero ricevuto in input è superiore all'indice dei robot
241 // non elimina alcun robot.
242 else return "Operazione annullata";
243 }
244
245 // Se c'è solo un robot non esegue l'eliminazione.
246 else return "Hai solo un robottino, non puoi eliminarlo!";
247 }
248
249 // Il comando "changerobot" per cambiare il robot a cui dare le istruzioni
250 else if (comando.equalsIgnoreCase("changerobot")) {
251
252 // L'esecuzione è simile a quella per il comando "deleterobot", con la differenza che il robot non viene eliminato
253 // ma viene semplicemente cambiato il valore della variabile "robotIndex".
254 if (pdrA.size()>1) {
255 System.out.println ("A quale robottino vuoi dare i comandi?");
256 System.out.println ("");
257 for (int i = 0; i<this.pdrA.size(); i++) {
258 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
259 }
260 System.out.println ("");
261 System.out.println ("Digita il numero corrispondente alla tua scelta e premi INVIO");
262 int newIndex = sc2.nextInt();
263
264 // Prima di cambiare valore alla variabile di indice verifica che il numero sia valido.
265 if (newIndex<this.pdrA.size()) {
266 this.robotIndex = newIndex;
267 return "È stato selezionato il robottino numero " + this.robotIndex + ": " + this.nomeRobot.elementAt
268 (this.robotIndex);
269 }
270
271 // Se non lo è non esegue l'assegnamento.
272 else return "Numero non valido";
273 }
274 else {
275 return "Hai solo un robottino, non puoi cambiarlo con un altro!";
276 }
277 }
278
279 // Il comando "robotlist" visualizza una lista dei robot presenti.
280 else if (comando.equalsIgnoreCase("robotlist")) {
281 for (int i = 0; i<this.pdrA.size(); i++) {
282 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
283 }
284 return "";
285 }
286
287 // Il comando "l", per la legenda, visualizza la lista dei comandi con relativa descrizione.
288 else if (comando.equalsIgnoreCase("l")) {
289 System.out.println ("Legenda comandi");
290 System.out.println ("");
291 System.out.println ("Comandi relativi agli arti");
292 System.out.println ("");
293 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
294 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
295 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
296 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
297 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
298 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
299 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
300 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
301 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
302 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
303 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
304 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
305 System.out.println ("");
306 System.out.println ("Altri comandi:");
307 System.out.println ("");
308 System.out.println ("NewRobot: aggiunge un nuovo robot");
309 System.out.println ("ChangeRobot: cambia il robot attuale");
310 System.out.println ("RobotList: visualizza la lista dei robot");
311 System.out.println ("Rename: rinomina il robottino");
312 System.out.println ("");
313 System.out.println ("Comandi a sorpresa:");
314 System.out.println ("");
315 System.out.println ("Exploud");
316 System.out.println ("Bier");
317 System.out.println ("Porky");
318 System.out.println ("xxx");
319 System.out.println ("dance");
320 System.out.println ("");
321 System.out.println ("Exit: esci dal programma");
322
323 return "";
324
325 }
326
327 // Se il comando è exit, non viene eseguita nessuna operazione (tranne restituire una stringa vuota)
328 // Perché il ciclo do-while nel metodo main, appena verificherà la condizione che il comando è
329 // uguale a "exit", terminerà da solo l'esecuzione del programma.
330 else if (comando.equalsIgnoreCase("exit")) return "";
331
332 // Se l'input non è tra i comandi prestabiliti, visualizza la seguente scritta sullo schermo.
333 else
334 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
335 System.out.println ("");
336
337 // Quì di seguito viene chiarito l'utilizzo di "contatore" e "sta[]".
338 // Per ogni varibile "statoParte" che ha valore true, contatore viene incrementato
339 // e l'elemento successivo dell'array "stat[]" assume il valore della stringa corrispondente.
340 for (int i = 0, j = 0; i < 4; i++) {
341 if (((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte) {
342 contatore += 1;
343 stat[j++] = ((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).stringaParte;
344 }
345 }
346
347 // La restituzione finale delle frasi, con uno switch che a seconda del valore di contatore
348 // restituisce una frase o l'altra.
349 switch (contatore) {
350 case 0:
351 Return = "Comunque il robottino " + nomeRobot.elementAt(this.robotIndex) + "non sta facendo niente";
352 break;
353 case 1:
354 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ".";
355 break;
356 case 2:
357 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + " e " + stat[1] + ".";
358 break;
359 case 3:
360 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ", " + stat[1] + " e " + stat[2] + ".";
361 break;
362 case 4:
363 Return = "Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + "abbia " + stat[0] + ", " + stat[1] + ", " + stat[2] + " e " + stat[3] + ".";
364 break;
365 }
366 return Return;
367 }
368 //Fine del metodo Azioni
369}
diff --git a/robottino/all_versions/v2.2/src/RobottinoMain/Robottino.java b/robottino/all_versions/v2.2/src/RobottinoMain/Robottino.java
new file mode 100755
index 0000000..37e2dff
--- /dev/null
+++ b/robottino/all_versions/v2.2/src/RobottinoMain/Robottino.java
@@ -0,0 +1,115 @@
1// Robottino versione 2.2
2// Da questa versione illustrerò tutte le parti del programma con dei commenti come questo.
3
4// Dichiaro che questa classe fa parte del package RobottinoMain, che verrà poi importato
5// dalle classi che dovranno interagire con essa.
6package RobottinoMain;
7
8// Importo le librerie iniziali:
9// java.Util.Scanner per gestire gli input da tastiera.
10import java.util.Scanner;
11
12// java.util.Vector serve a gestire i vettori.
13// I vettori sono come array, ma hanno due differenze principali:
14// 1) la loro lunghezza può variare durante l'esecuzione del programma
15// (per questo li ho preferiti agli array);
16// 2) possono contenere soltanto oggetti, e non tipi primitivi.
17import java.util.Vector;
18
19// Questo è il package di utility da me creato per semplificare l'utilizzo degli elementi di altre classi
20// (Grafica, PartiDelRobot). Nelle versioni precedenti c'erano solo le classi Robottino
21// e PartiDelRobot, percui avevo deciso di far sì che una fosse derivata dall'altra.
22import RobottinoUtils.*;
23
24// Altro package da me definito.
25import RobottinoAzioni.*;
26
27// Dichiaro la classe.
28public class Robottino {
29
30 // Istanzio anche le classi Robottino e RobottinoAzioni, per poter avere accesso agli elementi non-statici.
31 static Robottino robottino = new Robottino();
32 static RobottinoAzioni robottinoazioni = new RobottinoAzioni();
33
34 // Istanzio la classe Thread per poter utilizzare il metodo sleep(int millisecondi)
35 // che in un metodo dell'interfaccia WindowListener, overridato nella classe Listener
36 // servirà a mettere il programma in uno stato di pausa.
37 // Sarebbe comunque possibile invocarlo, ma così sarà più facile da modificare in futuro.
38 public static Thread threadMain;
39
40 // Inizio del metodo main...
41 public static void main(String[] args) {
42
43 threadMain = new Thread(Thread.currentThread());
44
45 // Aggiungo gli elementi ai vettori.
46 // non potevo farlo prima, poiché al di fuori di un metodo è possibile soltanto
47 // dichiarare oggetti/variabili (e inizializzarli) o dichiarare un metodo
48 // e in RobottinoAzioni è presente solo il metodo Azioni che viene richiamato più volte.
49 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftArm);
50 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightArm);
51 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftLeg);
52 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightLeg);
53 RobottinoAzioni.pdrA.addElement(RobottinoAzioni.pdrB);
54 RobottinoAzioni.nomeRobot.addElement("");
55
56 // Istanzio la classe Scanner per poter ricevere input
57 Scanner sc = new Scanner(System.in);
58
59 // Dichiaro la variabile comando che memorizzerà l'input dell'utente
60 String comando;
61
62 // Crea la finestra tramite un'istanza della classe Grafica, del package RobottinoUtils
63 Grafica finestra = new Grafica();
64
65 // Output iniziale nellla shell
66 System.out.println ("**********************************************");
67 System.out.println ("**********************************************");
68 System.out.println ("*************Programma interattivo************");
69 System.out.println ("**********************************************");
70 System.out.println ("***Software realizzato da Sebastiano Tronto***");
71 System.out.println ("**********************************************");
72 System.out.println ("**********************************************");
73 System.out.println ("Questo programma simula un robot al quale ven-");
74 System.out.println ("gono assegnati ordini tramite comandi, simil-" );
75 System.out.println ("mente a quanto bisognava fare con i computer " );
76 System.out.println ("alcuni anni fa." );
77 System.out.println ("Dato che all'epoca i comandi che dovevano es-" );
78 System.out.println ("sere dati erano (e sono tutt'ora) in similin-" );
79 System.out.println ("glese, ho cercato di mantenerli tali." );
80 System.out.println ("Il programma non fa distinzioni tra lettere" );
81 System.out.println ("maiuscole o minuscole." );
82 System.out.println ("da questa versione (2.2) sono disponibili ef-" );
83 System.out.println ("fetti grafici minimali e totalmente inutili." );
84 System.out.println ("" );
85 System.out.println ("Digita un comando e premi INVIO" );
86 System.out.println ("l = legenda comandi" );
87 System.out.println ("");
88
89 // Inizio del ciclo do-while che fa in modo di ricevere input ed eseguire il metodo "Azioni"
90 // fintando che il comando non è exit.
91 do {
92
93 // Inizializza la stringa comando con il valore dell'input.
94 comando = sc.nextLine();
95 System.out.println ("");
96
97 // Esegue il metodo "Azioni" passando come argomenti il comando e i due vettori.
98 System.out.println (robottinoazioni.Azioni(comando, RobottinoAzioni.nomeRobot, RobottinoAzioni.pdrA));
99 System.out.println ("");
100 } while ( !(comando.equalsIgnoreCase("exit")) );
101
102 // Al termine del metodo main invoco il metodo "System.exit" per terminare completamente l'esecuzione del programma
103 System.exit(0);
104 }
105 // Fine del metodo main.
106}
107
108
109
110
111
112
113
114
115
diff --git a/robottino/all_versions/v2.2/src/RobottinoUtils/Grafica.java b/robottino/all_versions/v2.2/src/RobottinoUtils/Grafica.java
new file mode 100755
index 0000000..25574a3
--- /dev/null
+++ b/robottino/all_versions/v2.2/src/RobottinoUtils/Grafica.java
@@ -0,0 +1,60 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Importo i package standard relativi al funzionamento delle finestre e della grafica in generale.
5import java.awt.*;
6
7// E i package RobottinoAzioni e RobottinoUtils da me definiti.
8import RobottinoAzioni.*;
9import RobottinoUtils.Listener;
10
11// La classe è una sottoclasse di Frame per poter sfruttare gli effetti grafici
12// ma implementa anche l'interfaccia WindowListener, necessaria per gestire gli eventi collegati alle finestre
13// (riduzione a icona, chiusura...); per questo devo successivamente ridefinire tutti i
14// metodi dell'interfaccia.
15public class Grafica extends Frame {
16
17 // Creo un'istanza della classe Listener che userò come listener per gli eventi.
18 public static Listener listener;
19
20 // Il costruttore senza argomenti.
21 public Grafica () {
22
23 // Il metodo "setBounds" posiziona e dimensiona la finestra.
24 setBounds (this.orizzontale, this.verticale, this.larghezza, this.altezza);
25
26 // "setTitle" per il titolo della finestra.
27 setTitle ("Robottino v2.2");
28
29 // "setVisible" per poterla visualizzare.
30 setVisible (true);
31
32 // E addWindowListener per l'ascoltatore (listener).
33 listener = new Listener();
34 addWindowListener (listener);
35 }
36
37 // Questo costruttore permette di modificare la posizione o la dimensione della finestra
38 // rispetto al predefinito.
39 public Grafica (int orizzontale, int verticale, int larghezza, int altezza) {
40 this.orizzontale =orizzontale;
41 this.verticale = verticale;
42 this.larghezza = larghezza;
43 this.altezza = altezza;
44 setBounds (this.orizzontale, this.verticale, this.larghezza, this.altezza);
45 setTitle ("Robottino v2.2");
46 setVisible (true);
47 listener = new Listener();
48 addWindowListener (listener);
49 }
50
51 // Le variabili pubbliche di classe per il metodo "setBounds".
52 public int orizzontale = 0;
53 public int verticale = 0;
54 public int larghezza = 500;
55 public int altezza = 500;
56}
57
58
59
60
diff --git a/robottino/all_versions/v2.2/src/RobottinoUtils/Listener.java b/robottino/all_versions/v2.2/src/RobottinoUtils/Listener.java
new file mode 100755
index 0000000..7ff51d6
--- /dev/null
+++ b/robottino/all_versions/v2.2/src/RobottinoUtils/Listener.java
@@ -0,0 +1,62 @@
1// Questa classe è il listener per gli eventi relativi alle finestre.
2// Dichiaro che farà parte del package RobottinoUtils
3package RobottinoUtils;
4
5// Importo i package necessari.
6import java.awt.event.*;
7import RobottinoMain.*;
8
9public class Listener implements WindowListener {
10
11 // Ridefinisco i metodi dell'interfaccia WindowListener:
12 // Metodo invocato quando la finestra è stata chiusa:
13 public void windowClosed (WindowEvent evt) {
14
15 // Invoco il metodo sleep(int millisecondi) per mettere il programma in uno stato di attesa
16 // di durata pari ai millisecondi indicati come argomento.
17 System.out.println("La finestra è stata chiusa, il programma terminarà fra 3 secondi");
18 try {
19 Robottino.threadMain.sleep(1000);
20 } catch (Exception e) { e.printStackTrace(); }
21 System.out.println("2");
22 try {
23 Robottino.threadMain.sleep(1000);
24 } catch (Exception e) { e.printStackTrace(); }
25 System.out.println("1");
26 try {
27 Robottino.threadMain.sleep(1000);
28 } catch (Exception e) { e.printStackTrace(); }
29 System.out.println("Programma terminato");
30 System.exit(0);
31 }
32
33 // Metodo invocato quando la finestra è in fase di chiusura:
34 public void windowClosing (WindowEvent evt) {
35 System.out.println ("Chiusura finestra in corso");
36 evt.getWindow().dispose();
37 }
38
39 // Metodo invocato quando una finestra viene ridotta a icona:
40 public void windowIconified (WindowEvent evt) {
41 System.out.println("La finestra è stata ridotta a icona");
42 }
43
44 // Metodo invocato quando una finestra ridotta a icona viene ingrandita:
45 public void windowDeiconified (WindowEvent evt) {
46 System.out.println("La finestra ridotta a icona è stata ingrandita");
47 }
48
49 // Metodo invocato quando una finestra viene aperta:
50 public void windowOpened (WindowEvent evt) {}
51
52 // Metodo invocato quando una finestra diventa attiva:
53 public void windowActivated (WindowEvent evt) {}
54
55 // Metodo invocato quando una finestra viene disattivata:
56 public void windowDeactivated (WindowEvent evt) {}
57}
58
59
60
61
62
diff --git a/robottino/all_versions/v2.2/src/RobottinoUtils/PartiDelRobot.java b/robottino/all_versions/v2.2/src/RobottinoUtils/PartiDelRobot.java
new file mode 100755
index 0000000..d6cf869
--- /dev/null
+++ b/robottino/all_versions/v2.2/src/RobottinoUtils/PartiDelRobot.java
@@ -0,0 +1,22 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Dichiaro la classe.
5public class PartiDelRobot {
6
7 // Creo un costruttore senza argomenti.
8 // Se non lo facessi sarei obbligato a passare gli argomenti
9 // del secondo costruttore ogni volta che voglio istanziare la classe.
10 public PartiDelRobot() {}
11
12 // Il secondo costruttore riceve come argomenti un booleano che passerà il valore a "statoParte"
13 // e una stringa che passa il valore a "stringaParte".
14 public PartiDelRobot(boolean b, String s) {
15 this.stringaParte = s;
16 this.statoParte = b;
17 }
18
19 // Infine le due variabili pubbliche della classe.
20 public String stringaParte;
21 public boolean statoParte;
22}
diff --git a/robottino/all_versions/v2.3/Esegui.bat b/robottino/all_versions/v2.3/Esegui.bat
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v2.3/Esegui.bat
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v2.3/Esegui.sh b/robottino/all_versions/v2.3/Esegui.sh
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v2.3/Esegui.sh
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v2.3/Readme.txt b/robottino/all_versions/v2.3/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v2.3/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v2.3/bin/RobottinoAzioni/RobottinoAzioni.class b/robottino/all_versions/v2.3/bin/RobottinoAzioni/RobottinoAzioni.class
new file mode 100755
index 0000000..d8aeb55
--- /dev/null
+++ b/robottino/all_versions/v2.3/bin/RobottinoAzioni/RobottinoAzioni.class
Binary files differ
diff --git a/robottino/all_versions/v2.3/bin/RobottinoMain/Robottino.class b/robottino/all_versions/v2.3/bin/RobottinoMain/Robottino.class
new file mode 100755
index 0000000..58413c9
--- /dev/null
+++ b/robottino/all_versions/v2.3/bin/RobottinoMain/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v2.3/bin/RobottinoUtils/Grafica.class b/robottino/all_versions/v2.3/bin/RobottinoUtils/Grafica.class
new file mode 100755
index 0000000..7ad96fe
--- /dev/null
+++ b/robottino/all_versions/v2.3/bin/RobottinoUtils/Grafica.class
Binary files differ
diff --git a/robottino/all_versions/v2.3/bin/RobottinoUtils/Listener.class b/robottino/all_versions/v2.3/bin/RobottinoUtils/Listener.class
new file mode 100755
index 0000000..3ddc989
--- /dev/null
+++ b/robottino/all_versions/v2.3/bin/RobottinoUtils/Listener.class
Binary files differ
diff --git a/robottino/all_versions/v2.3/bin/RobottinoUtils/PartiDelRobot.class b/robottino/all_versions/v2.3/bin/RobottinoUtils/PartiDelRobot.class
new file mode 100755
index 0000000..fcc8e9e
--- /dev/null
+++ b/robottino/all_versions/v2.3/bin/RobottinoUtils/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v2.3/src/RobottinoAzioni/RobottinoAzioni.java b/robottino/all_versions/v2.3/src/RobottinoAzioni/RobottinoAzioni.java
new file mode 100755
index 0000000..27d568a
--- /dev/null
+++ b/robottino/all_versions/v2.3/src/RobottinoAzioni/RobottinoAzioni.java
@@ -0,0 +1,397 @@
1// Dichiaro che questa classa farà parte del package RobottinoAzioni, che verrà poi importato dalle classi Listener e Grafica.
2package RobottinoAzioni;
3
4// Anche qui impoerto i package necessari.
5// java.util.Scanner gestisce gli input da tastiera
6import java.util.Scanner;
7
8// java.util.Vector
9import java.util.Vector;
10
11// Package definito da me.
12import RobottinoUtils.*;
13
14public class RobottinoAzioni {
15
16 // Creo gli oggetti statici che riempiranno il vettore pdrA:
17 // pdrA è un vettore multidimensionale che a sua volta contiene vettori
18 // (il primo si chiama pdrB, i successivi non avranno nome) che coontengono
19 // 4 istanze di PartiDelRobot, cioè i 4 arti del robot.
20 // Poi creo un vettore che conterrà i nomi dei robot.
21 // Creo il vettore principale...
22 public static Vector pdrA = new Vector(1);
23
24 // ...e il "sottovettore" come istanze della classe Vector
25 public static Vector pdrB = new Vector(4);
26
27 // Creo le quattro istanze di PartidelRobot utilizzando l'apposito costruttore
28 // passo a tutte una stringa e un valore boleano che determina lo stato
29 // (alzato/a se true, abbassato/a se false).
30 public static PartiDelRobot leftArm = new PartiDelRobot(false, "il braccio sinistro alzato");
31 public static PartiDelRobot rightArm = new PartiDelRobot(false, "il braccio destro alzato");
32 public static PartiDelRobot leftLeg = new PartiDelRobot(false, "la gamba sinistra alzata");
33 public static PartiDelRobot rightLeg = new PartiDelRobot(false, "la gamba destra alzata");
34
35 // Il vettore nomeRobot per i nomi
36 // il vettore può contenere stringhe, poichè non sono tipi primitivi ma oggetti della classe String
37 public static Vector nomeRobot = new Vector(1);
38
39 // La variabile robotIndex serve a tenere in memoria su quale robot si sta operando:
40 // in seguito verrà usata quando l'utente deciderà di creare più di un robot
41 // e poi di dare comandi a uno o all'altro/i.
42 int robotIndex = 0;
43
44 // Dichiarazione del metodo Azioni.
45 public String Azioni(String comando, Vector nomeRobot, Vector pdrA) {
46
47 // Crea un'istanza della classe Scanner per
48 // ricevere gli input nel caso in cui debba essere dato il nome
49 // al robottino o scelto un robottino da una lista.
50 Scanner sc2 = new Scanner(System.in);
51
52 // La variabile contatore memorizza il numero di variabili "PartiDelRobot.statoParte"
53 // che hanno valore true, ossia il numero di arti alzati di un robottino
54 // in modo da poter scegliere la frase giusta da dare come output
55 // al posto dell'immagine del robottino con tali arti alzati.
56 int contatore = 0;
57
58 // Questo array ha il compito di memorizzare le stringhe corrispondenti agli alzati
59 // per motivi simili a quelli della variabile "contatore".
60 String stat[] = {"", "", "", ""};
61
62 // La stringa Return verrà successivamente modificata e restituita in alcuni casi.
63 String Return = "Errore - si consiglia di picchiare il programmatore";
64
65 // Per far si che il programma non distingua tra lettere maiuscole o minuscole per quanto riguardo gli input
66 // è stato usato il metodo "equalsIgnoreCase" della classe String.
67 // I quattro casi successivi cambiano il valore della varibalie "statoParte" relativa all'arto
68 // Che deve mouversi (quindi cambiare la sua posizione).
69 if (comando.equalsIgnoreCase("leftarmmove"))
70 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte =
71 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte;
72
73 else if (comando.equalsIgnoreCase("rightarmmove"))
74 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte =
75 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte;
76
77 else if (comando.equalsIgnoreCase("leftlegmove"))
78 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte =
79 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte;
80
81 else if (comando.equalsIgnoreCase("rightlegmove"))
82 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte =
83 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte;
84
85 // I casi successivi modificano il valore della varibile analogamente ai 4 precedenti.
86 else if (comando.equalsIgnoreCase("leftarmon"))
87 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = true;
88
89 else if (comando.equalsIgnoreCase("rightarmon"))
90 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = true;
91
92 else if (comando.equalsIgnoreCase("leftlegon"))
93 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = true;
94
95 else if (comando.equalsIgnoreCase("rightlegon"))
96 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = true;
97
98 else if (comando.equalsIgnoreCase("leftarmoff"))
99 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = false;
100
101 else if (comando.equalsIgnoreCase("rightarmoff"))
102 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = false;
103
104 else if (comando.equalsIgnoreCase("leftlegoff"))
105 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = false;
106
107 else if (comando.equalsIgnoreCase("rightlegoff"))
108 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = false;
109
110 // Il caso successi si verica quando il comando è "exploud".
111 else if (comando.equalsIgnoreCase("exploud")) {
112
113 // Scrive sullo schermo la seguente frase, che comprende il nome del robottino che non è ancora stato fatto eliminare
114 System.out.println
115 ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot.elementAt(this.robotIndex) + "! Aspetta che te ne faccio un altro");
116 System.out.println ("...");
117
118 // Con un ciclo for rendo false tutte le variabili "statoParte" per far sì che il robottino sia come nuovo.
119 for (int i = 0; i < 4; i++) {
120 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
121 }
122
123 // E azzero anche il nome del robot
124 this.nomeRobot.setElementAt("", this.robotIndex);
125
126 return "Fatto, puoi continuare a giocare";
127 }
128
129 // Caso per il comando "bier".
130 // La reazione a questo comando è un semplice output quasi totalmente scorrelato al robottino
131 // se non per il fatto che appare il nome del robottino attuale.
132 else if (comando.equalsIgnoreCase("bier")) {
133 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "sta trangugiando una birra...");
134 System.out.println ("Buurrrrrrrrp!");
135 return "La birra analcolica fa schifo!";
136 }
137
138 // Per il comando "rename", rinomina.
139 else if (comando.equalsIgnoreCase("rename")) {
140
141 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot.elementAt(this.robotIndex));
142 System.out.println ("Digita il nuovo nome e premi INVIO per coninuare");
143
144 // Cambia il nome del robottino attuale con quello dell'input.
145 this.nomeRobot.setElementAt(sc2.nextLine(), this.robotIndex);
146
147 // Se il nome non è vuoto, aggiunge un carattere di spazio per migliorare la visualizzazione nelle frasi di output.
148 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
149 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
150
151 // Semplice output con il nuovo nome.
152 return "Ora il robottino si chiama " + nomeRobot.elementAt(this.robotIndex);
153 }
154
155 // Per il comando "porky".
156 // Ancora meno che per "bier".
157 else if (comando.equalsIgnoreCase("porky")) {
158 System.out.println ("Porky è un grande");
159 System.out.println ("Per maggiori informazioni visita il sito");
160 return "http://kakati.forumfree.net/";
161 }
162
163 // Il comando "xxx" ha funzioni analoghe a bier.
164 else if (comando.equalsIgnoreCase("xxx")) {
165 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "ha incontrato una bella robottina...");
166 return "*Censura*";
167 }
168
169 // "dance" setta tutte le variabili "statoParte" a false...
170 else if (comando.equalsIgnoreCase("dance")) {
171
172 System.out.println ("Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + " stia ballando...");
173 System.out.println ("Il robottino ha smesso di ballare");
174
175 //...con questo ciclo for
176 for (int i = 0; i < 4; i++) {
177 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
178 }
179
180 return "Il robottino " + nomeRobot.elementAt(this.robotIndex) + "si è fermato ed è tornato nella posizione originale";
181
182 // Per il comando "newrobot", che crea un nuovo robottino.
183 }
184 else if (comando.equalsIgnoreCase("newrobot")) {
185
186 // Aggiunge un elemento a "pdrA" con il metodo "addElement", della classe Vector.
187 // È stata necessaria la dicitura this. per modificare realmente il vettore.
188 // Se non lo avessi fatto non sarebbe successo, in quanto i metodi operano
189 // su i valori e non sulle variabili/oggetti.
190 this.pdrA.addElement(pdrB);
191
192 // Aggiungo le 4 parti del robot.
193 // Forse avete già notato (ma quì sono più evidenti) alcuni cast che ho fatto:
194 // sono per far si che il compilatore capisca che il metodo viene invocato da un oggetto
195 // della classe vector, che senza cast considererebbe della classe Object.
196 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftArm);
197 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightArm);
198 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftLeg);
199 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightLeg);
200
201 // Semplice output con richiesta di nome per il nuovo robottino.
202 System.out.println ("È stato creato un nuovo robot. Vuoi dare un nome al nuovo robot?");
203 System.out.println ("Inserisci il nuovo nome e premi INVIO oppure lascia vuoto e premi INVIO");
204
205 String newName = sc2.nextLine();
206
207 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
208 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
209
210 this.nomeRobot.addElement(newName);
211
212 return "È stato creato il robottino " + newName;
213 }
214
215 // Il comando "deleterobot", per eliminare un robot.
216 else if (comando.equalsIgnoreCase("deleterobot")) {
217
218 // Se c'è più di un robot esegue l'eliminazione.
219 if (pdrA.size()>1) {
220 System.out.println ("Quale robottino vuoi eliminare?");
221 System.out.println ("");
222
223 // Con un ciclo for scrive i nomi di tutti i robot preceduti da un numero in sequenza.
224 // Il numero è il corrispondente del loro indice di vettore.
225 for (int i = 0; i<this.pdrA.size(); i++) {
226 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
227 }
228
229 // Dà le istruzioni all'utente affinché capisca come eliminare un robot.
230 System.out.println ("");
231 System.out.println("Scegliere il robottino da eliminare digitando il numero corrispondente e premendo INVIO");
232 System.out.println("Digitare un qualunque altro numero e premere INVIO per annullare");
233
234 int num = this.pdrA.size()+1;
235
236 try {
237
238 // Riceve in input il numero e ne assegna il valore alla variabile "num".
239 num = sc2.nextInt();
240
241 } catch (Exception e) {
242 System.out.println("Puoi inserire solo numeri");
243 }
244
245 // Elimina gli elementi corrispondenti al robottino (nome e robot) dai
246 // rispettivi vettori con il metodo "removeElementAt" della classe Vector.
247 if (num<this.pdrA.size()) {
248 this.pdrA.removeElementAt(num);
249 this.nomeRobot.removeElementAt(num);
250 return "È stato eliminato il robottino numero " + num;
251 }
252
253 // Se il numero ricevuto in input è superiore all'indice dei robot
254 // non elimina alcun robot.
255 else return "Operazione annullata";
256 }
257
258 // Se c'è solo un robot non esegue l'eliminazione.
259 else return "Hai solo un robottino, non puoi eliminarlo!";
260 }
261
262 // Il comando "changerobot" per cambiare il robot a cui dare le istruzioni
263 else if (comando.equalsIgnoreCase("changerobot")) {
264
265 // L'esecuzione è simile a quella per il comando "deleterobot", con la differenza che il robot non viene eliminato
266 // ma viene semplicemente cambiato il valore della variabile "robotIndex".
267 if (pdrA.size()>1) {
268 System.out.println ("A quale robottino vuoi dare i comandi?");
269 System.out.println ("");
270 for (int i = 0; i<this.pdrA.size(); i++) {
271 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
272 }
273 System.out.println ("");
274 System.out.println ("Digita il numero corrispondente alla tua scelta e premi INVIO");
275
276 int newIndex = this.pdrA.size()+1;
277
278 try {
279
280 newIndex = sc2.nextInt();
281
282 } catch (Exception e) {
283 System.out.println("Puoi inserire solo numeri");
284 }
285
286 // Prima di cambiare valore alla variabile di indice verifica che il numero sia valido.
287 if (newIndex<this.pdrA.size()) {
288 this.robotIndex = newIndex;
289 return "È stato selezionato il robottino numero " + this.robotIndex + ": " + this.nomeRobot.elementAt
290 (this.robotIndex);
291 }
292
293 // Se non lo è non esegue l'assegnamento.
294 else return "Numero non valido - Operazione annullata";
295 }
296 else {
297 return "Hai solo un robottino, non puoi cambiarlo con un altro!";
298 }
299 }
300
301 // Il comando "robotlist" visualizza una lista dei robot presenti.
302 else if (comando.equalsIgnoreCase("robotlist")) {
303 for (int i = 0; i<this.pdrA.size(); i++) {
304 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
305 }
306 return "";
307 }
308
309 // Il comando "l", per la legenda, visualizza la lista dei comandi con relativa descrizione.
310 else if (comando.equalsIgnoreCase("l")) {
311 System.out.println ("Legenda comandi");
312 System.out.println ("");
313 System.out.println ("Comandi relativi agli arti");
314 System.out.println ("");
315 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
316 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
317 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
318 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
319 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
320 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
321 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
322 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
323 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
324 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
325 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
326 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
327 System.out.println ("");
328 System.out.println ("Altri comandi:");
329 System.out.println ("");
330 System.out.println ("NewRobot: aggiunge un nuovo robot");
331 System.out.println ("ChangeRobot: cambia il robot attuale");
332 System.out.println ("RobotList: visualizza la lista dei robot");
333 System.out.println ("Rename: rinomina il robottino");
334 System.out.println ("");
335 System.out.println ("Comandi a sorpresa:");
336 System.out.println ("");
337 System.out.println ("Exploud");
338 System.out.println ("Bier");
339 System.out.println ("Porky");
340 System.out.println ("xxx");
341 System.out.println ("dance");
342 System.out.println ("");
343 System.out.println ("Exit: esci dal programma");
344
345 return "";
346
347 }
348
349 // Se il comando è exit, esce dal programma.
350 else if (comando.equalsIgnoreCase("exit")) {
351 System.exit(0);
352 return "";
353 }
354
355 // Se l'input non è tra i comandi prestabiliti, visualizza la seguente scritta sullo schermo.
356 else
357 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
358 System.out.println ("");
359
360 // Quì di seguito viene chiarito l'utilizzo di "contatore" e "sta[]".
361 // Per ogni varibile "statoParte" che ha valore true, contatore viene incrementato
362 // e l'elemento successivo dell'array "stat[]" assume il valore della stringa corrispondente.
363 for (int i = 0, j = 0; i < 4; i++) {
364 if (((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte) {
365 contatore += 1;
366 stat[j++] = ((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).stringaParte;
367 }
368 }
369
370 // La restituzione finale delle frasi, con uno switch che a seconda del valore di contatore
371 // restituisce una frase o l'altra.
372 switch (contatore) {
373 case 0:
374 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"non ha nessun arto alzato";
375 break;
376 case 1:
377 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0] + ".";
378 break;
379 case 2:
380 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+" e "+stat[1]+".";
381 break;
382 case 3:
383 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+", "+stat[1]+" e "+stat[2]+".";
384 break;
385 case 4:
386 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+", "+stat[1]+", "+stat[2]+" e "+stat[3]+". Sta per cadere! Ah no, può restare sospeso in aria";
387 break;
388 }
389 return Return;
390 }
391 //Fine del metodo Azioni
392}
393
394
395
396
397
diff --git a/robottino/all_versions/v2.3/src/RobottinoMain/Robottino.java b/robottino/all_versions/v2.3/src/RobottinoMain/Robottino.java
new file mode 100755
index 0000000..37471cf
--- /dev/null
+++ b/robottino/all_versions/v2.3/src/RobottinoMain/Robottino.java
@@ -0,0 +1,83 @@
1// Robottino versione 2.2
2// Da questa versione illustrerò tutte le parti del programma con dei commenti come questo.
3
4// Dichiaro che questa classe fa parte del package RobottinoMain, che verrà poi importato
5// dalle classi che dovranno interagire con essa.
6package RobottinoMain;
7
8// Importo la classe Grafica per poter "costruire" una finestra.
9import RobottinoUtils.Grafica;
10
11// E il package Robottinoazioni per poterne inizializzare i vettori
12import RobottinoAzioni.*;
13
14// java.util.Vector serve a gestire i vettori.
15// I vettori sono come array, ma hanno due differenze principali:
16// 1) la loro lunghezza può variare durante l'esecuzione del programma
17// (per questo li ho preferiti agli array);
18// 2) possono contenere soltanto oggetti, e non tipi primitivi.
19import java.util.Vector;
20
21// Dichiaro la classe.
22public class Robottino {
23
24
25 // Istanzio la classe Thread per poter utilizzare il metodo sleep(int millisecondi)
26 // che in un metodo dell'interfaccia WindowListener, overridato nella classe Listener
27 // servirà a mettere il programma in uno stato di pausa.
28 // Sarebbe comunque possibile invocarlo, ma così sarà più facile da modificare in futuro.
29 public static Thread threadMain;
30
31 // Inizio del metodo main...
32 public static void main(String[] args) {
33
34 threadMain = new Thread(Thread.currentThread());
35
36 // Aggiungo gli elementi ai vettori.
37 // non potevo farlo prima, poiché al di fuori di un metodo è possibile soltanto
38 // dichiarare oggetti/variabili (e inizializzarli) o dichiarare un metodo
39 // e in RobottinoAzioni è presente solo il metodo Azioni che viene richiamato più volte.
40 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftArm);
41 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightArm);
42 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftLeg);
43 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightLeg);
44 RobottinoAzioni.pdrA.addElement(RobottinoAzioni.pdrB);
45 RobottinoAzioni.nomeRobot.addElement("");
46
47 // Crea la finestra tramite un'istanza della classe Grafica, del package RobottinoUtils
48 Grafica finestra = new Grafica();
49
50 // Output iniziale nellla shell
51 System.out.println ("**********************************************");
52 System.out.println ("**********************************************");
53 System.out.println ("*************Programma interattivo************");
54 System.out.println ("**********************************************");
55 System.out.println ("***Software realizzato da Sebastiano Tronto***");
56 System.out.println ("**********************************************");
57 System.out.println ("**********************************************");
58 System.out.println ("Questo programma simula un robot al quale ven-");
59 System.out.println ("gono assegnati ordini tramite comandi, simil-" );
60 System.out.println ("mente a quanto bisognava fare con i computer " );
61 System.out.println ("alcuni anni fa." );
62 System.out.println ("Dato che all'epoca i comandi che dovevano es-" );
63 System.out.println ("sere dati erano (e sono tutt'ora) in similin-" );
64 System.out.println ("glese, ho cercato di mantenerli tali." );
65 System.out.println ("Da questa versione (v2.3) i comandi devono es-");
66 System.out.println ("sere dati attraverso i menu File, Modifica o " );
67 System.out.println ("Azioni della finestra." );
68 System.out.println ("" );
69 System.out.println ("Tuttavia la reazione del robottino verrà vi-" );
70 System.out.println ("sualizzata attraverso la shell." );
71 System.out.println ("");
72 }
73 // Fine del metodo main.
74}
75
76
77
78
79
80
81
82
83
diff --git a/robottino/all_versions/v2.3/src/RobottinoUtils/Grafica.java b/robottino/all_versions/v2.3/src/RobottinoUtils/Grafica.java
new file mode 100755
index 0000000..b845a7f
--- /dev/null
+++ b/robottino/all_versions/v2.3/src/RobottinoUtils/Grafica.java
@@ -0,0 +1,210 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Importo i package standard relativi al funzionamento delle finestre e della grafica in generale.
5import java.awt.*;
6
7// E i package RobottinoAzioni e RobottinoUtils da me definiti.
8import RobottinoAzioni.*;
9import RobottinoUtils.Listener;
10
11// La classe è una sottoclasse di Frame per poter sfruttare gli effetti grafici
12// ma implementa anche l'interfaccia WindowListener, necessaria per gestire gli eventi collegati alle finestre
13// (riduzione a icona, chiusura...); per questo devo successivamente ridefinire tutti i
14// metodi dell'interfaccia.
15public class Grafica extends Frame {
16
17 // Creo un'istanza della classe Listener che userò come listener per gli eventi.
18 public static Listener listener;
19
20 // Il costruttore senza argomenti.
21 public Grafica () {
22
23 // Il metodo "setBounds" posiziona e dimensiona la finestra.
24 setBounds (this.orizzontale, this.verticale, this.larghezza, this.altezza);
25
26 // "setTitle" per il titolo della finestra.
27 setTitle ("Robottino v2.2");
28
29 // "setVisible" per poterla visualizzare.
30 setVisible (true);
31
32 // E addWindowListener per l'ascoltatore (listener).
33 listener = new Listener();
34 addWindowListener (listener);
35
36 // Aggiungo la barra del menu con i vari sottomenu
37 setMenuBar (barraMenu);
38
39 // Il menu file.
40 NewRobot.addActionListener(listener);
41 NewRobot.setActionCommand("newrobot");
42
43 ChangeRobot.addActionListener(listener);
44 ChangeRobot.setActionCommand("changerobot");
45
46 DeleteRobot.addActionListener(listener);
47 DeleteRobot.setActionCommand("deleterobot");
48
49 Exit.addActionListener(listener);
50 Exit.setActionCommand("exit");
51
52 file.add(NewRobot);
53 file.add(ChangeRobot);
54 file.add(DeleteRobot);
55 file.addSeparator();
56 file.add(Exit);
57
58 barraMenu.add(file);
59
60 // Il braccio sinistro.
61 LeftArmMove.addActionListener(listener);
62 LeftArmMove.setActionCommand("leftarmmove");
63
64 LeftArmOn.addActionListener(listener);
65 LeftArmOn.setActionCommand("leftarmon");
66
67 LeftArmOff.addActionListener(listener);
68 LeftArmOff.setActionCommand("leftarmoff");
69
70 LeftArm.add(LeftArmMove);
71 LeftArm.add(LeftArmOn);
72 LeftArm.add(LeftArmOff);
73
74 // Il braccio destro.
75 RightArmMove.addActionListener(listener);
76 RightArmMove.setActionCommand("rightarmmove");
77
78 RightArmOn.addActionListener(listener);
79 RightArmOn.setActionCommand("rightarmon");
80
81 RightArmOff.addActionListener(listener);
82 RightArmOff.setActionCommand("rightarmoff");
83
84 RightArm.add(RightArmMove);
85 RightArm.add(RightArmOn);
86 RightArm.add(RightArmOff);
87
88 // La gamba sinistra.
89 LeftLegMove.addActionListener(listener);
90 LeftLegMove.setActionCommand("leftlegmove");
91
92 LeftLegOn.addActionListener(listener);
93 LeftLegOn.setActionCommand("leftlegon");
94
95 LeftLegOff.addActionListener(listener);
96 LeftLegOff.setActionCommand("leftlegoff");
97
98 LeftLeg.add(LeftLegMove);
99 LeftLeg.add(LeftLegOn);
100 LeftLeg.add(LeftLegOff);
101
102 // La gamba destra.
103 RightLegMove.addActionListener(listener);
104 RightLegMove.setActionCommand("rightlegmove");
105
106 RightLegOn.addActionListener(listener);
107 RightLegOn.setActionCommand("rightlegon");
108
109 RightLegOff.addActionListener(listener);
110 RightLegOff.setActionCommand("rightlegoff");
111
112 RightLeg.add(RightLegMove);
113 RightLeg.add(RightLegOn);
114 RightLeg.add(RightLegOff);
115
116 // Menu rinomina.
117 Rename.addActionListener(listener);
118 Rename.setActionCommand("rename");
119
120 Menu modifica = new Menu("Modifica");
121 modifica.add(LeftArm);
122 modifica.add(RightArm);
123 modifica.add(LeftLeg);
124 modifica.add(RightLeg);
125 modifica.addSeparator();
126 modifica.add(Rename);
127
128 barraMenu.add(modifica);
129
130 // Menu azioni.
131 Exploud.addActionListener(listener);
132 Exploud.setActionCommand("exploud");
133
134 Bier.addActionListener(listener);
135 Bier.setActionCommand("bier");
136
137 xxx.addActionListener(listener);
138 xxx.setActionCommand("xxx");
139
140 Dance.addActionListener(listener);
141 Dance.setActionCommand("dance");
142
143 azioni.add(Exploud);
144 azioni.add(Bier);
145 azioni.add(xxx);
146 azioni.add(Dance);
147
148 barraMenu.add(azioni);
149
150 // Menu info.
151 Porky.addActionListener(listener);
152 Porky.setActionCommand("porky");
153
154 l.addActionListener(listener);
155 l.setActionCommand("l");
156
157 RobotList.addActionListener(listener);
158 RobotList.setActionCommand("robotlist");
159
160 info.add(Porky);
161 info.add(l);
162 info.add(RobotList);
163
164 barraMenu.add(info);
165 }
166
167 // Le variabili pubbliche di classe per il metodo "setBounds".
168 public int orizzontale = 0;
169 public int verticale = 0;
170 public int larghezza = 500;
171 public int altezza = 500;
172
173 // E i vari Menu e MenuItem.
174 MenuBar barraMenu = new MenuBar();
175 Menu file = new Menu("File");
176 MenuItem NewRobot = new MenuItem("Nuovo robot");
177 MenuItem ChangeRobot = new MenuItem("Dai i comandi a un altro robot");
178 MenuItem DeleteRobot = new MenuItem("Elimina un robot");
179 MenuItem Exit = new MenuItem("Esci");
180 Menu LeftArm = new Menu("Braccio sinistro");
181 MenuItem LeftArmMove = new MenuItem("Cambia posizione");
182 MenuItem LeftArmOn = new MenuItem("Alza");
183 MenuItem LeftArmOff = new MenuItem("Abbassa");
184 Menu RightArm = new Menu("Braccio destro");
185 MenuItem RightArmMove = new MenuItem("Cambia posizione");
186 MenuItem RightArmOn = new MenuItem("Alza");
187 MenuItem RightArmOff = new MenuItem("Abbassa");
188 Menu LeftLeg = new Menu("Gamba sinistra");
189 MenuItem LeftLegMove = new MenuItem("Cambia posizione");
190 MenuItem LeftLegOn = new MenuItem("Alza");
191 MenuItem LeftLegOff = new MenuItem("Abbassa");
192 Menu RightLeg = new Menu("Gamba destra");
193 MenuItem RightLegMove = new MenuItem("Cambia posizione");
194 MenuItem RightLegOn = new MenuItem("Alza");
195 MenuItem RightLegOff = new MenuItem("Abbassa");
196 MenuItem Rename = new MenuItem("Rinomina");
197 Menu azioni = new Menu("Azioni");
198 MenuItem Exploud = new MenuItem("Esplodi");
199 MenuItem Bier = new MenuItem("Birra");
200 MenuItem xxx = new MenuItem("xxx");
201 MenuItem Dance = new MenuItem("Balla");
202 Menu info = new Menu("?");
203 MenuItem Porky = new MenuItem("Informazioni sul programmatore");
204 MenuItem l = new MenuItem("Legenda Comandi");
205 MenuItem RobotList = new MenuItem("Lista robot");
206}
207
208
209
210
diff --git a/robottino/all_versions/v2.3/src/RobottinoUtils/Listener.java b/robottino/all_versions/v2.3/src/RobottinoUtils/Listener.java
new file mode 100755
index 0000000..90e617c
--- /dev/null
+++ b/robottino/all_versions/v2.3/src/RobottinoUtils/Listener.java
@@ -0,0 +1,72 @@
1// Questa classe è il listener per gli eventi relativi alle finestre.
2// Dichiaro che farà parte del package RobottinoUtils
3package RobottinoUtils;
4
5// Importo i package necessari.
6import java.awt.event.*;
7import RobottinoMain.*;
8import RobottinoAzioni.*;
9
10public class Listener implements WindowListener, ActionListener {
11
12 RobottinoAzioni robottinoazioni = new RobottinoAzioni();
13
14 // Ridefinisco i metodi dell'interfaccia WindowListener:
15 // Metodo invocato quando la finestra è stata chiusa:
16 public void windowClosed (WindowEvent evt) {
17
18 // Invoco il metodo sleep(int millisecondi) per mettere il programma in uno stato di attesa
19 // di durata pari ai millisecondi indicati come argomento.
20 System.out.println("La finestra è stata chiusa, il programma terminarà fra 3 secondi");
21 try {
22 Robottino.threadMain.sleep(1000);
23 } catch (Exception e) { e.printStackTrace(); }
24 System.out.println("2");
25 try {
26 Robottino.threadMain.sleep(1000);
27 } catch (Exception e) { e.printStackTrace(); }
28 System.out.println("1");
29 try {
30 Robottino.threadMain.sleep(1000);
31 } catch (Exception e) { e.printStackTrace(); }
32 System.out.println("Programma terminato");
33 System.exit(0);
34 }
35
36 // Metodo invocato quando la finestra è in fase di chiusura:
37 public void windowClosing (WindowEvent evt) {
38 System.out.println ("Chiusura finestra in corso");
39 evt.getWindow().dispose();
40 }
41
42 // Metodo invocato quando una finestra viene ridotta a icona:
43 public void windowIconified (WindowEvent evt) {
44 System.out.println("La finestra è stata ridotta a icona");
45 }
46
47 // Metodo invocato quando una finestra ridotta a icona viene ingrandita:
48 public void windowDeiconified (WindowEvent evt) {
49 System.out.println("La finestra ridotta a icona è stata ingrandita");
50 }
51
52 // Metodo invocato quando una finestra viene aperta:
53 public void windowOpened (WindowEvent evt) {}
54
55 // Metodo invocato quando una finestra diventa attiva:
56 public void windowActivated (WindowEvent evt) {}
57
58 // Metodo invocato quando una finestra viene disattivata:
59 public void windowDeactivated (WindowEvent evt) {}
60
61 // Metodo invocato quando viene utilizzata la barra del menu:
62 // descrive tutte le azioni da compiere per ogni evento ricevuto
63 // dal menu.
64 public void actionPerformed (ActionEvent e) {
65 System.out.println (robottinoazioni.Azioni(e.getActionCommand(), RobottinoAzioni.nomeRobot, RobottinoAzioni.pdrA));
66 }
67}
68
69
70
71
72
diff --git a/robottino/all_versions/v2.3/src/RobottinoUtils/PartiDelRobot.java b/robottino/all_versions/v2.3/src/RobottinoUtils/PartiDelRobot.java
new file mode 100755
index 0000000..d6cf869
--- /dev/null
+++ b/robottino/all_versions/v2.3/src/RobottinoUtils/PartiDelRobot.java
@@ -0,0 +1,22 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Dichiaro la classe.
5public class PartiDelRobot {
6
7 // Creo un costruttore senza argomenti.
8 // Se non lo facessi sarei obbligato a passare gli argomenti
9 // del secondo costruttore ogni volta che voglio istanziare la classe.
10 public PartiDelRobot() {}
11
12 // Il secondo costruttore riceve come argomenti un booleano che passerà il valore a "statoParte"
13 // e una stringa che passa il valore a "stringaParte".
14 public PartiDelRobot(boolean b, String s) {
15 this.stringaParte = s;
16 this.statoParte = b;
17 }
18
19 // Infine le due variabili pubbliche della classe.
20 public String stringaParte;
21 public boolean statoParte;
22}
diff --git a/robottino/all_versions/v3.0/Esegui.bat b/robottino/all_versions/v3.0/Esegui.bat
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v3.0/Esegui.bat
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v3.0/Esegui.sh b/robottino/all_versions/v3.0/Esegui.sh
new file mode 100755
index 0000000..d413ed8
--- /dev/null
+++ b/robottino/all_versions/v3.0/Esegui.sh
@@ -0,0 +1,3 @@
1cd ./bin
2java RobottinoMain/Robottino
3cd
diff --git a/robottino/all_versions/v3.0/Readme.txt b/robottino/all_versions/v3.0/Readme.txt
new file mode 100755
index 0000000..52d532c
--- /dev/null
+++ b/robottino/all_versions/v3.0/Readme.txt
@@ -0,0 +1,10 @@
1Il programma necessita della JVM (Java Virtual Machine) per funzionare correttamente
2
3Se si usano sistemi Windows aprire il file Esegui.bat
4Se si usano sistemi Unix dare i permessi necessari ed eseguire il file Esegui.sh
5Se si usano altri sistemi aprire una shell e digitare i comandi
6
7cd <percorsoFile>/bin
8java Robottino
9
10dove percorsoFile è il percorso di questo file.
diff --git a/robottino/all_versions/v3.0/bin/Immagini/ImmagineRobot.class b/robottino/all_versions/v3.0/bin/Immagini/ImmagineRobot.class
new file mode 100755
index 0000000..6089c8a
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/ImmagineRobot.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/Immagini/img/laoff.gif b/robottino/all_versions/v3.0/bin/Immagini/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/Immagini/img/lloff.gif b/robottino/all_versions/v3.0/bin/Immagini/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/Immagini/img/raoff.gif b/robottino/all_versions/v3.0/bin/Immagini/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/Immagini/img/rloff.gif b/robottino/all_versions/v3.0/bin/Immagini/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/Immagini/img/robot.gif b/robottino/all_versions/v3.0/bin/Immagini/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/Immagini/img/robot.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/RobottinoAzioni/RobottinoAzioni.class b/robottino/all_versions/v3.0/bin/RobottinoAzioni/RobottinoAzioni.class
new file mode 100755
index 0000000..d8aeb55
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/RobottinoAzioni/RobottinoAzioni.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/RobottinoMain/Robottino.class b/robottino/all_versions/v3.0/bin/RobottinoMain/Robottino.class
new file mode 100755
index 0000000..2a1b0e3
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/RobottinoMain/Robottino.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/RobottinoUtils/Grafica.class b/robottino/all_versions/v3.0/bin/RobottinoUtils/Grafica.class
new file mode 100755
index 0000000..80ef9bc
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/RobottinoUtils/Grafica.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/RobottinoUtils/Listener.class b/robottino/all_versions/v3.0/bin/RobottinoUtils/Listener.class
new file mode 100755
index 0000000..e198976
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/RobottinoUtils/Listener.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/bin/RobottinoUtils/PartiDelRobot.class b/robottino/all_versions/v3.0/bin/RobottinoUtils/PartiDelRobot.class
new file mode 100755
index 0000000..fcc8e9e
--- /dev/null
+++ b/robottino/all_versions/v3.0/bin/RobottinoUtils/PartiDelRobot.class
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/Immagini/ImmagineRobot.java b/robottino/all_versions/v3.0/src/Immagini/ImmagineRobot.java
new file mode 100755
index 0000000..ee0bc1f
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/ImmagineRobot.java
@@ -0,0 +1,35 @@
1package Immagini;
2import java.awt.*;
3import java.awt.image.*;
4
5public class ImmagineRobot {
6
7 public Toolkit t;
8 public Image robot;
9 public Image raon;
10 public Image raoff;
11 public Image laon;
12 public Image laoff;
13 public Image rlon;
14 public Image rloff;
15 public Image llon;
16 public Image lloff;
17 public Image birra;
18
19 public ImmagineRobot() {
20
21 t = Toolkit.getDefaultToolkit();
22 robot = t.getImage("./Immagini/img/robot.gif");
23 raon = t.getImage("./Immagini/img/raon.gif");
24 raoff = t.getImage("./Immagini/img/raoff.gif");
25 laon = t.getImage("./Immagini/img/laon.gif");
26 laoff = t.getImage("./Immagini/img/laoff.gif");
27 rlon = t.getImage("./Immagini/img/rlon.gif");
28 rloff = t.getImage("./Immagini/img/rloff.gif");
29 llon = t.getImage("./Immagini/img/llon.gif");
30 lloff = t.getImage("./Immagini/img/lloff.gif");
31 birra = t.getImage("./Immagini/img/birra.gif");
32
33 }
34
35}
diff --git a/robottino/all_versions/v3.0/src/Immagini/img/laoff.gif b/robottino/all_versions/v3.0/src/Immagini/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/Immagini/img/lloff.gif b/robottino/all_versions/v3.0/src/Immagini/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/Immagini/img/raoff.gif b/robottino/all_versions/v3.0/src/Immagini/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/Immagini/img/rloff.gif b/robottino/all_versions/v3.0/src/Immagini/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/Immagini/img/robot.gif b/robottino/all_versions/v3.0/src/Immagini/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/Immagini/img/robot.gif
Binary files differ
diff --git a/robottino/all_versions/v3.0/src/RobottinoAzioni/RobottinoAzioni.java b/robottino/all_versions/v3.0/src/RobottinoAzioni/RobottinoAzioni.java
new file mode 100755
index 0000000..27d568a
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/RobottinoAzioni/RobottinoAzioni.java
@@ -0,0 +1,397 @@
1// Dichiaro che questa classa farà parte del package RobottinoAzioni, che verrà poi importato dalle classi Listener e Grafica.
2package RobottinoAzioni;
3
4// Anche qui impoerto i package necessari.
5// java.util.Scanner gestisce gli input da tastiera
6import java.util.Scanner;
7
8// java.util.Vector
9import java.util.Vector;
10
11// Package definito da me.
12import RobottinoUtils.*;
13
14public class RobottinoAzioni {
15
16 // Creo gli oggetti statici che riempiranno il vettore pdrA:
17 // pdrA è un vettore multidimensionale che a sua volta contiene vettori
18 // (il primo si chiama pdrB, i successivi non avranno nome) che coontengono
19 // 4 istanze di PartiDelRobot, cioè i 4 arti del robot.
20 // Poi creo un vettore che conterrà i nomi dei robot.
21 // Creo il vettore principale...
22 public static Vector pdrA = new Vector(1);
23
24 // ...e il "sottovettore" come istanze della classe Vector
25 public static Vector pdrB = new Vector(4);
26
27 // Creo le quattro istanze di PartidelRobot utilizzando l'apposito costruttore
28 // passo a tutte una stringa e un valore boleano che determina lo stato
29 // (alzato/a se true, abbassato/a se false).
30 public static PartiDelRobot leftArm = new PartiDelRobot(false, "il braccio sinistro alzato");
31 public static PartiDelRobot rightArm = new PartiDelRobot(false, "il braccio destro alzato");
32 public static PartiDelRobot leftLeg = new PartiDelRobot(false, "la gamba sinistra alzata");
33 public static PartiDelRobot rightLeg = new PartiDelRobot(false, "la gamba destra alzata");
34
35 // Il vettore nomeRobot per i nomi
36 // il vettore può contenere stringhe, poichè non sono tipi primitivi ma oggetti della classe String
37 public static Vector nomeRobot = new Vector(1);
38
39 // La variabile robotIndex serve a tenere in memoria su quale robot si sta operando:
40 // in seguito verrà usata quando l'utente deciderà di creare più di un robot
41 // e poi di dare comandi a uno o all'altro/i.
42 int robotIndex = 0;
43
44 // Dichiarazione del metodo Azioni.
45 public String Azioni(String comando, Vector nomeRobot, Vector pdrA) {
46
47 // Crea un'istanza della classe Scanner per
48 // ricevere gli input nel caso in cui debba essere dato il nome
49 // al robottino o scelto un robottino da una lista.
50 Scanner sc2 = new Scanner(System.in);
51
52 // La variabile contatore memorizza il numero di variabili "PartiDelRobot.statoParte"
53 // che hanno valore true, ossia il numero di arti alzati di un robottino
54 // in modo da poter scegliere la frase giusta da dare come output
55 // al posto dell'immagine del robottino con tali arti alzati.
56 int contatore = 0;
57
58 // Questo array ha il compito di memorizzare le stringhe corrispondenti agli alzati
59 // per motivi simili a quelli della variabile "contatore".
60 String stat[] = {"", "", "", ""};
61
62 // La stringa Return verrà successivamente modificata e restituita in alcuni casi.
63 String Return = "Errore - si consiglia di picchiare il programmatore";
64
65 // Per far si che il programma non distingua tra lettere maiuscole o minuscole per quanto riguardo gli input
66 // è stato usato il metodo "equalsIgnoreCase" della classe String.
67 // I quattro casi successivi cambiano il valore della varibalie "statoParte" relativa all'arto
68 // Che deve mouversi (quindi cambiare la sua posizione).
69 if (comando.equalsIgnoreCase("leftarmmove"))
70 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte =
71 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte;
72
73 else if (comando.equalsIgnoreCase("rightarmmove"))
74 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte =
75 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte;
76
77 else if (comando.equalsIgnoreCase("leftlegmove"))
78 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte =
79 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte;
80
81 else if (comando.equalsIgnoreCase("rightlegmove"))
82 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte =
83 !((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte;
84
85 // I casi successivi modificano il valore della varibile analogamente ai 4 precedenti.
86 else if (comando.equalsIgnoreCase("leftarmon"))
87 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = true;
88
89 else if (comando.equalsIgnoreCase("rightarmon"))
90 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = true;
91
92 else if (comando.equalsIgnoreCase("leftlegon"))
93 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = true;
94
95 else if (comando.equalsIgnoreCase("rightlegon"))
96 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = true;
97
98 else if (comando.equalsIgnoreCase("leftarmoff"))
99 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(0)).statoParte = false;
100
101 else if (comando.equalsIgnoreCase("rightarmoff"))
102 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(1)).statoParte = false;
103
104 else if (comando.equalsIgnoreCase("leftlegoff"))
105 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(2)).statoParte = false;
106
107 else if (comando.equalsIgnoreCase("rightlegoff"))
108 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(3)).statoParte = false;
109
110 // Il caso successi si verica quando il comando è "exploud".
111 else if (comando.equalsIgnoreCase("exploud")) {
112
113 // Scrive sullo schermo la seguente frase, che comprende il nome del robottino che non è ancora stato fatto eliminare
114 System.out.println
115 ("Che atroce! Hai fatto esplodere il robottino " + nomeRobot.elementAt(this.robotIndex) + "! Aspetta che te ne faccio un altro");
116 System.out.println ("...");
117
118 // Con un ciclo for rendo false tutte le variabili "statoParte" per far sì che il robottino sia come nuovo.
119 for (int i = 0; i < 4; i++) {
120 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
121 }
122
123 // E azzero anche il nome del robot
124 this.nomeRobot.setElementAt("", this.robotIndex);
125
126 return "Fatto, puoi continuare a giocare";
127 }
128
129 // Caso per il comando "bier".
130 // La reazione a questo comando è un semplice output quasi totalmente scorrelato al robottino
131 // se non per il fatto che appare il nome del robottino attuale.
132 else if (comando.equalsIgnoreCase("bier")) {
133 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "sta trangugiando una birra...");
134 System.out.println ("Buurrrrrrrrp!");
135 return "La birra analcolica fa schifo!";
136 }
137
138 // Per il comando "rename", rinomina.
139 else if (comando.equalsIgnoreCase("rename")) {
140
141 System.out.println ("Con questo comando quoi cambiare il nome del robottino " + nomeRobot.elementAt(this.robotIndex));
142 System.out.println ("Digita il nuovo nome e premi INVIO per coninuare");
143
144 // Cambia il nome del robottino attuale con quello dell'input.
145 this.nomeRobot.setElementAt(sc2.nextLine(), this.robotIndex);
146
147 // Se il nome non è vuoto, aggiunge un carattere di spazio per migliorare la visualizzazione nelle frasi di output.
148 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
149 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
150
151 // Semplice output con il nuovo nome.
152 return "Ora il robottino si chiama " + nomeRobot.elementAt(this.robotIndex);
153 }
154
155 // Per il comando "porky".
156 // Ancora meno che per "bier".
157 else if (comando.equalsIgnoreCase("porky")) {
158 System.out.println ("Porky è un grande");
159 System.out.println ("Per maggiori informazioni visita il sito");
160 return "http://kakati.forumfree.net/";
161 }
162
163 // Il comando "xxx" ha funzioni analoghe a bier.
164 else if (comando.equalsIgnoreCase("xxx")) {
165 System.out.println ("Il robottino " + nomeRobot.elementAt(this.robotIndex) + "ha incontrato una bella robottina...");
166 return "*Censura*";
167 }
168
169 // "dance" setta tutte le variabili "statoParte" a false...
170 else if (comando.equalsIgnoreCase("dance")) {
171
172 System.out.println ("Immagini che il robottino " + nomeRobot.elementAt(this.robotIndex) + " stia ballando...");
173 System.out.println ("Il robottino ha smesso di ballare");
174
175 //...con questo ciclo for
176 for (int i = 0; i < 4; i++) {
177 ((PartiDelRobot)((Vector)this.pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte = false;
178 }
179
180 return "Il robottino " + nomeRobot.elementAt(this.robotIndex) + "si è fermato ed è tornato nella posizione originale";
181
182 // Per il comando "newrobot", che crea un nuovo robottino.
183 }
184 else if (comando.equalsIgnoreCase("newrobot")) {
185
186 // Aggiunge un elemento a "pdrA" con il metodo "addElement", della classe Vector.
187 // È stata necessaria la dicitura this. per modificare realmente il vettore.
188 // Se non lo avessi fatto non sarebbe successo, in quanto i metodi operano
189 // su i valori e non sulle variabili/oggetti.
190 this.pdrA.addElement(pdrB);
191
192 // Aggiungo le 4 parti del robot.
193 // Forse avete già notato (ma quì sono più evidenti) alcuni cast che ho fatto:
194 // sono per far si che il compilatore capisca che il metodo viene invocato da un oggetto
195 // della classe vector, che senza cast considererebbe della classe Object.
196 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftArm);
197 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightArm);
198 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (leftLeg);
199 ((Vector)(this.pdrA.elementAt(pdrA.size()-1))).addElement (rightLeg);
200
201 // Semplice output con richiesta di nome per il nuovo robottino.
202 System.out.println ("È stato creato un nuovo robot. Vuoi dare un nome al nuovo robot?");
203 System.out.println ("Inserisci il nuovo nome e premi INVIO oppure lascia vuoto e premi INVIO");
204
205 String newName = sc2.nextLine();
206
207 if (!(((String)nomeRobot.elementAt(this.robotIndex)).equalsIgnoreCase("")))
208 this.nomeRobot.setElementAt(this.nomeRobot.elementAt(this.robotIndex) + " ", this.robotIndex);
209
210 this.nomeRobot.addElement(newName);
211
212 return "È stato creato il robottino " + newName;
213 }
214
215 // Il comando "deleterobot", per eliminare un robot.
216 else if (comando.equalsIgnoreCase("deleterobot")) {
217
218 // Se c'è più di un robot esegue l'eliminazione.
219 if (pdrA.size()>1) {
220 System.out.println ("Quale robottino vuoi eliminare?");
221 System.out.println ("");
222
223 // Con un ciclo for scrive i nomi di tutti i robot preceduti da un numero in sequenza.
224 // Il numero è il corrispondente del loro indice di vettore.
225 for (int i = 0; i<this.pdrA.size(); i++) {
226 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
227 }
228
229 // Dà le istruzioni all'utente affinché capisca come eliminare un robot.
230 System.out.println ("");
231 System.out.println("Scegliere il robottino da eliminare digitando il numero corrispondente e premendo INVIO");
232 System.out.println("Digitare un qualunque altro numero e premere INVIO per annullare");
233
234 int num = this.pdrA.size()+1;
235
236 try {
237
238 // Riceve in input il numero e ne assegna il valore alla variabile "num".
239 num = sc2.nextInt();
240
241 } catch (Exception e) {
242 System.out.println("Puoi inserire solo numeri");
243 }
244
245 // Elimina gli elementi corrispondenti al robottino (nome e robot) dai
246 // rispettivi vettori con il metodo "removeElementAt" della classe Vector.
247 if (num<this.pdrA.size()) {
248 this.pdrA.removeElementAt(num);
249 this.nomeRobot.removeElementAt(num);
250 return "È stato eliminato il robottino numero " + num;
251 }
252
253 // Se il numero ricevuto in input è superiore all'indice dei robot
254 // non elimina alcun robot.
255 else return "Operazione annullata";
256 }
257
258 // Se c'è solo un robot non esegue l'eliminazione.
259 else return "Hai solo un robottino, non puoi eliminarlo!";
260 }
261
262 // Il comando "changerobot" per cambiare il robot a cui dare le istruzioni
263 else if (comando.equalsIgnoreCase("changerobot")) {
264
265 // L'esecuzione è simile a quella per il comando "deleterobot", con la differenza che il robot non viene eliminato
266 // ma viene semplicemente cambiato il valore della variabile "robotIndex".
267 if (pdrA.size()>1) {
268 System.out.println ("A quale robottino vuoi dare i comandi?");
269 System.out.println ("");
270 for (int i = 0; i<this.pdrA.size(); i++) {
271 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
272 }
273 System.out.println ("");
274 System.out.println ("Digita il numero corrispondente alla tua scelta e premi INVIO");
275
276 int newIndex = this.pdrA.size()+1;
277
278 try {
279
280 newIndex = sc2.nextInt();
281
282 } catch (Exception e) {
283 System.out.println("Puoi inserire solo numeri");
284 }
285
286 // Prima di cambiare valore alla variabile di indice verifica che il numero sia valido.
287 if (newIndex<this.pdrA.size()) {
288 this.robotIndex = newIndex;
289 return "È stato selezionato il robottino numero " + this.robotIndex + ": " + this.nomeRobot.elementAt
290 (this.robotIndex);
291 }
292
293 // Se non lo è non esegue l'assegnamento.
294 else return "Numero non valido - Operazione annullata";
295 }
296 else {
297 return "Hai solo un robottino, non puoi cambiarlo con un altro!";
298 }
299 }
300
301 // Il comando "robotlist" visualizza una lista dei robot presenti.
302 else if (comando.equalsIgnoreCase("robotlist")) {
303 for (int i = 0; i<this.pdrA.size(); i++) {
304 System.out.println (i + ". " + this.nomeRobot.elementAt(i));
305 }
306 return "";
307 }
308
309 // Il comando "l", per la legenda, visualizza la lista dei comandi con relativa descrizione.
310 else if (comando.equalsIgnoreCase("l")) {
311 System.out.println ("Legenda comandi");
312 System.out.println ("");
313 System.out.println ("Comandi relativi agli arti");
314 System.out.println ("");
315 System.out.println ("LeftArmMove: cambia la posizione corrente del braccio sinistro del robot");
316 System.out.println ("RightArmMove: cambia la posizione corrente del braccio destro del robot");
317 System.out.println ("LeftLegMove: cambia la posizione corrente della gamba sinistra del robot");
318 System.out.println ("RightLegMove: cambia la posizione corrente della gamba destra del robot");
319 System.out.println ("LeftArmOn: se il braccio sinistro non è alzato, lo alza, altrimenti la posizione resta invariata");
320 System.out.println ("RightArmOn: se il braccio destro non è alzato, lo alza, altrimenti la posizione resta invariata");
321 System.out.println ("LeftLegOn: se la gamba sinistra non è alzata, la alza, altrimenti la posizione resta invariata");
322 System.out.println ("RightLegOn: se la gamba destra non è alzata, la alza, altrimenti la posizione resta invariata");
323 System.out.println ("LeftArmOff: se il braccio sinistro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
324 System.out.println ("RightArmOff: se il braccio destro non è abbassato, lo abbassa, altrimenti la posizione resta invariata");
325 System.out.println ("LeftLegOff: se la gamba sinistra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
326 System.out.println ("RightLegOff: se la gamba destra non è abbassata, la abbassa, altrimenti la posizione resta invariata");
327 System.out.println ("");
328 System.out.println ("Altri comandi:");
329 System.out.println ("");
330 System.out.println ("NewRobot: aggiunge un nuovo robot");
331 System.out.println ("ChangeRobot: cambia il robot attuale");
332 System.out.println ("RobotList: visualizza la lista dei robot");
333 System.out.println ("Rename: rinomina il robottino");
334 System.out.println ("");
335 System.out.println ("Comandi a sorpresa:");
336 System.out.println ("");
337 System.out.println ("Exploud");
338 System.out.println ("Bier");
339 System.out.println ("Porky");
340 System.out.println ("xxx");
341 System.out.println ("dance");
342 System.out.println ("");
343 System.out.println ("Exit: esci dal programma");
344
345 return "";
346
347 }
348
349 // Se il comando è exit, esce dal programma.
350 else if (comando.equalsIgnoreCase("exit")) {
351 System.exit(0);
352 return "";
353 }
354
355 // Se l'input non è tra i comandi prestabiliti, visualizza la seguente scritta sullo schermo.
356 else
357 System.out.println ("Comando non riconosciuto - digitare l per una legenda dei comandi disponibili");
358 System.out.println ("");
359
360 // Quì di seguito viene chiarito l'utilizzo di "contatore" e "sta[]".
361 // Per ogni varibile "statoParte" che ha valore true, contatore viene incrementato
362 // e l'elemento successivo dell'array "stat[]" assume il valore della stringa corrispondente.
363 for (int i = 0, j = 0; i < 4; i++) {
364 if (((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).statoParte) {
365 contatore += 1;
366 stat[j++] = ((PartiDelRobot)((Vector)pdrA.elementAt(this.robotIndex)).elementAt(i)).stringaParte;
367 }
368 }
369
370 // La restituzione finale delle frasi, con uno switch che a seconda del valore di contatore
371 // restituisce una frase o l'altra.
372 switch (contatore) {
373 case 0:
374 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"non ha nessun arto alzato";
375 break;
376 case 1:
377 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0] + ".";
378 break;
379 case 2:
380 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+" e "+stat[1]+".";
381 break;
382 case 3:
383 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+", "+stat[1]+" e "+stat[2]+".";
384 break;
385 case 4:
386 Return = "Il robottino "+nomeRobot.elementAt(this.robotIndex)+"ha "+stat[0]+", "+stat[1]+", "+stat[2]+" e "+stat[3]+". Sta per cadere! Ah no, può restare sospeso in aria";
387 break;
388 }
389 return Return;
390 }
391 //Fine del metodo Azioni
392}
393
394
395
396
397
diff --git a/robottino/all_versions/v3.0/src/RobottinoMain/Robottino.java b/robottino/all_versions/v3.0/src/RobottinoMain/Robottino.java
new file mode 100755
index 0000000..5b9c530
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/RobottinoMain/Robottino.java
@@ -0,0 +1,63 @@
1// Robottino versione 3.0
2
3// Dichiaro che questa classe fa parte del package RobottinoMain, che verrà poi importato
4// dalle classi che dovranno interagire con essa.
5package RobottinoMain;
6
7// Importo la classe Grafica per poter "costruire" una finestra.
8import RobottinoUtils.*;
9
10// E il package Robottinoazioni per poterne inizializzare i vettori
11import RobottinoAzioni.*;
12
13// java.util.Vector serve a gestire i vettori.
14// I vettori sono come array, ma hanno due differenze principali:
15// 1) la loro lunghezza può variare durante l'esecuzione del programma
16// (per questo li ho preferiti agli array);
17// 2) possono contenere soltanto oggetti, e non tipi primitivi.
18import java.util.Vector;
19
20// Dichiaro la classe.
21public class Robottino {
22
23 // Istanzio la classe Thread per poter utilizzare il metodo sleep(int millisecondi)
24 // che in un metodo dell'interfaccia WindowListener, overridato nella classe Listener
25 // servirà a mettere il programma in uno stato di pausa.
26 // Sarebbe comunque possibile invocarlo, ma così sarà più facile da modificare in futuro.
27 public Thread threadMain;
28
29 // Crea la finestra tramite un'istanza della classe Grafica, del package RobottinoUtils.
30 public Grafica finestra;
31
32 // Creo anche un'istanza di questa classe per avere accesso agli elementi non statici.
33 public static Robottino robottino;
34
35 // Inizio del metodo main...
36 public static void main(String[] args) {
37
38 // Inizializzo i vari oggetti.
39 robottino = new Robottino();
40 robottino.finestra = new Grafica();
41 robottino.threadMain = new Thread(Thread.currentThread());
42
43 // Aggiungo gli elementi ai vettori.
44 // non potevo farlo prima, poiché al di fuori di un metodo è possibile soltanto
45 // dichiarare oggetti/variabili (e inizializzarli) o dichiarare un metodo
46 // e in RobottinoAzioni è presente solo il metodo Azioni che viene richiamato più volte.
47 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftArm);
48 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightArm);
49 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.leftLeg);
50 RobottinoAzioni.pdrB.addElement(RobottinoAzioni.rightLeg);
51 RobottinoAzioni.pdrA.addElement(RobottinoAzioni.pdrB);
52 RobottinoAzioni.nomeRobot.addElement("");
53 }
54}
55
56
57
58
59
60
61
62
63
diff --git a/robottino/all_versions/v3.0/src/RobottinoUtils/Grafica.java b/robottino/all_versions/v3.0/src/RobottinoUtils/Grafica.java
new file mode 100755
index 0000000..84bc8c0
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/RobottinoUtils/Grafica.java
@@ -0,0 +1,226 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Importo i package standard relativi al funzionamento delle finestre e della grafica in generale.
5import java.awt.*;
6
7// E i package RobottinoAzioni, RobottinoUtils e Immagini da me definiti.
8import RobottinoAzioni.*;
9import RobottinoUtils.Listener;
10import Immagini.*;
11
12// La classe è una sottoclasse di Frame per poter sfruttare gli effetti grafici
13// ma implementa anche l'interfaccia WindowListener, necessaria per gestire gli eventi collegati alle finestre
14// (riduzione a icona, chiusura...); per questo devo successivamente ridefinire tutti i
15// metodi dell'interfaccia.
16public class Grafica extends Frame {
17
18 // Creo un'istanza della classe Listener che userò come listener per gli eventi.
19 public static Listener listener;
20
21 // E una di ImmagineRobot per le immagini.
22 public static ImmagineRobot immagineRobot = new ImmagineRobot();
23
24 // Il costruttore senza argomenti.
25 public Grafica () {
26
27 // Il metodo "setBounds" posiziona e dimensiona la finestra.
28 setBounds (this.orizzontale, this.verticale, this.larghezza, this.altezza);
29
30 // "setTitle" per il titolo della finestra.
31 setTitle ("Robottino v2.2");
32
33 // "setVisible" per poterla visualizzare.
34 setVisible (true);
35
36 // E addWindowListener per l'ascoltatore (listener).
37 listener = new Listener();
38 addWindowListener (listener);
39
40 // Aggiungo la barra del menu con i vari sottomenu
41 setMenuBar (barraMenu);
42
43 // Il menu file.
44 NewRobot.addActionListener(listener);
45 NewRobot.setActionCommand("newrobot");
46
47 ChangeRobot.addActionListener(listener);
48 ChangeRobot.setActionCommand("changerobot");
49
50 DeleteRobot.addActionListener(listener);
51 DeleteRobot.setActionCommand("deleterobot");
52
53 Exit.addActionListener(listener);
54 Exit.setActionCommand("exit");
55
56 file.add(NewRobot);
57 file.add(ChangeRobot);
58 file.add(DeleteRobot);
59 file.addSeparator();
60 file.add(Exit);
61
62 barraMenu.add(file);
63
64 // Il braccio sinistro.
65 LeftArmMove.addActionListener(listener);
66 LeftArmMove.setActionCommand("leftarmmove");
67
68 LeftArmOn.addActionListener(listener);
69 LeftArmOn.setActionCommand("leftarmon");
70
71 LeftArmOff.addActionListener(listener);
72 LeftArmOff.setActionCommand("leftarmoff");
73
74 LeftArm.add(LeftArmMove);
75 LeftArm.add(LeftArmOn);
76 LeftArm.add(LeftArmOff);
77
78 // Il braccio destro.
79 RightArmMove.addActionListener(listener);
80 RightArmMove.setActionCommand("rightarmmove");
81
82 RightArmOn.addActionListener(listener);
83 RightArmOn.setActionCommand("rightarmon");
84
85 RightArmOff.addActionListener(listener);
86 RightArmOff.setActionCommand("rightarmoff");
87
88 RightArm.add(RightArmMove);
89 RightArm.add(RightArmOn);
90 RightArm.add(RightArmOff);
91
92 // La gamba sinistra.
93 LeftLegMove.addActionListener(listener);
94 LeftLegMove.setActionCommand("leftlegmove");
95
96 LeftLegOn.addActionListener(listener);
97 LeftLegOn.setActionCommand("leftlegon");
98
99 LeftLegOff.addActionListener(listener);
100 LeftLegOff.setActionCommand("leftlegoff");
101
102 LeftLeg.add(LeftLegMove);
103 LeftLeg.add(LeftLegOn);
104 LeftLeg.add(LeftLegOff);
105
106 // La gamba destra.
107 RightLegMove.addActionListener(listener);
108 RightLegMove.setActionCommand("rightlegmove");
109
110 RightLegOn.addActionListener(listener);
111 RightLegOn.setActionCommand("rightlegon");
112
113 RightLegOff.addActionListener(listener);
114 RightLegOff.setActionCommand("rightlegoff");
115
116 RightLeg.add(RightLegMove);
117 RightLeg.add(RightLegOn);
118 RightLeg.add(RightLegOff);
119
120 // Menu rinomina.
121 Rename.addActionListener(listener);
122 Rename.setActionCommand("rename");
123
124 Menu modifica = new Menu("Modifica");
125 modifica.add(LeftArm);
126 modifica.add(RightArm);
127 modifica.add(LeftLeg);
128 modifica.add(RightLeg);
129 modifica.addSeparator();
130 modifica.add(Rename);
131
132 barraMenu.add(modifica);
133
134 // Menu azioni.
135 Exploud.addActionListener(listener);
136 Exploud.setActionCommand("exploud");
137
138 Bier.addActionListener(listener);
139 Bier.setActionCommand("bier");
140
141 xxx.addActionListener(listener);
142 xxx.setActionCommand("xxx");
143
144 Dance.addActionListener(listener);
145 Dance.setActionCommand("dance");
146
147 azioni.add(Exploud);
148 azioni.add(Bier);
149 azioni.add(xxx);
150 azioni.add(Dance);
151
152 barraMenu.add(azioni);
153
154 // Menu info.
155 Porky.addActionListener(listener);
156 Porky.setActionCommand("porky");
157
158 l.addActionListener(listener);
159 l.setActionCommand("l");
160
161 RobotList.addActionListener(listener);
162 RobotList.setActionCommand("robotlist");
163
164 info.add(Porky);
165 info.add(l);
166 info.add(RobotList);
167
168 barraMenu.add(info);
169 }
170
171 // Le variabili pubbliche di classe per il metodo "setBounds".
172 public int orizzontale = 0;
173 public int verticale = 0;
174 public int larghezza = 360;
175 public int altezza = 550;
176
177 // E i vari Menu e MenuItem.
178 MenuBar barraMenu = new MenuBar();
179 Menu file = new Menu("File");
180 MenuItem NewRobot = new MenuItem("Nuovo robot");
181 MenuItem ChangeRobot = new MenuItem("Dai i comandi a un altro robot");
182 MenuItem DeleteRobot = new MenuItem("Elimina un robot");
183 MenuItem Exit = new MenuItem("Esci");
184 Menu LeftArm = new Menu("Braccio sinistro");
185 MenuItem LeftArmMove = new MenuItem("Cambia posizione");
186 MenuItem LeftArmOn = new MenuItem("Alza");
187 MenuItem LeftArmOff = new MenuItem("Abbassa");
188 Menu RightArm = new Menu("Braccio destro");
189 MenuItem RightArmMove = new MenuItem("Cambia posizione");
190 MenuItem RightArmOn = new MenuItem("Alza");
191 MenuItem RightArmOff = new MenuItem("Abbassa");
192 Menu LeftLeg = new Menu("Gamba sinistra");
193 MenuItem LeftLegMove = new MenuItem("Cambia posizione");
194 MenuItem LeftLegOn = new MenuItem("Alza");
195 MenuItem LeftLegOff = new MenuItem("Abbassa");
196 Menu RightLeg = new Menu("Gamba destra");
197 MenuItem RightLegMove = new MenuItem("Cambia posizione");
198 MenuItem RightLegOn = new MenuItem("Alza");
199 MenuItem RightLegOff = new MenuItem("Abbassa");
200 MenuItem Rename = new MenuItem("Rinomina");
201 Menu azioni = new Menu("Azioni");
202 MenuItem Exploud = new MenuItem("Esplodi");
203 MenuItem Bier = new MenuItem("Birra");
204 MenuItem xxx = new MenuItem("xxx");
205 MenuItem Dance = new MenuItem("Balla");
206 Menu info = new Menu("?");
207 MenuItem Porky = new MenuItem("Informazioni sul programmatore");
208 MenuItem l = new MenuItem("Legenda Comandi");
209 MenuItem RobotList = new MenuItem("Lista robot");
210
211
212 // Il metodo per disegnare l'immagine del robot.
213 public void paint(Graphics g){
214 g.drawImage(immagineRobot.robot, 100, 60, this);
215 g.drawImage(immagineRobot.raoff, 66, 248, this);
216 g.drawImage(immagineRobot.laoff, 225, 242, this);
217 g.drawImage(immagineRobot.rloff, 84, 367, this);
218 g.drawImage(immagineRobot.lloff, 148, 367, this);
219 }
220
221
222}
223
224
225
226
diff --git a/robottino/all_versions/v3.0/src/RobottinoUtils/Listener.java b/robottino/all_versions/v3.0/src/RobottinoUtils/Listener.java
new file mode 100755
index 0000000..d9c813a
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/RobottinoUtils/Listener.java
@@ -0,0 +1,73 @@
1// Questa classe è il listener per gli eventi relativi alle finestre.
2// Dichiaro che farà parte del package RobottinoUtils
3package RobottinoUtils;
4
5// Importo i package necessari.
6import java.awt.event.*;
7import RobottinoMain.*;
8import RobottinoAzioni.*;
9
10public class Listener implements WindowListener, ActionListener {
11
12 RobottinoAzioni robottinoazioni = new RobottinoAzioni();
13
14
15 // Ridefinisco i metodi dell'interfaccia WindowListener:
16 // Metodo invocato quando la finestra è stata chiusa:
17 public void windowClosed (WindowEvent evt) {
18
19 // Invoco il metodo sleep(int millisecondi) per mettere il programma in uno stato di attesa
20 // di durata pari ai millisecondi indicati come argomento.
21 System.out.println("La finestra è stata chiusa, il programma terminarà fra 3 secondi");
22 try {
23 Robottino.robottino.threadMain.sleep(1000);
24 } catch (Exception e) { e.printStackTrace(); }
25 System.out.println("2");
26 try {
27 Robottino.robottino.threadMain.sleep(1000);
28 } catch (Exception e) { e.printStackTrace(); }
29 System.out.println("1");
30 try {
31 Robottino.robottino.threadMain.sleep(1000);
32 } catch (Exception e) { e.printStackTrace(); }
33 System.out.println("Programma terminato");
34 System.exit(0);
35 }
36
37 // Metodo invocato quando la finestra è in fase di chiusura:
38 public void windowClosing (WindowEvent evt) {
39 System.out.println ("Chiusura finestra in corso");
40 evt.getWindow().dispose();
41 }
42
43 // Metodo invocato quando una finestra viene ridotta a icona:
44 public void windowIconified (WindowEvent evt) {
45 System.out.println("La finestra è stata ridotta a icona");
46 }
47
48 // Metodo invocato quando una finestra ridotta a icona viene ingrandita:
49 public void windowDeiconified (WindowEvent evt) {
50 System.out.println("La finestra ridotta a icona è stata ingrandita");
51 }
52
53 // Metodo invocato quando una finestra viene aperta:
54 public void windowOpened (WindowEvent evt) {}
55
56 // Metodo invocato quando una finestra diventa attiva:
57 public void windowActivated (WindowEvent evt) {}
58
59 // Metodo invocato quando una finestra viene disattivata:
60 public void windowDeactivated (WindowEvent evt) {}
61
62 // Metodo invocato quando viene utilizzata la barra del menu:
63 // descrive tutte le azioni da compiere per ogni evento ricevuto
64 // dal menu.
65 public void actionPerformed (ActionEvent e) {
66 System.out.println (robottinoazioni.Azioni(e.getActionCommand(), RobottinoAzioni.nomeRobot, RobottinoAzioni.pdrA));
67 }
68}
69
70
71
72
73
diff --git a/robottino/all_versions/v3.0/src/RobottinoUtils/PartiDelRobot.java b/robottino/all_versions/v3.0/src/RobottinoUtils/PartiDelRobot.java
new file mode 100755
index 0000000..d6cf869
--- /dev/null
+++ b/robottino/all_versions/v3.0/src/RobottinoUtils/PartiDelRobot.java
@@ -0,0 +1,22 @@
1// Dichiaro che questa classa farà parte del package RobottinoUtils, che verrà poi importato dalla classe Robottino.
2package RobottinoUtils;
3
4// Dichiaro la classe.
5public class PartiDelRobot {
6
7 // Creo un costruttore senza argomenti.
8 // Se non lo facessi sarei obbligato a passare gli argomenti
9 // del secondo costruttore ogni volta che voglio istanziare la classe.
10 public PartiDelRobot() {}
11
12 // Il secondo costruttore riceve come argomenti un booleano che passerà il valore a "statoParte"
13 // e una stringa che passa il valore a "stringaParte".
14 public PartiDelRobot(boolean b, String s) {
15 this.stringaParte = s;
16 this.statoParte = b;
17 }
18
19 // Infine le due variabili pubbliche della classe.
20 public String stringaParte;
21 public boolean statoParte;
22}
diff --git a/robottino/all_versions/v4.0.1/Robottino.jar b/robottino/all_versions/v4.0.1/Robottino.jar
new file mode 100755
index 0000000..93b5d53
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/Robottino.jar
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/Frame.java b/robottino/all_versions/v4.0.1/src/Frame.java
new file mode 100755
index 0000000..8ec087b
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/Frame.java
@@ -0,0 +1,66 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24
25public class Frame extends JFrame {
26 public class Listener implements ActionListener {
27 public void actionPerformed( ActionEvent e ) {
28 if ( e.getSource() == exit )
29 System.exit(0);
30 else if ( e.getSource() == informazioni )
31 JOptionPane.showMessageDialog( main.frame, "info", "Robottino v4.0 - Informazioni", JOptionPane.INFORMATION_MESSAGE );
32 else if ( e.getSource() == nuovo ) {
33 String nome = JOptionPane.showInputDialog( main.frame, "Inserire il nome del nuovo robottino:", "Robot " + ( ++main.robots ) );
34 if ( nome != null )
35 main.list.newRobot( nome );
36 }
37 }
38 }
39 public static Listener listener;
40 public static Main main;
41 public static JMenuBar barraMenu = new JMenuBar();
42 public static JMenu file = new JMenu( "File" );
43 public static JMenu info = new JMenu( "?" );
44 public static JMenuItem exit = new JMenuItem( "Esci" );
45 public static JMenuItem informazioni = new JMenuItem( "Informazioni" );
46 public static JMenuItem nuovo = new JMenuItem( "Nuovo Robot" );
47 public Frame() {
48 super( "Robottino versione 4.0" );
49 listener = new Listener();
50 main = new Main();
51 exit.addActionListener( listener );
52 exit.setMnemonic( 'E' );
53 informazioni.addActionListener( listener );
54 informazioni.setMnemonic( 'I' );
55 nuovo.addActionListener( listener );
56 nuovo.setMnemonic( 'N' );
57 file.add( exit );
58 file.add( nuovo );
59 file.setMnemonic( 'F' );
60 info.add( informazioni );
61 info.setMnemonic( '?' );
62 barraMenu.add( file );
63 barraMenu.add( info );
64 setJMenuBar( barraMenu );
65 }
66} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/List.java b/robottino/all_versions/v4.0.1/src/List.java
new file mode 100755
index 0000000..b4f9982
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/List.java
@@ -0,0 +1,74 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JOptionPane;
23
24public class List {
25 public static Main main = new Main();
26 public Robot primoRobot, ultimoRobot;
27 public List() {
28 primoRobot = ultimoRobot = null;
29 }
30 public boolean vuota() {
31 return primoRobot == null;
32 }
33 public Robot getRobot( String nome ) {
34 Robot i = primoRobot;
35 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
36 return i;
37 }
38 public void newRobot() {
39 newRobot( false, false, false, false, "" );
40 }
41 public void newRobot( String nome ) {
42 newRobot( false, false, false, false, nome );
43 }
44 public void newRobot( boolean la, boolean ra, boolean ll, boolean rl, String nome ) {
45 if ( vuota() )
46 primoRobot = ultimoRobot = new Robot( la, ra, ll, rl, nome, null, null );
47 else {
48 ultimoRobot = new Robot( la, ra, ll, rl, nome, ultimoRobot, null );
49 ultimoRobot.precedenteRobot.prossimoRobot = ultimoRobot;
50 }
51 }
52 public void deleteRobot( String nome ) {
53 if ( vuota() )
54 JOptionPane.showMessageDialog( main.frame, "Nessun robottino presente. Impossibile cancellarne uno", "Robottino v4.0 - Errore", JOptionPane.ERROR_MESSAGE );
55 else {
56 Robot i = primoRobot;
57 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
58 if ( i.precedenteRobot != null )
59 i.precedenteRobot.prossimoRobot = i.prossimoRobot;
60 else
61 primoRobot = i.prossimoRobot;
62 if ( i.prossimoRobot != null )
63 i.prossimoRobot.precedenteRobot = i.precedenteRobot;
64 else
65 ultimoRobot = i.precedenteRobot;
66 }
67 }
68 public void printList() {
69 String lista = "";
70 for ( Robot i = primoRobot; i != null; i = i.prossimoRobot )
71 lista += i.getName() + " ";
72 JOptionPane.showMessageDialog( main.frame, lista, "Robottino v4.0 - Robottini Presenti", JOptionPane.PLAIN_MESSAGE );
73 }
74} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/Main.java b/robottino/all_versions/v4.0.1/src/Main.java
new file mode 100755
index 0000000..4ef0206
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/Main.java
@@ -0,0 +1,36 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23
24public class Main {
25 public static int robots;
26 public static List list;
27 public static Frame frame;
28 public static void main ( String args[] ) {
29 robots = 0;
30 list = new List();
31 frame = new Frame();
32 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
33 frame.setSize( 350, 150 );
34 frame.setVisible( true );
35 }
36} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/Robot.java b/robottino/all_versions/v4.0.1/src/Robot.java
new file mode 100755
index 0000000..6a57c4d
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/Robot.java
@@ -0,0 +1,107 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class Robot {
27 public static Main main = new Main();
28 boolean leftArm, rightArm, leftLeg, rightLeg;
29 String nomeRobot;
30 Robot precedenteRobot, prossimoRobot;
31 RobotFrame robotFrame;
32 Robot() {
33 this( false, false, false, false, "", main.list.ultimoRobot, null );
34 }
35 Robot( String nome ) {
36 this ( false, false, false, false, nome, main.list.ultimoRobot, null );
37 }
38 Robot( boolean la, boolean ra, boolean ll, boolean rl, String nome, Robot prec, Robot prox ) {
39 leftArm = la;
40 rightArm = ra;
41 leftLeg = ll;
42 rightLeg = rl;
43 nomeRobot = nome;
44 precedenteRobot = prec;
45 prossimoRobot = prox;
46 robotFrame = new RobotFrame( nome );
47 robotFrame.setSize( 350, 600 );
48 robotFrame.setVisible( true );
49 robotFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
50 robotFrame.addWindowListener(
51 new WindowAdapter() {
52 public void windowClosing( WindowEvent e ) {
53 int selezione = JOptionPane.showOptionDialog( Robot.this.robotFrame, "Eliminare il robottino " + Robot.this.getName() + " ?", "Robottino v4.0 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
54 if ( selezione == JOptionPane.YES_OPTION ) {
55 main.list.deleteRobot( Robot.this.getName() );
56 robotFrame.dispose();
57 }
58 else {
59 try {
60 Thread.currentThread().sleep( 50 );
61 } catch ( Exception e2 ) {}
62 robotFrame.repaint();
63 }
64 }
65 }
66 );
67 }
68 void setLA( boolean la ) {
69 setPositions( la, this.rightArm, this.leftLeg, this.rightLeg );
70 }
71 void setRA( boolean ra ) {
72 setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg );
73 }
74 void setLL( boolean ll ) {
75 setPositions( this.leftArm, this.rightArm, ll, this.rightLeg );
76 }
77 void setRL( boolean rl ) {
78 setPositions( this.leftArm, this.rightArm, this.leftLeg, rl );
79 }
80 void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) {
81 leftArm = la;
82 rightArm = ra;
83 leftLeg = ll;
84 rightLeg = rl;
85 }
86 void setName( String nome ) {
87 nomeRobot = nome;
88 }
89 boolean getLA() {
90 return leftArm;
91 }
92 boolean getRA() {
93 return rightArm;
94 }
95 boolean getLL() {
96 return leftLeg;
97 }
98 boolean getRL() {
99 return rightLeg;
100 }
101 String getName() {
102 return nomeRobot;
103 }
104 Robot getNext() {
105 return prossimoRobot;
106 }
107} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/RobotFrame.java b/robottino/all_versions/v4.0.1/src/RobotFrame.java
new file mode 100755
index 0000000..df099f1
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/RobotFrame.java
@@ -0,0 +1,118 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class RobotFrame extends JFrame implements ActionListener {
27 public static Main main;
28 public static RobotPanel robotPanel;
29 public static JMenuBar barraMenu;
30 public static JMenu modifica, raMenu, laMenu, rlMenu, llMenu;
31 public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem;
32 public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem;
33 RobotFrame( String titolo ) {
34 super ( titolo );
35 robotPanel = new RobotPanel( titolo );
36 raonMenuItem = new JMenuItem( "Alza" );
37 laonMenuItem = new JMenuItem( "Alza" );
38 rlonMenuItem = new JMenuItem( "Alza" );
39 llonMenuItem = new JMenuItem( "Alza" );
40 raoffMenuItem = new JMenuItem( "Abbassa" );
41 laoffMenuItem = new JMenuItem( "Abbassa" );
42 rloffMenuItem = new JMenuItem( "Abbassa" );
43 lloffMenuItem = new JMenuItem( "Abbassa" );
44 rachangeMenuItem = new JMenuItem( "Cambia posizione" );
45 lachangeMenuItem = new JMenuItem( "Cambia posizione" );
46 rlchangeMenuItem = new JMenuItem( "Cambia posizione" );
47 llchangeMenuItem = new JMenuItem( "Cambia posizione" );
48 raonMenuItem.addActionListener( this );
49 raoffMenuItem.addActionListener( this );
50 rachangeMenuItem.addActionListener( this );
51 laonMenuItem.addActionListener( this );
52 laoffMenuItem.addActionListener( this );
53 lachangeMenuItem.addActionListener( this );
54 rlonMenuItem.addActionListener( this );
55 rloffMenuItem.addActionListener( this );
56 rlchangeMenuItem.addActionListener( this );
57 llonMenuItem.addActionListener( this );
58 lloffMenuItem.addActionListener( this );
59 llchangeMenuItem.addActionListener( this );
60 raMenu = new JMenu( "Braccio destro" );
61 raMenu.add( raonMenuItem );
62 raMenu.add( raoffMenuItem );
63 raMenu.add( rachangeMenuItem );
64 laMenu = new JMenu( "Braccio sinistro" );
65 laMenu.add( laonMenuItem );
66 laMenu.add( laoffMenuItem );
67 laMenu.add( lachangeMenuItem );
68 rlMenu = new JMenu( "Gamba destra" );
69 rlMenu.add( rlonMenuItem );
70 rlMenu.add( rloffMenuItem );
71 rlMenu.add( rlchangeMenuItem );
72 llMenu = new JMenu( "Gamba sinistra" );
73 llMenu.add( llonMenuItem );
74 llMenu.add( lloffMenuItem );
75 llMenu.add( llchangeMenuItem );
76 modifica = new JMenu( "Modifica" );
77 modifica.add( raMenu );
78 modifica.add( laMenu );
79 modifica.add( rlMenu );
80 modifica.add( llMenu );
81 barraMenu = new JMenuBar();
82 barraMenu.add( modifica );
83 setJMenuBar( barraMenu );
84 add( robotPanel );
85 }
86 public void actionPerformed( ActionEvent e ) {
87 esegui( e );
88 }
89 public void esegui( ActionEvent e ) {
90 if ( e.getSource() == raonMenuItem )
91 main.list.getRobot( this.getTitle() ).rightArm = true;
92 else if ( e.getSource() == raoffMenuItem )
93 main.list.getRobot( this.getTitle() ).rightArm = false;
94 else if ( e.getSource() == rachangeMenuItem )
95 main.list.getRobot( this.getTitle() ).rightArm = !main.list.getRobot( this.getTitle() ).rightArm;
96 else if ( e.getSource() == laonMenuItem )
97 main.list.getRobot( this.getTitle() ).leftArm = true;
98 else if ( e.getSource() == laoffMenuItem )
99 main.list.getRobot( this.getTitle() ).leftArm = false;
100 else if ( e.getSource() == lachangeMenuItem )
101 main.list.getRobot( this.getTitle() ).leftArm = !main.list.getRobot( this.getTitle() ).leftArm;
102 if ( e.getSource() == rlonMenuItem )
103 main.list.getRobot( this.getTitle() ).rightLeg = true;
104 else if ( e.getSource() == rloffMenuItem )
105 main.list.getRobot( this.getTitle() ).rightLeg = false;
106 else if ( e.getSource() == rlchangeMenuItem )
107 main.list.getRobot( this.getTitle() ).rightLeg = !main.list.getRobot( this.getTitle() ).rightLeg;
108 else if ( e.getSource() == llonMenuItem )
109 main.list.getRobot( this.getTitle() ).leftLeg = true;
110 else if ( e.getSource() == lloffMenuItem )
111 main.list.getRobot( this.getTitle() ).leftLeg = false;
112 else if ( e.getSource() == llchangeMenuItem )
113 main.list.getRobot( this.getTitle() ).leftLeg = !main.list.getRobot( this.getTitle() ).leftLeg;
114 robotPanel.setImages();
115 repaint();
116 }
117
118} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/RobotPanel.java b/robottino/all_versions/v4.0.1/src/RobotPanel.java
new file mode 100755
index 0000000..b66d90e
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/RobotPanel.java
@@ -0,0 +1,96 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.*;
24
25public class RobotPanel extends JPanel {
26 public static String nomeRobot;
27 public static Main main;
28 public static ImageIcon ra, la, rl, ll, body;
29 public static int rax, ray, lax, lay, rlx, rly, llx, lly;
30 RobotPanel( String nomeRobot ) {
31 this.nomeRobot = nomeRobot;
32 rax = 66;
33 ray = 248;
34 lax = 225;
35 lay = 242;
36 rlx = 84;
37 rly = 367;
38 llx = 148;
39 lly = 367;
40 body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
41 ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
42 la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
43 rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
44 ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
45 }
46 public void paint ( Graphics g ) {
47 super.paint( g );
48 body.paintIcon( this, g, 100, 60 );
49 ra.paintIcon( this, g, this.rax, this.ray );
50 la.paintIcon( this, g, this.lax, this.lay );
51 rl.paintIcon( this, g, this.rlx, this.rly );
52 ll.paintIcon( this, g, this.llx, this.lly );
53 }
54 public void setImages() {
55 if ( main.list.getRobot( nomeRobot ).rightArm ) {
56 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raon.gif" ) );
57 this.rax = 68;
58 this.ray = 128;
59 }
60 else {
61 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
62 this.rax = 66;
63 this.ray = 248;
64 }
65 if ( main.list.getRobot( nomeRobot ).leftArm ) {
66 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laon.gif" ) );
67 this.lax = 224;
68 this.lay = 118;
69 }
70 else {
71 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
72 this.lax = 225;
73 this.lay = 242;
74 }
75 if ( main.list.getRobot( nomeRobot ).rightLeg ) {
76 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rlon.gif" ) );
77 this.rlx = 84;
78 this.rly = 356;
79 }
80 else {
81 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
82 this.rlx = 84;
83 this.rly = 367;
84 }
85 if ( main.list.getRobot( nomeRobot ).leftLeg ) {
86 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/llon.gif" ) );
87 this.llx = 140;
88 this.lly = 363;
89 }
90 else {
91 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
92 this.llx = 148;
93 this.lly = 367;
94 }
95 }
96} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0.1/src/img/birra1.jpg b/robottino/all_versions/v4.0.1/src/img/birra1.jpg
new file mode 100755
index 0000000..6cbf8a8
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/birra1.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/birra2.jpg b/robottino/all_versions/v4.0.1/src/img/birra2.jpg
new file mode 100755
index 0000000..3b3caae
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/birra2.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/birra3.jpg b/robottino/all_versions/v4.0.1/src/img/birra3.jpg
new file mode 100755
index 0000000..9bc6971
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/birra3.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/birra4.jpg b/robottino/all_versions/v4.0.1/src/img/birra4.jpg
new file mode 100755
index 0000000..970f2ff
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/birra4.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/birra5.gif b/robottino/all_versions/v4.0.1/src/img/birra5.gif
new file mode 100755
index 0000000..6318d90
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/birra5.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/laoff.gif b/robottino/all_versions/v4.0.1/src/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/laon.gif b/robottino/all_versions/v4.0.1/src/img/laon.gif
new file mode 100755
index 0000000..1880677
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/laon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/lloff.gif b/robottino/all_versions/v4.0.1/src/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/llon.gif b/robottino/all_versions/v4.0.1/src/img/llon.gif
new file mode 100755
index 0000000..ab1ff75
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/llon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/raoff.gif b/robottino/all_versions/v4.0.1/src/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/raon.gif b/robottino/all_versions/v4.0.1/src/img/raon.gif
new file mode 100755
index 0000000..46190a8
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/raon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/rloff.gif b/robottino/all_versions/v4.0.1/src/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/rlon.gif b/robottino/all_versions/v4.0.1/src/img/rlon.gif
new file mode 100755
index 0000000..447464b
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/rlon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0.1/src/img/robot.gif b/robottino/all_versions/v4.0.1/src/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/img/robot.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/Robottino.jar b/robottino/all_versions/v4.0/Robottino.jar
new file mode 100755
index 0000000..31b7fe8
--- /dev/null
+++ b/robottino/all_versions/v4.0/Robottino.jar
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/Frame.java b/robottino/all_versions/v4.0/src/Frame.java
new file mode 100755
index 0000000..8ec087b
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/Frame.java
@@ -0,0 +1,66 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24
25public class Frame extends JFrame {
26 public class Listener implements ActionListener {
27 public void actionPerformed( ActionEvent e ) {
28 if ( e.getSource() == exit )
29 System.exit(0);
30 else if ( e.getSource() == informazioni )
31 JOptionPane.showMessageDialog( main.frame, "info", "Robottino v4.0 - Informazioni", JOptionPane.INFORMATION_MESSAGE );
32 else if ( e.getSource() == nuovo ) {
33 String nome = JOptionPane.showInputDialog( main.frame, "Inserire il nome del nuovo robottino:", "Robot " + ( ++main.robots ) );
34 if ( nome != null )
35 main.list.newRobot( nome );
36 }
37 }
38 }
39 public static Listener listener;
40 public static Main main;
41 public static JMenuBar barraMenu = new JMenuBar();
42 public static JMenu file = new JMenu( "File" );
43 public static JMenu info = new JMenu( "?" );
44 public static JMenuItem exit = new JMenuItem( "Esci" );
45 public static JMenuItem informazioni = new JMenuItem( "Informazioni" );
46 public static JMenuItem nuovo = new JMenuItem( "Nuovo Robot" );
47 public Frame() {
48 super( "Robottino versione 4.0" );
49 listener = new Listener();
50 main = new Main();
51 exit.addActionListener( listener );
52 exit.setMnemonic( 'E' );
53 informazioni.addActionListener( listener );
54 informazioni.setMnemonic( 'I' );
55 nuovo.addActionListener( listener );
56 nuovo.setMnemonic( 'N' );
57 file.add( exit );
58 file.add( nuovo );
59 file.setMnemonic( 'F' );
60 info.add( informazioni );
61 info.setMnemonic( '?' );
62 barraMenu.add( file );
63 barraMenu.add( info );
64 setJMenuBar( barraMenu );
65 }
66} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0/src/List.java b/robottino/all_versions/v4.0/src/List.java
new file mode 100755
index 0000000..b4f9982
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/List.java
@@ -0,0 +1,74 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JOptionPane;
23
24public class List {
25 public static Main main = new Main();
26 public Robot primoRobot, ultimoRobot;
27 public List() {
28 primoRobot = ultimoRobot = null;
29 }
30 public boolean vuota() {
31 return primoRobot == null;
32 }
33 public Robot getRobot( String nome ) {
34 Robot i = primoRobot;
35 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
36 return i;
37 }
38 public void newRobot() {
39 newRobot( false, false, false, false, "" );
40 }
41 public void newRobot( String nome ) {
42 newRobot( false, false, false, false, nome );
43 }
44 public void newRobot( boolean la, boolean ra, boolean ll, boolean rl, String nome ) {
45 if ( vuota() )
46 primoRobot = ultimoRobot = new Robot( la, ra, ll, rl, nome, null, null );
47 else {
48 ultimoRobot = new Robot( la, ra, ll, rl, nome, ultimoRobot, null );
49 ultimoRobot.precedenteRobot.prossimoRobot = ultimoRobot;
50 }
51 }
52 public void deleteRobot( String nome ) {
53 if ( vuota() )
54 JOptionPane.showMessageDialog( main.frame, "Nessun robottino presente. Impossibile cancellarne uno", "Robottino v4.0 - Errore", JOptionPane.ERROR_MESSAGE );
55 else {
56 Robot i = primoRobot;
57 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
58 if ( i.precedenteRobot != null )
59 i.precedenteRobot.prossimoRobot = i.prossimoRobot;
60 else
61 primoRobot = i.prossimoRobot;
62 if ( i.prossimoRobot != null )
63 i.prossimoRobot.precedenteRobot = i.precedenteRobot;
64 else
65 ultimoRobot = i.precedenteRobot;
66 }
67 }
68 public void printList() {
69 String lista = "";
70 for ( Robot i = primoRobot; i != null; i = i.prossimoRobot )
71 lista += i.getName() + " ";
72 JOptionPane.showMessageDialog( main.frame, lista, "Robottino v4.0 - Robottini Presenti", JOptionPane.PLAIN_MESSAGE );
73 }
74} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0/src/Main.java b/robottino/all_versions/v4.0/src/Main.java
new file mode 100755
index 0000000..4ef0206
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/Main.java
@@ -0,0 +1,36 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23
24public class Main {
25 public static int robots;
26 public static List list;
27 public static Frame frame;
28 public static void main ( String args[] ) {
29 robots = 0;
30 list = new List();
31 frame = new Frame();
32 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
33 frame.setSize( 350, 150 );
34 frame.setVisible( true );
35 }
36} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0/src/Robot.java b/robottino/all_versions/v4.0/src/Robot.java
new file mode 100755
index 0000000..bf0e186
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/Robot.java
@@ -0,0 +1,126 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class Robot {
27 public static Main main = new Main();
28 boolean leftArm, rightArm, leftLeg, rightLeg;
29 String nomeRobot;
30 Robot precedenteRobot, prossimoRobot;
31 RobotFrame robotFrame;
32 Robot() {
33 this( false, false, false, false, "", main.list.ultimoRobot, null );
34 }
35 Robot( String nome ) {
36 this ( false, false, false, false, nome, main.list.ultimoRobot, null );
37 }
38 Robot( boolean la, boolean ra, boolean ll, boolean rl, String nome, Robot prec, Robot prox ) {
39 leftArm = la;
40 rightArm = ra;
41 leftLeg = ll;
42 rightLeg = rl;
43 nomeRobot = nome;
44 precedenteRobot = prec;
45 prossimoRobot = prox;
46 robotFrame = new RobotFrame( nome );
47 robotFrame.setSize( 350, 550 );
48 robotFrame.setVisible( true );
49 robotFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
50 robotFrame.addWindowListener(
51 new WindowAdapter() {
52 public void windowClosing( WindowEvent e ) {
53 int selezione = JOptionPane.showOptionDialog( Robot.this.robotFrame, "Eliminare il robottino " + Robot.this.getName() + " ?", "Robottino v4.0 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
54 if ( selezione == JOptionPane.YES_OPTION ) {
55 main.list.deleteRobot( Robot.this.getName() );
56 robotFrame.dispose();
57 }
58 else {
59 try {
60 Thread.currentThread().sleep( 50 );
61 } catch ( Exception e2 ) {}
62 robotFrame.repaint();
63 }
64 }
65 public void windowActivated( WindowEvent e ) {
66 robotFrame.repaint();
67 }
68 }
69 );
70 robotFrame.addComponentListener(
71 new ComponentAdapter() {
72 public void componentMoved( ComponentEvent e ) {
73 try {
74 Thread.currentThread().sleep( 50 );
75 } catch ( Exception e2 ) {}
76 robotFrame.repaint();
77 }
78 public void componentResized( ComponentEvent e ) {
79 try {
80 Thread.currentThread().sleep( 50 );
81 } catch ( Exception e2 ) {}
82 robotFrame.repaint();
83 }
84 }
85 );
86 }
87 void setLA( boolean la ) {
88 setPositions( la, this.rightArm, this.leftLeg, this.rightLeg );
89 }
90 void setRA( boolean ra ) {
91 setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg );
92 }
93 void setLL( boolean ll ) {
94 setPositions( this.leftArm, this.rightArm, ll, this.rightLeg );
95 }
96 void setRL( boolean rl ) {
97 setPositions( this.leftArm, this.rightArm, this.leftLeg, rl );
98 }
99 void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) {
100 leftArm = la;
101 rightArm = ra;
102 leftLeg = ll;
103 rightLeg = rl;
104 }
105 void setName( String nome ) {
106 nomeRobot = nome;
107 }
108 boolean getLA() {
109 return leftArm;
110 }
111 boolean getRA() {
112 return rightArm;
113 }
114 boolean getLL() {
115 return leftLeg;
116 }
117 boolean getRL() {
118 return rightLeg;
119 }
120 String getName() {
121 return nomeRobot;
122 }
123 Robot getNext() {
124 return prossimoRobot;
125 }
126} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0/src/RobotFrame.java b/robottino/all_versions/v4.0/src/RobotFrame.java
new file mode 100755
index 0000000..ad7067f
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/RobotFrame.java
@@ -0,0 +1,179 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class RobotFrame extends JFrame implements ActionListener {
27 public static int rax, ray, lax, lay, rlx, rly, llx, lly;
28 public static Main main;
29 public static ImageIcon ra, la, rl, ll, body;
30 public static JMenuBar barraMenu;
31 public static JMenu modifica, raMenu, laMenu, rlMenu, llMenu;
32 public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem;
33 public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem;
34 RobotFrame( String titolo ) {
35 super ( titolo );
36 rax = 66;
37 ray = 248;
38 lax = 225;
39 lay = 242;
40 rlx = 84;
41 rly = 367;
42 llx = 148;
43 lly = 367;
44 ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
45 la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
46 rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
47 ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
48 body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
49 raonMenuItem = new JMenuItem( "Alza" );
50 laonMenuItem = new JMenuItem( "Alza" );
51 rlonMenuItem = new JMenuItem( "Alza" );
52 llonMenuItem = new JMenuItem( "Alza" );
53 raoffMenuItem = new JMenuItem( "Abbassa" );
54 laoffMenuItem = new JMenuItem( "Abbassa" );
55 rloffMenuItem = new JMenuItem( "Abbassa" );
56 lloffMenuItem = new JMenuItem( "Abbassa" );
57 rachangeMenuItem = new JMenuItem( "Cambia posizione" );
58 lachangeMenuItem = new JMenuItem( "Cambia posizione" );
59 rlchangeMenuItem = new JMenuItem( "Cambia posizione" );
60 llchangeMenuItem = new JMenuItem( "Cambia posizione" );
61 raonMenuItem.addActionListener( this );
62 raoffMenuItem.addActionListener( this );
63 rachangeMenuItem.addActionListener( this );
64 laonMenuItem.addActionListener( this );
65 laoffMenuItem.addActionListener( this );
66 lachangeMenuItem.addActionListener( this );
67 rlonMenuItem.addActionListener( this );
68 rloffMenuItem.addActionListener( this );
69 rlchangeMenuItem.addActionListener( this );
70 llonMenuItem.addActionListener( this );
71 lloffMenuItem.addActionListener( this );
72 llchangeMenuItem.addActionListener( this );
73 raMenu = new JMenu( "Braccio destro" );
74 raMenu.add( raonMenuItem );
75 raMenu.add( raoffMenuItem );
76 raMenu.add( rachangeMenuItem );
77 laMenu = new JMenu( "Braccio sinistro" );
78 laMenu.add( laonMenuItem );
79 laMenu.add( laoffMenuItem );
80 laMenu.add( lachangeMenuItem );
81 rlMenu = new JMenu( "Gamba destra" );
82 rlMenu.add( rlonMenuItem );
83 rlMenu.add( rloffMenuItem );
84 rlMenu.add( rlchangeMenuItem );
85 llMenu = new JMenu( "Gamba sinistra" );
86 llMenu.add( llonMenuItem );
87 llMenu.add( lloffMenuItem );
88 llMenu.add( llchangeMenuItem );
89 modifica = new JMenu( "Modifica" );
90 modifica.add( raMenu );
91 modifica.add( laMenu );
92 modifica.add( rlMenu );
93 modifica.add( llMenu );
94 barraMenu = new JMenuBar();
95 barraMenu.add( modifica );
96 setJMenuBar( barraMenu );
97 }
98 public void paint ( Graphics g ) {
99 super.paint( g );
100 body.paintIcon( this, g, 100, 60 );
101 ra.paintIcon( this, g, this.rax, this.ray );
102 la.paintIcon( this, g, this.lax, this.lay );
103 rl.paintIcon( this, g, this.rlx, this.rly );
104 ll.paintIcon( this, g, this.llx, this.lly );
105 }
106 public void actionPerformed( ActionEvent e ) {
107 esegui( e );
108 }
109 public void esegui( ActionEvent e ) {
110 if ( e.getSource() == raonMenuItem )
111 main.list.getRobot( this.getTitle() ).rightArm = true;
112 else if ( e.getSource() == raoffMenuItem )
113 main.list.getRobot( this.getTitle() ).rightArm = false;
114 else if ( e.getSource() == rachangeMenuItem )
115 main.list.getRobot( this.getTitle() ).rightArm = !main.list.getRobot( this.getTitle() ).rightArm;
116 else if ( e.getSource() == laonMenuItem )
117 main.list.getRobot( this.getTitle() ).leftArm = true;
118 else if ( e.getSource() == laoffMenuItem )
119 main.list.getRobot( this.getTitle() ).leftArm = false;
120 else if ( e.getSource() == lachangeMenuItem )
121 main.list.getRobot( this.getTitle() ).leftArm = !main.list.getRobot( this.getTitle() ).leftArm;
122 if ( e.getSource() == rlonMenuItem )
123 main.list.getRobot( this.getTitle() ).rightLeg = true;
124 else if ( e.getSource() == rloffMenuItem )
125 main.list.getRobot( this.getTitle() ).rightLeg = false;
126 else if ( e.getSource() == rlchangeMenuItem )
127 main.list.getRobot( this.getTitle() ).rightLeg = !main.list.getRobot( this.getTitle() ).rightLeg;
128 else if ( e.getSource() == llonMenuItem )
129 main.list.getRobot( this.getTitle() ).leftLeg = true;
130 else if ( e.getSource() == lloffMenuItem )
131 main.list.getRobot( this.getTitle() ).leftLeg = false;
132 else if ( e.getSource() == llchangeMenuItem )
133 main.list.getRobot( this.getTitle() ).leftLeg = !main.list.getRobot( this.getTitle() ).leftLeg;
134 setImages();
135 repaint();
136 }
137 public void setImages() {
138 if ( main.list.getRobot( this.getTitle() ).rightArm ) {
139 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raon.gif" ) );
140 this.rax = 68;
141 this.ray = 128;
142 }
143 else {
144 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
145 this.rax = 66;
146 this.ray = 248;
147 }
148 if ( main.list.getRobot( this.getTitle() ).leftArm ) {
149 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laon.gif" ) );
150 this.lax = 224;
151 this.lay = 118;
152 }
153 else {
154 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
155 this.lax = 225;
156 this.lay = 242;
157 }
158 if ( main.list.getRobot( this.getTitle() ).rightLeg ) {
159 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rlon.gif" ) );
160 this.rlx = 84;
161 this.rly = 356;
162 }
163 else {
164 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
165 this.rlx = 84;
166 this.rly = 367;
167 }
168 if ( main.list.getRobot( this.getTitle() ).leftLeg ) {
169 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/llon.gif" ) );
170 this.llx = 140;
171 this.lly = 363;
172 }
173 else {
174 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
175 this.llx = 148;
176 this.lly = 367;
177 }
178 }
179} \ No newline at end of file
diff --git a/robottino/all_versions/v4.0/src/img/laoff.gif b/robottino/all_versions/v4.0/src/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/laon.gif b/robottino/all_versions/v4.0/src/img/laon.gif
new file mode 100755
index 0000000..1880677
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/laon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/lloff.gif b/robottino/all_versions/v4.0/src/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/llon.gif b/robottino/all_versions/v4.0/src/img/llon.gif
new file mode 100755
index 0000000..ab1ff75
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/llon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/raoff.gif b/robottino/all_versions/v4.0/src/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/raon.gif b/robottino/all_versions/v4.0/src/img/raon.gif
new file mode 100755
index 0000000..46190a8
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/raon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/rloff.gif b/robottino/all_versions/v4.0/src/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/rlon.gif b/robottino/all_versions/v4.0/src/img/rlon.gif
new file mode 100755
index 0000000..447464b
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/rlon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.0/src/img/robot.gif b/robottino/all_versions/v4.0/src/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v4.0/src/img/robot.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/Robottino.jar b/robottino/all_versions/v4.1/Robottino.jar
new file mode 100755
index 0000000..61de888
--- /dev/null
+++ b/robottino/all_versions/v4.1/Robottino.jar
Binary files differ
diff --git a/robottino/all_versions/v4.1/license.txt b/robottino/all_versions/v4.1/license.txt
new file mode 100755
index 0000000..3912109
--- /dev/null
+++ b/robottino/all_versions/v4.1/license.txt
@@ -0,0 +1,340 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License
307 along with this program; if not, write to the Free Software
308 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
309
310
311Also add information on how to contact you by electronic and paper mail.
312
313If the program is interactive, make it output a short notice like this
314when it starts in an interactive mode:
315
316 Gnomovision version 69, Copyright (C) year name of author
317 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318 This is free software, and you are welcome to redistribute it
319 under certain conditions; type `show c' for details.
320
321The hypothetical commands `show w' and `show c' should show the appropriate
322parts of the General Public License. Of course, the commands you use may
323be called something other than `show w' and `show c'; they could even be
324mouse-clicks or menu items--whatever suits your program.
325
326You should also get your employer (if you work as a programmer) or your
327school, if any, to sign a "copyright disclaimer" for the program, if
328necessary. Here is a sample; alter the names:
329
330 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331 `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
333 <signature of Ty Coon>, 1 April 1989
334 Ty Coon, President of Vice
335
336This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General
340Public License instead of this License.
diff --git a/robottino/all_versions/v4.1/src/Frame.java b/robottino/all_versions/v4.1/src/Frame.java
new file mode 100755
index 0000000..a5283c1
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/Frame.java
@@ -0,0 +1,66 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24
25public class Frame extends JFrame {
26 public static Listener listener;
27 public static Main main;
28 public static JMenuBar barraMenu = new JMenuBar();
29 public static JMenu file = new JMenu( "File" );
30 public static JMenu info = new JMenu( "?" );
31 public static JMenuItem exit = new JMenuItem( "Esci" );
32 public static JMenuItem informazioni = new JMenuItem( "Informazioni" );
33 public static JMenuItem nuovo = new JMenuItem( "Nuovo Robot" );
34 public Frame() {
35 super( "Robottino versione 4.1" );
36 listener = new Listener();
37 main = new Main();
38 exit.addActionListener( listener );
39 exit.setMnemonic( 'E' );
40 informazioni.addActionListener( listener );
41 informazioni.setMnemonic( 'I' );
42 nuovo.addActionListener( listener );
43 nuovo.setMnemonic( 'N' );
44 file.add( exit );
45 file.add( nuovo );
46 file.setMnemonic( 'F' );
47 info.add( informazioni );
48 info.setMnemonic( '?' );
49 barraMenu.add( file );
50 barraMenu.add( info );
51 setJMenuBar( barraMenu );
52 }
53 public class Listener implements ActionListener {
54 public void actionPerformed( ActionEvent e ) {
55 if ( e.getSource() == exit )
56 System.exit(0);
57 else if ( e.getSource() == informazioni )
58 JOptionPane.showMessageDialog( main.frame, "info", "Robottino v4.1 - Informazioni", JOptionPane.INFORMATION_MESSAGE );
59 else if ( e.getSource() == nuovo ) {
60 String nome = JOptionPane.showInputDialog( main.frame, "Inserire il nome del nuovo robottino:", "Robot " + ( ++main.robots ) );
61 if ( nome != null )
62 main.list.newRobot( nome );
63 }
64 }
65 }
66} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/List.java b/robottino/all_versions/v4.1/src/List.java
new file mode 100755
index 0000000..13a8ab6
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/List.java
@@ -0,0 +1,74 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JOptionPane;
23
24public class List {
25 public static Main main = new Main();
26 public Robot primoRobot, ultimoRobot;
27 public List() {
28 primoRobot = ultimoRobot = null;
29 }
30 public boolean vuota() {
31 return primoRobot == null;
32 }
33 public Robot getRobot( String nome ) {
34 Robot i = primoRobot;
35 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
36 return i;
37 }
38 public void newRobot() {
39 newRobot( false, false, false, false, "" );
40 }
41 public void newRobot( String nome ) {
42 newRobot( false, false, false, false, nome );
43 }
44 public void newRobot( boolean la, boolean ra, boolean ll, boolean rl, String nome ) {
45 if ( vuota() )
46 primoRobot = ultimoRobot = new Robot( la, ra, ll, rl, nome, null, null );
47 else {
48 ultimoRobot = new Robot( la, ra, ll, rl, nome, ultimoRobot, null );
49 ultimoRobot.precedenteRobot.prossimoRobot = ultimoRobot;
50 }
51 }
52 public void deleteRobot( String nome ) {
53 if ( vuota() )
54 JOptionPane.showMessageDialog( main.frame, "Nessun robottino presente. Impossibile cancellarne uno", "Robottino v4.1 - Errore", JOptionPane.ERROR_MESSAGE );
55 else {
56 Robot i = primoRobot;
57 for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ;
58 if ( i.precedenteRobot != null )
59 i.precedenteRobot.prossimoRobot = i.prossimoRobot;
60 else
61 primoRobot = i.prossimoRobot;
62 if ( i.prossimoRobot != null )
63 i.prossimoRobot.precedenteRobot = i.precedenteRobot;
64 else
65 ultimoRobot = i.precedenteRobot;
66 }
67 }
68 public void printList() {
69 String lista = "";
70 for ( Robot i = primoRobot; i != null; i = i.prossimoRobot )
71 lista += i.getName() + " ";
72 JOptionPane.showMessageDialog( main.frame, lista, "Robottino v4.1 - Robottini Presenti", JOptionPane.PLAIN_MESSAGE );
73 }
74} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/Main.java b/robottino/all_versions/v4.1/src/Main.java
new file mode 100755
index 0000000..4ef0206
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/Main.java
@@ -0,0 +1,36 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23
24public class Main {
25 public static int robots;
26 public static List list;
27 public static Frame frame;
28 public static void main ( String args[] ) {
29 robots = 0;
30 list = new List();
31 frame = new Frame();
32 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
33 frame.setSize( 350, 150 );
34 frame.setVisible( true );
35 }
36} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/Robot.java b/robottino/all_versions/v4.1/src/Robot.java
new file mode 100755
index 0000000..c52f29c
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/Robot.java
@@ -0,0 +1,101 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class Robot {
27 public static Main main = new Main();
28 boolean leftArm, rightArm, leftLeg, rightLeg;
29 String nomeRobot;
30 Robot precedenteRobot, prossimoRobot;
31 RobotFrame robotFrame;
32 Robot() {
33 this( false, false, false, false, "", main.list.ultimoRobot, null );
34 }
35 Robot( String nome ) {
36 this ( false, false, false, false, nome, main.list.ultimoRobot, null );
37 }
38 Robot( boolean la, boolean ra, boolean ll, boolean rl, String nome, Robot prec, Robot prox ) {
39 leftArm = la;
40 rightArm = ra;
41 leftLeg = ll;
42 rightLeg = rl;
43 nomeRobot = nome;
44 precedenteRobot = prec;
45 prossimoRobot = prox;
46 robotFrame = new RobotFrame( nome );
47 robotFrame.setSize( 350, 600 );
48 robotFrame.setVisible( true );
49 robotFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
50 robotFrame.addWindowListener(
51 new WindowAdapter() {
52 public void windowClosing( WindowEvent e ) {
53 int selezione = JOptionPane.showOptionDialog( Robot.this.robotFrame, "Eliminare il robottino " + Robot.this.getName() + " ?", "Robottino v4.1 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
54 if ( selezione == JOptionPane.YES_OPTION ) {
55 main.list.deleteRobot( Robot.this.getName() );
56 robotFrame.dispose();
57 }
58 }
59 }
60 );
61 }
62 void setLA( boolean la ) {
63 setPositions( la, this.rightArm, this.leftLeg, this.rightLeg );
64 }
65 void setRA( boolean ra ) {
66 setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg );
67 }
68 void setLL( boolean ll ) {
69 setPositions( this.leftArm, this.rightArm, ll, this.rightLeg );
70 }
71 void setRL( boolean rl ) {
72 setPositions( this.leftArm, this.rightArm, this.leftLeg, rl );
73 }
74 void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) {
75 this.leftArm = la;
76 this.rightArm = ra;
77 this.leftLeg = ll;
78 this.rightLeg = rl;
79 }
80 void setName( String nome ) {
81 nomeRobot = nome;
82 }
83 boolean getLA() {
84 return leftArm;
85 }
86 boolean getRA() {
87 return rightArm;
88 }
89 boolean getLL() {
90 return leftLeg;
91 }
92 boolean getRL() {
93 return rightLeg;
94 }
95 String getName() {
96 return nomeRobot;
97 }
98 Robot getNext() {
99 return prossimoRobot;
100 }
101} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/RobotFrame.java b/robottino/all_versions/v4.1/src/RobotFrame.java
new file mode 100755
index 0000000..c8cbf13
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/RobotFrame.java
@@ -0,0 +1,312 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class RobotFrame extends JFrame implements ActionListener {
27 public static int numeroCopie, i;
28 public static Main main;
29 public static RobotPanel robotPanel;
30 public static Timer timer;
31 public static JMenuBar barraMenu;
32 public static JMenu file, modifica, azioni, info, raMenu, laMenu, rlMenu, llMenu;
33 public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem;
34 public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem;
35 public static JMenuItem rinomina, elimina, duplica, birra, balla, esplodi, informazioni;
36 RobotFrame( String titolo ) {
37 super ( titolo );
38 numeroCopie = 0;
39 robotPanel = new RobotPanel( titolo );
40 rinomina = new JMenuItem( "Cambia nome" );
41 elimina = new JMenuItem( "Elimina" );
42 duplica = new JMenuItem( "Duplica robot" );
43 birra = new JMenuItem( "Birra" );
44 balla = new JMenuItem( "Balla" );
45 esplodi = new JMenuItem( "Esplodi" );
46 informazioni = new JMenuItem( "Informazioni" );
47 raonMenuItem = new JMenuItem( "Alza" );
48 laonMenuItem = new JMenuItem( "Alza" );
49 rlonMenuItem = new JMenuItem( "Alza" );
50 llonMenuItem = new JMenuItem( "Alza" );
51 raoffMenuItem = new JMenuItem( "Abbassa" );
52 laoffMenuItem = new JMenuItem( "Abbassa" );
53 rloffMenuItem = new JMenuItem( "Abbassa" );
54 lloffMenuItem = new JMenuItem( "Abbassa" );
55 rachangeMenuItem = new JMenuItem( "Cambia posizione" );
56 lachangeMenuItem = new JMenuItem( "Cambia posizione" );
57 rlchangeMenuItem = new JMenuItem( "Cambia posizione" );
58 llchangeMenuItem = new JMenuItem( "Cambia posizione" );
59 rinomina.addActionListener( this );
60 elimina.addActionListener( this );
61 duplica.addActionListener( this );
62 birra.addActionListener( this );
63 balla.addActionListener( this );
64 esplodi.addActionListener( this );
65 informazioni.addActionListener( this );
66 raonMenuItem.addActionListener( this );
67 raoffMenuItem.addActionListener( this );
68 rachangeMenuItem.addActionListener( this );
69 laonMenuItem.addActionListener( this );
70 laoffMenuItem.addActionListener( this );
71 lachangeMenuItem.addActionListener( this );
72 rlonMenuItem.addActionListener( this );
73 rloffMenuItem.addActionListener( this );
74 rlchangeMenuItem.addActionListener( this );
75 llonMenuItem.addActionListener( this );
76 lloffMenuItem.addActionListener( this );
77 llchangeMenuItem.addActionListener( this );
78 raMenu = new JMenu( "Braccio destro" );
79 raMenu.add( raonMenuItem );
80 raMenu.add( raoffMenuItem );
81 raMenu.add( rachangeMenuItem );
82 laMenu = new JMenu( "Braccio sinistro" );
83 laMenu.add( laonMenuItem );
84 laMenu.add( laoffMenuItem );
85 laMenu.add( lachangeMenuItem );
86 rlMenu = new JMenu( "Gamba destra" );
87 rlMenu.add( rlonMenuItem );
88 rlMenu.add( rloffMenuItem );
89 rlMenu.add( rlchangeMenuItem );
90 llMenu = new JMenu( "Gamba sinistra" );
91 llMenu.add( llonMenuItem );
92 llMenu.add( lloffMenuItem );
93 llMenu.add( llchangeMenuItem );
94 modifica = new JMenu( "Modifica" );
95 modifica.add( raMenu );
96 modifica.add( laMenu );
97 modifica.add( rlMenu );
98 modifica.add( llMenu );
99 file = new JMenu( "File" );
100 file.add( rinomina );
101 file.add( duplica );
102 file.add( elimina );
103 azioni = new JMenu( "Azioni" );
104 azioni.add( birra );
105 azioni.add( balla );
106 azioni.add( esplodi );
107 info = new JMenu( "?" );
108 info.add( informazioni );
109 barraMenu = new JMenuBar();
110 barraMenu.add( file );
111 barraMenu.add( azioni );
112 barraMenu.add( modifica );
113 barraMenu.add( info );
114 setJMenuBar( barraMenu );
115 add( robotPanel );
116 }
117 public void actionPerformed( ActionEvent e ) {
118 esegui( e );
119 }
120 public void esegui( ActionEvent e ) {
121 if ( e.getSource() == raonMenuItem )
122 main.list.getRobot( this.getTitle() ).rightArm = true;
123 else if ( e.getSource() == raoffMenuItem )
124 main.list.getRobot( this.getTitle() ).rightArm = false;
125 else if ( e.getSource() == rachangeMenuItem )
126 main.list.getRobot( this.getTitle() ).rightArm = !main.list.getRobot( this.getTitle() ).rightArm;
127 else if ( e.getSource() == laonMenuItem )
128 main.list.getRobot( this.getTitle() ).leftArm = true;
129 else if ( e.getSource() == laoffMenuItem )
130 main.list.getRobot( this.getTitle() ).leftArm = false;
131 else if ( e.getSource() == lachangeMenuItem )
132 main.list.getRobot( this.getTitle() ).leftArm = !main.list.getRobot( this.getTitle() ).leftArm;
133 else if ( e.getSource() == rlonMenuItem )
134 main.list.getRobot( this.getTitle() ).rightLeg = true;
135 else if ( e.getSource() == rloffMenuItem )
136 main.list.getRobot( this.getTitle() ).rightLeg = false;
137 else if ( e.getSource() == rlchangeMenuItem )
138 main.list.getRobot( this.getTitle() ).rightLeg = !main.list.getRobot( this.getTitle() ).rightLeg;
139 else if ( e.getSource() == llonMenuItem )
140 main.list.getRobot( this.getTitle() ).leftLeg = true;
141 else if ( e.getSource() == lloffMenuItem )
142 main.list.getRobot( this.getTitle() ).leftLeg = false;
143 else if ( e.getSource() == llchangeMenuItem )
144 main.list.getRobot( this.getTitle() ).leftLeg = !main.list.getRobot( this.getTitle() ).leftLeg;
145 else if ( e.getSource() == rinomina ) {
146 String newName = JOptionPane.showInputDialog( this, "Inserire il nuovo nome per questo robot:", this.getTitle() );
147 if ( newName != null ) {
148 main.list.getRobot( this.getTitle() ).setName( newName );
149 this.setTitle( newName );
150 robotPanel.nomeRobot = newName;
151 }
152 }
153 else if ( e.getSource() == elimina ) {
154 int selezione = JOptionPane.showOptionDialog( this, "Eliminare il robottino " + this.getTitle() + " ?", "Robottino v4.1 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
155 if ( selezione == JOptionPane.YES_OPTION ) {
156 main.list.deleteRobot( this.getTitle() );
157 this.dispose();
158 }
159 }
160 else if ( e.getSource() == duplica ) {
161 String newName = JOptionPane.showInputDialog( this, "Inserire il nome per il nuovo robot:", this.getTitle() + " #" + (++numeroCopie) );
162 if ( newName != null ) {
163 main.list.newRobot( main.list.getRobot( this.getTitle() ).leftArm, main.list.getRobot( this.getTitle() ).rightArm, main.list.getRobot( this.getTitle() ).leftLeg, main.list.getRobot( this.getTitle() ).rightLeg, newName );
164 }
165 }
166 else if ( e.getSource() == birra ) {
167 ImageIcon birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra5.gif" ) );
168 JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra );
169 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra1.jpg" ) );
170 JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra );
171 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra2.jpg" ) );
172 JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra );
173 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra3.jpg" ) );
174 JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra );
175 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra4.jpg" ) );
176 JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra );
177 JOptionPane.showMessageDialog( this, "Che bevuta!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE );
178 JOptionPane.showMessageDialog( this, "Buuuuuuurp!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE );
179 robotPanel.body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
180 }
181 else if ( e.getSource() == balla ) {
182 this.i = 0;
183 main.list.getRobot( this.getTitle() ).setPositions( false, false, false, false );
184 timer = new Timer( 250,
185 new ActionListener() {
186 public void actionPerformed( ActionEvent e ) {
187 RobotFrame.this.i++;
188 switch( RobotFrame.this.i ) {
189 case 1:
190 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setRA( true );
191 break;
192 case 2:
193 break;
194 case 3:
195 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setLA( true );
196 break;
197 case 4:
198 break;
199 case 5:
200 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true );
201 break;
202 case 6:
203 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, false, false );
204 break;
205 case 7:
206 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false );
207 break;
208 case 8:
209 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, false, false );
210 break;
211 case 9:
212 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, false, false, true );
213 break;
214 case 10:
215 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false );
216 break;
217 case 11:
218 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, false, false, true );
219 break;
220 case 12:
221 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, true, true, false );
222 break;
223 case 13:
224 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false );
225 break;
226 case 14:
227 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, true, true, false );
228 break;
229 case 15:
230 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false );
231 break;
232 case 16:
233 break;
234 case 17:
235 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false );
236 break;
237 case 18:
238 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true );
239 break;
240 case 19:
241 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false );
242 break;
243 case 20:
244 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true );
245 break;
246 case 21:
247 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false );
248 break;
249 case 22:
250 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true );
251 break;
252 case 23:
253 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, true, true );
254 break;
255 case 24:
256 break;
257 case 25:
258 break;
259 case 26:
260 RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false );
261 break;
262 case 27:
263 JOptionPane.showMessageDialog( RobotFrame.this, "Cha fatica!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE );
264 JOptionPane.showMessageDialog( RobotFrame.this, RobotFrame.this.getTitle() + " è tornato alla posizione di partenza", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE );
265 break;
266 default:
267 timer.stop();
268 break;
269 }
270 RobotFrame.robotPanel.setImages();
271 RobotFrame.robotPanel.repaint();
272 RobotFrame.this.repaint();
273 }
274 }
275 );
276 timer.start();
277 }
278 if ( e.getSource() == esplodi ) {
279 String aux = this.getTitle();
280 main.list.deleteRobot( this.getTitle() );
281 this.dispose();
282 ImageIcon boom = new ImageIcon( ClassLoader.getSystemResource( "img/boom.png" ) );
283 JOptionPane.showMessageDialog( null, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, boom );
284 JOptionPane.showMessageDialog( null, aux + " si è autodistrutto!", "Robottino v4.1", JOptionPane.WARNING_MESSAGE );
285 }
286 if ( e.getSource() == informazioni ) {
287 String aux = this.getTitle() + ":\n\n";
288 if ( main.list.getRobot( RobotFrame.this.getTitle() ).rightArm )
289 aux += "Braccio destro: alzato\n";
290 else
291 aux += "Braccio destro: abbassato\n";
292 if ( main.list.getRobot( RobotFrame.this.getTitle() ).leftArm )
293 aux += "Braccio sinistro: alzato\n";
294 else
295 aux += "Braccio sinistro: abbassato\n";
296 if ( main.list.getRobot( RobotFrame.this.getTitle() ).rightLeg )
297 aux += "Gamba destra: alzata\n";
298 else
299 aux += "Gamba destra: abbassata\n";
300 if ( main.list.getRobot( RobotFrame.this.getTitle() ).leftLeg )
301 aux += "Gamba sinistra: alzata\n";
302 else
303 aux += "Gamba sinistra: abbassata\n";
304 JOptionPane.showMessageDialog( this, aux, "Robottino - v4.1", JOptionPane.INFORMATION_MESSAGE );
305 }
306 try {
307 robotPanel.setImages();
308 robotPanel.repaint();
309 repaint();
310 } catch ( NullPointerException n ) { }
311 }
312} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/RobotPanel.java b/robottino/all_versions/v4.1/src/RobotPanel.java
new file mode 100755
index 0000000..b66d90e
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/RobotPanel.java
@@ -0,0 +1,96 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.*;
24
25public class RobotPanel extends JPanel {
26 public static String nomeRobot;
27 public static Main main;
28 public static ImageIcon ra, la, rl, ll, body;
29 public static int rax, ray, lax, lay, rlx, rly, llx, lly;
30 RobotPanel( String nomeRobot ) {
31 this.nomeRobot = nomeRobot;
32 rax = 66;
33 ray = 248;
34 lax = 225;
35 lay = 242;
36 rlx = 84;
37 rly = 367;
38 llx = 148;
39 lly = 367;
40 body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
41 ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
42 la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
43 rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
44 ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
45 }
46 public void paint ( Graphics g ) {
47 super.paint( g );
48 body.paintIcon( this, g, 100, 60 );
49 ra.paintIcon( this, g, this.rax, this.ray );
50 la.paintIcon( this, g, this.lax, this.lay );
51 rl.paintIcon( this, g, this.rlx, this.rly );
52 ll.paintIcon( this, g, this.llx, this.lly );
53 }
54 public void setImages() {
55 if ( main.list.getRobot( nomeRobot ).rightArm ) {
56 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raon.gif" ) );
57 this.rax = 68;
58 this.ray = 128;
59 }
60 else {
61 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
62 this.rax = 66;
63 this.ray = 248;
64 }
65 if ( main.list.getRobot( nomeRobot ).leftArm ) {
66 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laon.gif" ) );
67 this.lax = 224;
68 this.lay = 118;
69 }
70 else {
71 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
72 this.lax = 225;
73 this.lay = 242;
74 }
75 if ( main.list.getRobot( nomeRobot ).rightLeg ) {
76 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rlon.gif" ) );
77 this.rlx = 84;
78 this.rly = 356;
79 }
80 else {
81 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
82 this.rlx = 84;
83 this.rly = 367;
84 }
85 if ( main.list.getRobot( nomeRobot ).leftLeg ) {
86 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/llon.gif" ) );
87 this.llx = 140;
88 this.lly = 363;
89 }
90 else {
91 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
92 this.llx = 148;
93 this.lly = 367;
94 }
95 }
96} \ No newline at end of file
diff --git a/robottino/all_versions/v4.1/src/img/birra1.jpg b/robottino/all_versions/v4.1/src/img/birra1.jpg
new file mode 100755
index 0000000..6cbf8a8
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/birra1.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/birra2.jpg b/robottino/all_versions/v4.1/src/img/birra2.jpg
new file mode 100755
index 0000000..3b3caae
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/birra2.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/birra3.jpg b/robottino/all_versions/v4.1/src/img/birra3.jpg
new file mode 100755
index 0000000..9bc6971
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/birra3.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/birra4.jpg b/robottino/all_versions/v4.1/src/img/birra4.jpg
new file mode 100755
index 0000000..970f2ff
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/birra4.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/birra5.gif b/robottino/all_versions/v4.1/src/img/birra5.gif
new file mode 100755
index 0000000..6318d90
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/birra5.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/boom.png b/robottino/all_versions/v4.1/src/img/boom.png
new file mode 100755
index 0000000..59b507a
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/boom.png
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/laoff.gif b/robottino/all_versions/v4.1/src/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/laon.gif b/robottino/all_versions/v4.1/src/img/laon.gif
new file mode 100755
index 0000000..1880677
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/laon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/lloff.gif b/robottino/all_versions/v4.1/src/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/llon.gif b/robottino/all_versions/v4.1/src/img/llon.gif
new file mode 100755
index 0000000..ab1ff75
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/llon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/raoff.gif b/robottino/all_versions/v4.1/src/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/raon.gif b/robottino/all_versions/v4.1/src/img/raon.gif
new file mode 100755
index 0000000..46190a8
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/raon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/rloff.gif b/robottino/all_versions/v4.1/src/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/rlon.gif b/robottino/all_versions/v4.1/src/img/rlon.gif
new file mode 100755
index 0000000..447464b
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/rlon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.1/src/img/robot.gif b/robottino/all_versions/v4.1/src/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v4.1/src/img/robot.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/Robottino.jar b/robottino/all_versions/v4.2/Robottino.jar
new file mode 100755
index 0000000..a3dc9e7
--- /dev/null
+++ b/robottino/all_versions/v4.2/Robottino.jar
Binary files differ
diff --git a/robottino/all_versions/v4.2/license.txt b/robottino/all_versions/v4.2/license.txt
new file mode 100755
index 0000000..3912109
--- /dev/null
+++ b/robottino/all_versions/v4.2/license.txt
@@ -0,0 +1,340 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License
307 along with this program; if not, write to the Free Software
308 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
309
310
311Also add information on how to contact you by electronic and paper mail.
312
313If the program is interactive, make it output a short notice like this
314when it starts in an interactive mode:
315
316 Gnomovision version 69, Copyright (C) year name of author
317 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318 This is free software, and you are welcome to redistribute it
319 under certain conditions; type `show c' for details.
320
321The hypothetical commands `show w' and `show c' should show the appropriate
322parts of the General Public License. Of course, the commands you use may
323be called something other than `show w' and `show c'; they could even be
324mouse-clicks or menu items--whatever suits your program.
325
326You should also get your employer (if you work as a programmer) or your
327school, if any, to sign a "copyright disclaimer" for the program, if
328necessary. Here is a sample; alter the names:
329
330 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331 `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
333 <signature of Ty Coon>, 1 April 1989
334 Ty Coon, President of Vice
335
336This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General
340Public License instead of this License.
diff --git a/robottino/all_versions/v4.2/src/Frame.java b/robottino/all_versions/v4.2/src/Frame.java
new file mode 100755
index 0000000..6015c41
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/Frame.java
@@ -0,0 +1,314 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.*;
24import java.awt.event.*;
25
26public class Frame extends JFrame implements ActionListener {
27 public static int i;
28 public static Main main;
29 public static RobotPanel robotPanel;
30 public static JLabel label;
31 public static Timer timer;
32 public static JMenuBar barraMenu;
33 public static JMenu file, modifica, azioni, info, raMenu, laMenu, rlMenu, llMenu;
34 public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem;
35 public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem;
36 public static JMenuItem rinomina, birra, balla, esplodi, informazioni, esci;
37 public Frame() {
38 super( "Robottino versione 4.2" );
39 i = 0;
40 main = new Main();
41 robotPanel = new RobotPanel();
42 label = new JLabel( "Robot: " + main.robot.getName() );
43 label.setFont( new Font( "Monospace", 0, 30 ) );
44 barraMenu = new JMenuBar();
45 rinomina = new JMenuItem( "Cambia nome" );
46 birra = new JMenuItem( "Birra" );
47 balla = new JMenuItem( "Balla" );
48 esplodi = new JMenuItem( "Esplodi" );
49 informazioni = new JMenuItem( "Informazioni" );
50 esci = new JMenuItem( "Esci" );
51 raonMenuItem = new JMenuItem( "Alza" );
52 laonMenuItem = new JMenuItem( "Alza" );
53 rlonMenuItem = new JMenuItem( "Alza" );
54 llonMenuItem = new JMenuItem( "Alza" );
55 raoffMenuItem = new JMenuItem( "Abbassa" );
56 laoffMenuItem = new JMenuItem( "Abbassa" );
57 rloffMenuItem = new JMenuItem( "Abbassa" );
58 lloffMenuItem = new JMenuItem( "Abbassa" );
59 rachangeMenuItem = new JMenuItem( "Cambia posizione" );
60 lachangeMenuItem = new JMenuItem( "Cambia posizione" );
61 rlchangeMenuItem = new JMenuItem( "Cambia posizione" );
62 llchangeMenuItem = new JMenuItem( "Cambia posizione" );
63 esci.addActionListener( this );
64 rinomina.addActionListener( this );
65 birra.addActionListener( this );
66 balla.addActionListener( this );
67 esplodi.addActionListener( this );
68 informazioni.addActionListener( this );
69 raonMenuItem.addActionListener( this );
70 raoffMenuItem.addActionListener( this );
71 rachangeMenuItem.addActionListener( this );
72 laonMenuItem.addActionListener( this );
73 laoffMenuItem.addActionListener( this );
74 lachangeMenuItem.addActionListener( this );
75 rlonMenuItem.addActionListener( this );
76 rloffMenuItem.addActionListener( this );
77 rlchangeMenuItem.addActionListener( this );
78 llonMenuItem.addActionListener( this );
79 lloffMenuItem.addActionListener( this );
80 llchangeMenuItem.addActionListener( this );
81 raMenu = new JMenu( "Braccio destro" );
82 raMenu.add( raonMenuItem );
83 raMenu.add( raoffMenuItem );
84 raMenu.add( rachangeMenuItem );
85 laMenu = new JMenu( "Braccio sinistro" );
86 laMenu.add( laonMenuItem );
87 laMenu.add( laoffMenuItem );
88 laMenu.add( lachangeMenuItem );
89 rlMenu = new JMenu( "Gamba destra" );
90 rlMenu.add( rlonMenuItem );
91 rlMenu.add( rloffMenuItem );
92 rlMenu.add( rlchangeMenuItem );
93 llMenu = new JMenu( "Gamba sinistra" );
94 llMenu.add( llonMenuItem );
95 llMenu.add( lloffMenuItem );
96 llMenu.add( llchangeMenuItem );
97 modifica = new JMenu( "Modifica" );
98 modifica.add( raMenu );
99 modifica.add( laMenu );
100 modifica.add( rlMenu );
101 modifica.add( llMenu );
102 file = new JMenu( "File" );
103 file.add( rinomina );
104 file.add( esci );
105 azioni = new JMenu( "Azioni" );
106 azioni.add( birra );
107 azioni.add( balla );
108 azioni.add( esplodi );
109 info = new JMenu( "?" );
110 info.add( informazioni );
111 barraMenu.add( file );
112 barraMenu.add( modifica );
113 barraMenu.add( azioni );
114 barraMenu.add( info );
115 setJMenuBar( barraMenu );
116 add( robotPanel, BorderLayout.CENTER );
117 add( label, BorderLayout.SOUTH );
118 addWindowListener(
119 new WindowAdapter() {
120 public void windowClosing( WindowEvent e ) {
121 int selezione = JOptionPane.showOptionDialog( Frame.this, "Vuoi davvero uscire?", "Robottino v4.2", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
122 if ( selezione == JOptionPane.YES_OPTION )
123 System.exit( 0 );
124 }
125 }
126 );
127 }
128 public void actionPerformed( ActionEvent e ) {
129 if ( e.getSource() == esci ) {
130 int selezione = JOptionPane.showOptionDialog( this, "Vuoi davvero uscire?", "Robottino v4.2", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
131 if ( selezione == JOptionPane.YES_OPTION )
132 System.exit( 0 );
133 }
134 else if ( e.getSource() == rinomina ) {
135 String newName = main.robot.getName();
136 newName = JOptionPane.showInputDialog( this, "Inserire il nuovo nome per il robottino:", newName );
137 if ( newName != null ) {
138 main.robot.setName( newName );
139 label .setText( "Robot: " + main.robot.getName() );
140 }
141 }
142 else if ( e.getSource() == raonMenuItem )
143 main.robot.setRA( true );
144 else if ( e.getSource() == raoffMenuItem )
145 main.robot.setRA( false );
146 else if ( e.getSource() == rachangeMenuItem )
147 main.robot.setRA( !main.robot.rightArm );
148 else if ( e.getSource() == laonMenuItem )
149 main.robot.setLA( true );
150 else if ( e.getSource() == laoffMenuItem )
151 main.robot.setLA( false );
152 else if ( e.getSource() == lachangeMenuItem )
153 main.robot.setLA( !main.robot.leftArm );
154 else if ( e.getSource() == rlonMenuItem )
155 main.robot.setRL( true );
156 else if ( e.getSource() == rloffMenuItem )
157 main.robot.setRL( false );
158 else if ( e.getSource() == rlchangeMenuItem )
159 main.robot.setRL( !main.robot.rightLeg );
160 else if ( e.getSource() == llonMenuItem )
161 main.robot.setLL( true );
162 else if ( e.getSource() == lloffMenuItem )
163 main.robot.setLL( false );
164 else if ( e.getSource() == llchangeMenuItem )
165 main.robot.setLL( !main.robot.leftLeg );
166 else if ( e.getSource() == birra ) {
167 ImageIcon birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra5.gif" ) );
168 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, birra );
169 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra1.jpg" ) );
170 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, birra );
171 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra2.jpg" ) );
172 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, birra );
173 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra3.jpg" ) );
174 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, birra );
175 birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra4.jpg" ) );
176 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, birra );
177 JOptionPane.showMessageDialog( this, "Che bevuta!", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE );
178 JOptionPane.showMessageDialog( this, "Buuuuuuurp!", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE );
179 robotPanel.body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
180 }
181 if ( e.getSource() == esplodi ) {
182 String aux = main.robot.getName();
183 main.robot.setPositions( false, false, false, false );
184 main.robot.setName( "no-name" );
185 label.setText( "Robot: " + main.robot.getName() );
186 ImageIcon boom = new ImageIcon( ClassLoader.getSystemResource( "img/boom.png" ) );
187 JOptionPane.showMessageDialog( this, "", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE, boom );
188 JOptionPane.showMessageDialog( this, aux + " si è autodistrutto!", "Robottino v4.2", JOptionPane.WARNING_MESSAGE );
189 JOptionPane.showMessageDialog( this, "È stato creato un nuovo robottino: " + main.robot.getName(), "Robottino v4.2", JOptionPane.INFORMATION_MESSAGE );
190 }
191 if ( e.getSource() == informazioni ) {
192 String aux = main.robot.getName() + ":\n\n";
193 if ( main.robot.rightArm )
194 aux += "Braccio destro: alzato\n";
195 else
196 aux += "Braccio destro: abbassato\n";
197 if ( main.robot.leftArm )
198 aux += "Braccio sinistro: alzato\n";
199 else
200 aux += "Braccio sinistro: abbassato\n";
201 if ( main.robot.rightLeg )
202 aux += "Gamba destra: alzata\n";
203 else
204 aux += "Gamba destra: abbassata\n";
205 if ( main.robot.leftLeg )
206 aux += "Gamba sinistra: alzata\n";
207 else
208 aux += "Gamba sinistra: abbassata\n";
209 JOptionPane.showMessageDialog( this, aux, "Robottino - v4.2", JOptionPane.INFORMATION_MESSAGE );
210 }
211 else if ( e.getSource() == balla ) {
212 this.i = 0;
213 main.robot.setPositions( false, false, false, false );
214 timer = new Timer( 250,
215 new ActionListener() {
216 public void actionPerformed( ActionEvent e ) {
217 Frame.this.i++;
218 switch( Frame.this.i ) {
219 case 1:
220 Frame.main.robot.setRA( true );
221 break;
222 case 2:
223 break;
224 case 3:
225 Frame.main.robot.setLA( true );
226 break;
227 case 4:
228 break;
229 case 5:
230 Frame.main.robot.setPositions( false, false, false, true );
231 break;
232 case 6:
233 Frame.main.robot.setPositions( true, true, false, false );
234 break;
235 case 7:
236 Frame.main.robot.setPositions( false, false, true, false );
237 break;
238 case 8:
239 Frame.main.robot.setPositions( true, true, false, false );
240 break;
241 case 9:
242 Frame.main.robot.setPositions( true, false, false, true );
243 break;
244 case 10:
245 Frame.main.robot.setPositions( false, false, false, false );
246 break;
247 case 11:
248 Frame.main.robot.setPositions( true, false, false, true );
249 break;
250 case 12:
251 Frame.main.robot.setPositions( false, true, true, false );
252 break;
253 case 13:
254 Frame.main.robot.setPositions( false, false, false, false );
255 break;
256 case 14:
257 Frame.main.robot.setPositions( false, true, true, false );
258 break;
259 case 15:
260 Frame.main.robot.setPositions( false, false, false, false );
261 break;
262 case 16:
263 break;
264 case 17:
265 Frame.main.robot.setPositions( false, false, true, false );
266 break;
267 case 18:
268 Frame.main.robot.setPositions( false, false, false, true );
269 break;
270 case 19:
271 Frame.main.robot.setPositions( false, false, true, false );
272 break;
273 case 20:
274 Frame.main.robot.setPositions( false, false, false, true );
275 break;
276 case 21:
277 Frame.main.robot.setPositions( false, false, true, false );
278 break;
279 case 22:
280 Frame.main.robot.setPositions( false, false, false, true );
281 break;
282 case 23:
283 Frame.main.robot.setPositions( true, true, true, true );
284 break;
285 case 24:
286 break;
287 case 25:
288 break;
289 case 26:
290 Frame.main.robot.setPositions( false, false, false, false );
291 break;
292 case 27:
293 JOptionPane.showMessageDialog( Frame.this, "Cha fatica!", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE );
294 JOptionPane.showMessageDialog( Frame.this, Frame.main.robot.getName() + " è tornato alla posizione di partenza", "Robottino v4.2", JOptionPane.PLAIN_MESSAGE );
295 break;
296 default:
297 timer.stop();
298 break;
299 }
300 Frame.this.robotPanel.setImages();
301 Frame.this.robotPanel.repaint();
302 Frame.this.repaint();
303 }
304 }
305 );
306 timer.start();
307 }
308 try {
309 this.robotPanel.setImages();
310 this.robotPanel.repaint();
311 this.repaint();
312 } catch ( NullPointerException n ) { }
313 }
314} \ No newline at end of file
diff --git a/robottino/all_versions/v4.2/src/Main.java b/robottino/all_versions/v4.2/src/Main.java
new file mode 100755
index 0000000..61eecc4
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/Main.java
@@ -0,0 +1,34 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.JFrame;
23
24public class Main {
25 public static Robot robot;
26 public static Frame frame;
27 public static void main ( String args[] ) {
28 robot = new Robot( "no-name" );
29 frame = new Frame();
30 frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
31 frame.setSize( 350, 600 );
32 frame.setVisible( true );
33 }
34} \ No newline at end of file
diff --git a/robottino/all_versions/v4.2/src/Robot.java b/robottino/all_versions/v4.2/src/Robot.java
new file mode 100755
index 0000000..378f2db
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/Robot.java
@@ -0,0 +1,72 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class Robot {
27 boolean leftArm, rightArm, leftLeg, rightLeg;
28 String nomeRobot;
29 Robot( String nome ) {
30 this.leftArm = false;
31 this.rightArm = false;
32 this.leftLeg = false;
33 this.rightLeg = false;
34 this.nomeRobot = nome;
35 }
36 void setLA( boolean la ) {
37 setPositions( la, this.rightArm, this.leftLeg, this.rightLeg );
38 }
39 void setRA( boolean ra ) {
40 setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg );
41 }
42 void setLL( boolean ll ) {
43 setPositions( this.leftArm, this.rightArm, ll, this.rightLeg );
44 }
45 void setRL( boolean rl ) {
46 setPositions( this.leftArm, this.rightArm, this.leftLeg, rl );
47 }
48 void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) {
49 this.leftArm = la;
50 this.rightArm = ra;
51 this.leftLeg = ll;
52 this.rightLeg = rl;
53 }
54 void setName( String nome ) {
55 nomeRobot = nome;
56 }
57 boolean getLA() {
58 return leftArm;
59 }
60 boolean getRA() {
61 return rightArm;
62 }
63 boolean getLL() {
64 return leftLeg;
65 }
66 boolean getRL() {
67 return rightLeg;
68 }
69 String getName() {
70 return nomeRobot;
71 }
72} \ No newline at end of file
diff --git a/robottino/all_versions/v4.2/src/RobotPanel.java b/robottino/all_versions/v4.2/src/RobotPanel.java
new file mode 100755
index 0000000..896723a
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/RobotPanel.java
@@ -0,0 +1,94 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino 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 Robottino 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 Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.*;
24
25public class RobotPanel extends JPanel {
26 public static Main main;
27 public static ImageIcon ra, la, rl, ll, body;
28 public static int rax, ray, lax, lay, rlx, rly, llx, lly;
29 RobotPanel() {
30 rax = 66;
31 ray = 248;
32 lax = 225;
33 lay = 242;
34 rlx = 84;
35 rly = 367;
36 llx = 148;
37 lly = 367;
38 body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
39 ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
40 la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
41 rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
42 ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
43 }
44 public void paint ( Graphics g ) {
45 super.paint( g );
46 body.paintIcon( this, g, 100, 60 );
47 ra.paintIcon( this, g, this.rax, this.ray );
48 la.paintIcon( this, g, this.lax, this.lay );
49 rl.paintIcon( this, g, this.rlx, this.rly );
50 ll.paintIcon( this, g, this.llx, this.lly );
51 }
52 public void setImages() {
53 if ( main.robot.rightArm ) {
54 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raon.gif" ) );
55 this.rax = 68;
56 this.ray = 128;
57 }
58 else {
59 this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
60 this.rax = 66;
61 this.ray = 248;
62 }
63 if ( main.robot.leftArm ) {
64 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laon.gif" ) );
65 this.lax = 224;
66 this.lay = 118;
67 }
68 else {
69 this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
70 this.lax = 225;
71 this.lay = 242;
72 }
73 if ( main.robot.rightLeg ) {
74 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rlon.gif" ) );
75 this.rlx = 84;
76 this.rly = 356;
77 }
78 else {
79 this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
80 this.rlx = 84;
81 this.rly = 367;
82 }
83 if ( main.robot.leftLeg ) {
84 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/llon.gif" ) );
85 this.llx = 140;
86 this.lly = 363;
87 }
88 else {
89 this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
90 this.llx = 148;
91 this.lly = 367;
92 }
93 }
94} \ No newline at end of file
diff --git a/robottino/all_versions/v4.2/src/img/birra1.jpg b/robottino/all_versions/v4.2/src/img/birra1.jpg
new file mode 100755
index 0000000..6cbf8a8
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/birra1.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/birra2.jpg b/robottino/all_versions/v4.2/src/img/birra2.jpg
new file mode 100755
index 0000000..3b3caae
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/birra2.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/birra3.jpg b/robottino/all_versions/v4.2/src/img/birra3.jpg
new file mode 100755
index 0000000..9bc6971
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/birra3.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/birra4.jpg b/robottino/all_versions/v4.2/src/img/birra4.jpg
new file mode 100755
index 0000000..970f2ff
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/birra4.jpg
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/birra5.gif b/robottino/all_versions/v4.2/src/img/birra5.gif
new file mode 100755
index 0000000..6318d90
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/birra5.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/boom.png b/robottino/all_versions/v4.2/src/img/boom.png
new file mode 100755
index 0000000..59b507a
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/boom.png
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/laoff.gif b/robottino/all_versions/v4.2/src/img/laoff.gif
new file mode 100755
index 0000000..49d9db0
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/laoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/laon.gif b/robottino/all_versions/v4.2/src/img/laon.gif
new file mode 100755
index 0000000..1880677
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/laon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/lloff.gif b/robottino/all_versions/v4.2/src/img/lloff.gif
new file mode 100755
index 0000000..3db1ceb
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/lloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/llon.gif b/robottino/all_versions/v4.2/src/img/llon.gif
new file mode 100755
index 0000000..ab1ff75
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/llon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/raoff.gif b/robottino/all_versions/v4.2/src/img/raoff.gif
new file mode 100755
index 0000000..88aabc4
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/raoff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/raon.gif b/robottino/all_versions/v4.2/src/img/raon.gif
new file mode 100755
index 0000000..46190a8
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/raon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/rloff.gif b/robottino/all_versions/v4.2/src/img/rloff.gif
new file mode 100755
index 0000000..04bda22
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/rloff.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/rlon.gif b/robottino/all_versions/v4.2/src/img/rlon.gif
new file mode 100755
index 0000000..447464b
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/rlon.gif
Binary files differ
diff --git a/robottino/all_versions/v4.2/src/img/robot.gif b/robottino/all_versions/v4.2/src/img/robot.gif
new file mode 100755
index 0000000..db87686
--- /dev/null
+++ b/robottino/all_versions/v4.2/src/img/robot.gif
Binary files differ

Generated with cgit - Back to sebastiano.tronto.net