Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Sorgente Briscola
Forum - Visual Basic 6 - Sorgente Briscola

Avatar
MeTeMpSiCoSi (Ex-Member)
Pro


Messaggi: 159
Iscritto: 14/03/2007

Segnala al moderatore
Postato alle 17:30
Domenica, 02/09/2007
Salve a tutti, vorrei sapere se qualcuno sa se esiste un source code di questo gioco. Grazie

PM Quote
Avatar
c.ronaldo (Ex-Member)
Pro


Messaggi: 121
Iscritto: 05/07/2007

Segnala al moderatore
Postato alle 21:02
Domenica, 02/09/2007
Te ne posto uno :D

frmBriscola

Codice sorgente - presumibilmente VB.NET

  1. Option Explicit
  2. Dim Card(1 To 40) As Single
  3. Dim Punti(1 To 10) As Integer
  4. Dim PuntiPlayer, PuntiComputer As Integer
  5. Dim SemeBriscola As Integer
  6. Dim CartaGiocataP, CartaGiocataC As Integer
  7. Dim UltimaCarta As Integer
  8. Dim numCarteTot As Integer
  9. Dim Dorso As String
  10. Dim SleepTime As Integer
  11. Dim Giocatore1 As String
  12. Dim EndGame As Integer
  13. Dim PuntiTot As Integer
  14. Dim StatisticFile As String
  15. Dim CartaPlayer(1 To 3) As Giocatore
  16. Dim CartaComputer(1 To 3) As Giocatore
  17. Dim CartaMazzo(1 To 40) As Giocatore
  18. Dim CartaTavolo(1 To 2) As Giocatore
  19. Private Sub Form_Load()
  20.   Dim num, sm, i As Integer
  21.  
  22.   'nome del file delle statistiche
  23.   StatisticFile = IIf(Right(App.Path, 1) = "\", App.Path & "Statistic.log", App.Path & "\Statistic.log")
  24.  
  25.   'se il file delle statistiche non esiste lo creo azzerando tutto
  26.   If (Dir(StatisticFile) = "") Then
  27.     Open StatisticFile For Output As #1
  28.       Print #1, 0
  29.       Print #1, 0
  30.       Print #1, 0
  31.     Close 1
  32.   End If
  33.  
  34.   'tempo (sec) in cui le carte stanno in tavola
  35.   SleepTime = 2
  36.  
  37.   'tipo di carte standard (nome della directory dove ci sono i file bmp con le carte)
  38.   TipoMazzo = "Default"
  39.  
  40.   'tipo di dorso delle carte (dalla directory "Dorsi")
  41.   TipoDorso = "Dorso_05.bmp"
  42.  
  43.   'assegnazione dei punteggi ad ogni carta
  44.   For num = 1 To 10
  45.     Punti(num) = Choose(num, 11, 0, 10, 0, 0, 0, 0, 2, 3, 4)
  46.     PuntiTot = PuntiTot + 4 * Punti(num)
  47.   Next num
  48.  
  49.   'costruisco il mazzo di carte
  50.   For num = 1 To 10
  51.     For sm = 1 To 4
  52.         i = i + 1
  53.         Card(i) = num + (sm / 10)
  54.     Next sm
  55.   Next num
  56.  
  57.   'giocatore che puo' fare la prima mossa (Player)
  58.   Giocatore1 = "P"
  59.  
  60.   'scozzo il mazzo di carte
  61.   Scozza
  62. End Sub
  63. Public Sub Scozza()
  64.   Dim appoggio As String
  65.   Dim i, nm, conta(0 To 40) As Integer
  66.  
  67.   'azzero la fine del gioco (quando viene finita la partita e iniziata un'altra
  68.   EndGame = 0
  69.  
  70.   'azzero i punteggi e li visualizzo
  71.   PuntiPlayer = 0
  72.   PuntiComputer = 0
  73.   lblPlayer.Caption = PuntiPlayer
  74.   lblComputer.Caption = PuntiComputer
  75.  
  76.   'pulisco il tavolo
  77.   imgTable(1).Picture = LoadPicture("")
  78.   imgTable(2).Picture = LoadPicture("")
  79.   imgTable(1).BorderStyle = 0
  80.   imgTable(2).BorderStyle = 0
  81.  
  82.   'cancello la linea sopra il seme
  83.   Line1.Visible = False
  84.  
  85.   'scelgo l'ordine delle carte
  86.   Randomize Timer
  87.   For i = 1 To 40
  88.     Do
  89.       If conta(nm) = 0 Then conta(nm) = 1
  90.       nm = Int(Rnd * 40) + 1
  91.     Loop Until conta(nm) = 0
  92.     CartaMazzo(i).Carta = Fix(Card(nm))
  93.     CartaMazzo(i).Seme = (Card(nm) - Fix(Card(nm))) * 10
  94.     appoggio = Format(Fix(Card(nm)), "00") & " " & IntToStrSeme(CartaMazzo(i).Seme)
  95.     CartaMazzo(i).FileCard = App.Path & IIf(Right(App.Path, 1) = "\", "Mazzi\" & TipoMazzo & "\" & appoggio, "\Mazzi\" & TipoMazzo & "\" & appoggio)
  96.   Next i
  97.  
  98.   'percorso dell'immagine col dorso delle carte
  99.   Dorso = App.Path & IIf(Right(App.Path, 1) = "\", "Dorsi\" & TipoDorso, "\Dorsi\" & TipoDorso)
  100.  
  101.   'inizializzazione seme briscola e mazzo
  102.   SemeBriscola = CartaMazzo(40).Seme
  103.   imgSeme.Picture = LoadPicture(CartaMazzo(40).FileCard)
  104.   imgSeme.BorderStyle = 1
  105.   imgMazzo.Picture = LoadPicture(Dorso)
  106.   imgMazzo.BorderStyle = 1
  107.  
  108.   'aggiorno il numero di carte rimaste
  109.   numCarteTot = 34
  110.   lblNumeroCarte.Visible = True
  111.   lblNumeroCarte.Caption = numCarteTot & " cards"
  112.  
  113.   'richiamo la funzione per dare le carte
  114.   UltimaCarta = 1
  115.   Call GiveCards(3)
  116. End Sub
  117. Public Sub GiveCards(numCarte As Integer)
  118.   Dim i, numCarta, from1, to1, from2, to2 As Integer
  119.   numCarta = 0
  120.   If Giocatore1 = "C" Then
  121.     from1 = UltimaCarta
  122.     to1 = UltimaCarta + numCarte - 1
  123.     from2 = UltimaCarta + numCarte
  124.     to2 = UltimaCarta + 2 * numCarte - 1
  125.   End If
  126.   If Giocatore1 = "P" Then
  127.     from1 = UltimaCarta + numCarte
  128.     to1 = UltimaCarta + 2 * numCarte - 1
  129.     from2 = UltimaCarta
  130.     to2 = UltimaCarta + numCarte - 1
  131.   End If
  132.   For i = from1 To to1
  133.     numCarta = numCarta + 1
  134.     If (numCarte = 1) Then numCarta = CartaGiocataC
  135.     CartaComputer(numCarta) = CartaMazzo(i)
  136.     If mnuUnshroundGame.Checked Then
  137.       imgComputer(numCarta).Picture = LoadPicture(CartaComputer(numCarta).FileCard)
  138.     Else
  139.       imgComputer(numCarta).Picture = LoadPicture(Dorso)
  140.     End If
  141.     imgComputer(numCarta).BorderStyle = 1
  142.   Next i
  143.   numCarta = 0
  144.   For i = from2 To to2
  145.     numCarta = numCarta + 1
  146.     If (numCarte = 1) Then numCarta = CartaGiocataP
  147.     CartaPlayer(numCarta) = CartaMazzo(i)
  148.     imgPlayer(numCarta).Picture = LoadPicture(CartaPlayer(numCarta).FileCard)
  149.     imgPlayer(numCarta).BorderStyle = 1
  150.   Next i
  151.   UltimaCarta = UltimaCarta + 2 * numCarte
  152.   If (Giocatore1 = "C") Then GiocaPC
  153. End Sub
  154. Private Function IntToStrSeme(i As Integer)
  155.     'funzione che restituisce il seme come stringa a partire da un intero
  156.     Select Case i
  157.       Case 1: IntToStrSeme = "cuori.bmp"
  158.       Case 2: IntToStrSeme = "quadri.bmp"
  159.       Case 3: IntToStrSeme = "picche.bmp"
  160.       Case 4: IntToStrSeme = "fiori.bmp"
  161.     End Select
  162. End Function
  163. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  164.   'menu on-the-fly
  165.   If Button = 2 Then PopupMenu mnuGame, 0
  166. End Sub
  167. Private Sub imgComputer_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  168.   'menu on-the-fly
  169.   If Button = 2 Then PopupMenu mnuGame, 0
  170. End Sub
  171. Private Sub imgMazzo_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  172.   'menu on-the-fly
  173.   If Button = 2 Then PopupMenu mnuGame, 0
  174. End Sub
  175. Private Sub imgPlayer_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  176.   'menu on-the-fly
  177.   If Button = 2 Then PopupMenu mnuGame, 0
  178. End Sub
  179. Private Sub imgSeme_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  180.   'menu on-the-fly
  181.   If Button = 2 Then PopupMenu mnuGame, 0
  182. End Sub
  183. Private Sub imgTable_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  184.   'menu on-the-fly
  185.   If Button = 2 Then PopupMenu mnuGame, 0
  186. End Sub
  187. Private Sub lblNumeroCarte_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  188.   'menu on-the-fly
  189.   If Button = 2 Then PopupMenu mnuGame, 0
  190. End Sub
  191. Private Sub imgPlayer_DblClick(Index As Integer)
  192.   If ((Giocatore1 = "P" Or (Giocatore1 = "C" And imgTable(2).BorderStyle = 0)) And (EndGame <> 3 And imgPlayer(Index).BorderStyle <> 0)) Then
  193.     imgTable(2).Picture = LoadPicture(CartaPlayer(Index).FileCard)
  194.     imgTable(2).BorderStyle = 1
  195.     imgPlayer(Index).Picture = LoadPicture("")
  196.     imgPlayer(Index).BorderStyle = 0
  197.     CartaTavolo(2).Carta = CartaPlayer(Index).Carta
  198.     CartaTavolo(2).Seme = CartaPlayer(Index).Seme
  199.     CartaTavolo(2).FileCard = CartaPlayer(Index).FileCard
  200.     CartaGiocataP = Index
  201.     If (CartaTavolo(1).FileCard = "") Then
  202.       GiocaPC
  203.     Else
  204.       If Giocatore1 = "P" Then
  205.         PulisciTavolo (Vincitore(CartaTavolo(2), CartaTavolo(1)))
  206.       Else
  207.         PulisciTavolo (Vincitore(CartaTavolo(1), CartaTavolo(2)))
  208.       End If
  209.     End If
  210.   Else
  211.       Exit Sub
  212.   End If
  213. End Sub
  214. Public Sub GiocaPC()
  215.   Dim CartaSceltaG As Giocatore
  216.   Dim X, CartaScelta As Integer
  217.   If Giocatore1 = "P" Then
  218.     CartaSceltaG = ScegliCarta1(CartaComputer())
  219.   Else
  220.     CartaSceltaG = ScegliCarta2(CartaComputer())
  221.   End If
  222.   For X = 1 To 3
  223.      If (CartaComputer(X).FileCard = CartaSceltaG.FileCard) Then
  224.        CartaScelta = X
  225.        Exit For
  226.      End If
  227.   Next X
  228.   imgTable(1).Picture = LoadPicture(CartaComputer(CartaScelta).FileCard)
  229.   imgTable(1).BorderStyle = 1
  230.   imgComputer(CartaScelta).Picture = LoadPicture("")
  231.   imgComputer(CartaScelta).BorderStyle = 0
  232.   CartaTavolo(1).Carta = CartaComputer(CartaScelta).Carta
  233.   CartaTavolo(1).Seme = CartaComputer(CartaScelta).Seme
  234.   CartaTavolo(1).FileCard = CartaComputer(CartaScelta).FileCard
  235.   CartaGiocataC = CartaScelta
  236.   If (CartaTavolo(1).FileCard <> "" And CartaTavolo(2).FileCard <> "") Then
  237.     If Giocatore1 = "P" Then
  238.         PulisciTavolo (Vincitore(CartaTavolo(2), CartaTavolo(1)))
  239.     Else
  240.         PulisciTavolo (Vincitore(CartaTavolo(1), CartaTavolo(2)))
  241.     End If
  242.   End If
  243. End Sub
  244. Private Function ScegliCarta1(C() As Giocatore) As Giocatore
  245.   'funzione che serve per determinare che carta deve giocare il Computer quando
  246.   'il PC deve rispondere ad una carta giocata dal Player
  247.   Dim appoggio(1 To 3) As Giocatore
  248.   Dim CartaBriscola(1 To 3) As Giocatore
  249.   Dim CartaBriscolaC(1 To 3) As Giocatore
  250.   Dim CartaBriscolaNC(1 To 3) As Giocatore
  251.   Dim CartaNoBriscola(1 To 3) As Giocatore
  252.   Dim CartaNoBriscolaC(1 To 3) As Giocatore
  253.   Dim CartaNoBriscolaNC(1 To 3) As Giocatore
  254.   Dim CartaVBriscola(1 To 3) As Giocatore
  255.   Dim CartaVBriscolaC(1 To 3) As Giocatore
  256.   Dim CartaVBriscolaNC(1 To 3) As Giocatore
  257.   Dim CartaVNoBriscola(1 To 3) As Giocatore
  258.   Dim CartaVNoBriscolaC(1 To 3) As Giocatore
  259.   Dim CartaVNoBriscolaNC(1 To 3) As Giocatore
  260.   Dim CartaVincente(1 To 3) As Giocatore
  261.   Dim CartaNVincente(1 To 3) As Giocatore
  262.   Dim CartaNVBriscola(1 To 3) As Giocatore
  263.   Dim CartaNVBriscolaC(1 To 3) As Giocatore
  264.   Dim CartaNVBriscolaNC(1 To 3) As Giocatore
  265.   Dim CartaNVNoBriscola(1 To 3) As Giocatore
  266.   Dim CartaNVNoBriscolaC(1 To 3) As Giocatore
  267.   Dim CartaNVNoBriscolaNC(1 To 3) As Giocatore
  268.   Dim X, CarteOk As Integer
  269.   Dim numBriscole, numBriscoleC, numBriscoleNC As Integer
  270.   Dim numNoBriscole, numNoBriscoleC, numNoBriscoleNC As Integer
  271.   Dim numCarteVincenti As Integer
  272.   Dim numVBriscole, numVBriscoleC, numVBriscoleNC As Integer
  273.   Dim numVNoBriscole, numVNoBriscoleC, numVNoBriscoleNC As Integer
  274.   Dim numCarteNVincenti As Integer
  275.   Dim numNVBriscole, numNVBriscoleC, numNVBriscoleNC As Integer
  276.   Dim numNVNoBriscole, numNVNoBriscoleC, numNVNoBriscoleNC As Integer
  277.   Dim Vincente As Boolean
  278.  
  279.   'controllo le carte disponibili del Computer
  280.   For X = 1 To 3
  281.      If (C(X).Carta <> 0) Then
  282.        CarteOk = CarteOk + 1
  283.        appoggio(CarteOk) = C(X)
  284.      End If
  285.   Next X
  286.  
  287.   'controllo i tipi di carte che ha il Computer
  288.   For X = 1 To CarteOk
  289.      'controllo quali carte il computer ha per vincere la mano e le memorizzo
  290.      Vincente = False
  291.      If Vincitore(CartaTavolo(2), appoggio(X)) = "C2" Then
  292.        numCarteVincenti = numCarteVincenti + 1
  293.        CartaVincente(numCarteVincenti) = appoggio(X)
  294.        Vincente = True
  295.      Else
  296.        numCarteNVincenti = numCarteNVincenti + 1
  297.        CartaNVincente(numCarteNVincenti) = appoggio(X)
  298.        Vincente = False
  299.      End If
  300.      'controllo le carte di briscola e non, carichi o non, e li memorizzo
  301.      If (appoggio(X).Seme = SemeBriscola) Then
  302.        If (Punti(appoggio(X).Carta) >= 10) Then
  303.          numBriscoleC = numBriscoleC + 1
  304.          CartaBriscolaC(numBriscoleC) = appoggio(X)
  305.          If (Vincente) Then
  306.            numVBriscoleC = numVBriscoleC + 1
  307.            CartaVBriscolaC(numVBriscoleC) = appoggio(X)
  308.          Else
  309.            numNVBriscoleC = numNVBriscoleC + 1
  310.            CartaNVBriscolaC(numNVBriscoleC) = appoggio(X)
  311.          End If
  312.        Else
  313.          numBriscoleNC = numBriscoleNC + 1
  314.          CartaBriscolaNC(numBriscoleNC) = appoggio(X)
  315.          If (Vincente) Then
  316.            numVBriscoleNC = numVBriscoleNC + 1
  317.            CartaVBriscolaNC(numVBriscoleNC) = appoggio(X)
  318.          Else
  319.            numNVBriscoleNC = numNVBriscoleNC + 1
  320.            CartaNVBriscolaNC(numNVBriscoleNC) = appoggio(X)
  321.          End If
  322.        End If
  323.        numBriscole = numBriscole + 1
  324.        CartaBriscola(numBriscole) = appoggio(X)
  325.        If (Vincente) Then
  326.          numVBriscole = numVBriscole + 1
  327.          CartaVBriscola(numVBriscole) = appoggio(X)
  328.        Else
  329.          numNVBriscole = numNVBriscole + 1
  330.          CartaNVBriscola(numNVBriscole) = appoggio(X)
  331.        End If
  332.      Else
  333.        If (Punti(appoggio(X).Carta) >= 10) Then
  334.          numNoBriscoleC = numNoBriscoleC + 1
  335.          CartaNoBriscolaC(numNoBriscoleC) = appoggio(X)
  336.          If (Vincente) Then
  337.            numVNoBriscoleC = numVNoBriscoleC + 1
  338.            CartaVNoBriscolaC(numVNoBriscoleC) = appoggio(X)
  339.          Else
  340.            numNVNoBriscoleC = numNVNoBriscoleC + 1
  341.            CartaNVNoBriscolaC(numNVNoBriscoleC) = appoggio(X)
  342.          End If
  343.        Else
  344.          numNoBriscoleNC = numNoBriscoleNC + 1
  345.          CartaNoBriscolaNC(numNoBriscoleNC) = appoggio(X)
  346.          If (Vincente) Then
  347.            numVNoBriscoleNC = numVNoBriscoleNC + 1
  348.            CartaVNoBriscolaNC(numVNoBriscoleNC) = appoggio(X)
  349.          Else
  350.            numNVNoBriscoleNC = numNVNoBriscoleNC + 1
  351.            CartaNVNoBriscolaNC(numNVNoBriscoleNC) = appoggio(X)
  352.          End If
  353.        End If
  354.        numNoBriscole = numNoBriscole + 1
  355.        CartaNoBriscola(numNoBriscole) = appoggio(X)
  356.        If (Vincente) Then
  357.          numVNoBriscole = numVNoBriscole + 1
  358.          CartaVNoBriscola(numVNoBriscole) = appoggio(X)
  359.        Else
  360.          numNVNoBriscole = numNVNoBriscole + 1
  361.          CartaNVNoBriscola(numNVNoBriscole) = appoggio(X)
  362.        End If
  363.      End If
  364.   Next X
  365.  
  366.   'se il Computer ha solo una carta butta quella
  367.   If (CarteOk = 1) Then
  368.     ScegliCarta1 = appoggio(1)
  369.     Exit Function
  370.   'se il Computer ha 2 carte.........
  371.   ElseIf (CarteOk = 2) Then
  372.     'se il Computer ha 1 o 2 carte vincenti......
  373.     If (numCarteVincenti <> 0) Then
  374.       If (numCarteVincenti = 1) Then
  375.         If (numVBriscole = 1 And Punti(CartaTavolo(2).Carta) = 0) Then
  376.           If (Punti(CartaPiuBassa(CartaNVincente).Carta) >= 10) Then
  377.             ScegliCarta1 = CartaVincente(1)
  378.           Else
  379.             ScegliCarta1 = CartaPiuBassa(CartaNVincente)
  380.           End If
  381.         Else
  382.           ScegliCarta1 = CartaVincente(1)
  383.         End If
  384.       End If
  385.       If (numCarteVincenti = 2) Then
  386.         If (numVBriscole = 2 And numVNoBriscole = 0) Then
  387.           If (Punti(CartaTavolo(2).Carta) = 0) Then
  388.             If (Punti(CartaPiuBassa(CartaNVincente()).Carta) >= 10) Then
  389.               ScegliCarta1 = CartaPiuBassa(CartaVBriscola())
  390.             Else
  391.               ScegliCarta1 = CartaPiuBassa(CartaNVincente())
  392.             End If
  393.           Else
  394.             ScegliCarta1 = CartaPiuBassa(CartaVBriscola())
  395.           End If
  396.         End If
  397.         If (numVBriscole = 0 And numVNoBriscole = 2) Then ScegliCarta1 = CartaPiuBassa(CartaVNoBriscola())
  398.         If (numVBriscole = 1 And numVNoBriscole = 1) Then
  399.           If (numVNoBriscoleC = 1 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaVNoBriscolaC(1)
  400.           If (numVNoBriscoleNC = 1 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaVNoBriscolaNC(1)
  401.         End If
  402.       End If
  403.     'dato che il PC non ha una carta per vincere la mano, cerca di buttare la carta
  404.     'di punteggio più basso (possibilmente non briscola)
  405.     Else
  406.       If (numBriscole = 0 And numNoBriscole = 2) Then ScegliCarta1 = CartaPiuBassa(CartaNoBriscola())
  407.       If (numBriscole = 2 And numNoBriscole = 0) Then ScegliCarta1 = CartaPiuBassa(CartaBriscola())
  408.       If (numBriscole = 1 And numNoBriscole = 1) Then
  409.         If (numBriscoleC = 1 And numNoBriscoleC = 1) Then ScegliCarta1 = CartaNoBriscolaC(1)
  410.         If (numNoBriscoleNC = 1 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta1 = CartaNoBriscolaNC(1)
  411.         If (numBriscoleNC = 1 And numNoBriscoleC = 1) Then ScegliCarta1 = CartaBriscolaNC(1)
  412.       End If
  413.     End If
  414.     Exit Function
  415.   'se il Computer ha 3 carte.........
  416.   Else
  417.     'se il Computer ha una o più carte vincenti......
  418.     If (numCarteVincenti <> 0) Then
  419.       If (numCarteVincenti = 1) Then
  420.         If (numVBriscole = 1 And Punti(CartaTavolo(2).Carta) = 0) Then
  421.           If (Punti(CartaPiuBassa(CartaNVincente).Carta) >= 10) Then
  422.             ScegliCarta1 = CartaVincente(1)
  423.           Else
  424.             ScegliCarta1 = CartaPiuBassa(CartaNVincente)
  425.           End If
  426.         Else
  427.           ScegliCarta1 = CartaVincente(1)
  428.         End If
  429.       End If
  430.       If (numCarteVincenti = 2) Then
  431.         If (numVBriscole = 2 And numVNoBriscole = 0) Then
  432.           If (Punti(CartaTavolo(2).Carta) = 0) Then
  433.             If (Punti(CartaPiuBassa(CartaNVincente()).Carta) >= 10) Then
  434.               ScegliCarta1 = CartaPiuBassa(CartaVBriscola())
  435.             Else
  436.               ScegliCarta1 = CartaPiuBassa(CartaNVincente())
  437.             End If
  438.           Else
  439.             ScegliCarta1 = CartaPiuBassa(CartaVBriscola())
  440.           End If
  441.         End If
  442.         If (numVBriscole = 0 And numVNoBriscole = 2) Then ScegliCarta1 = CartaPiuAlta(CartaVNoBriscola())
  443.         If (numVBriscole = 1 And numVNoBriscole = 1) Then
  444.           If (numVNoBriscoleC = 1 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaVNoBriscolaC(1)
  445.           If (numVNoBriscoleNC = 1 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaVNoBriscolaNC(1)
  446.         End If
  447.       End If
  448.       If (numCarteVincenti = 3) Then
  449.         If (numVBriscole = 3 And numVNoBriscole = 0) Then ScegliCarta1 = CartaPiuBassa(CartaVBriscola())
  450.         If (numVBriscole = 0 And numVNoBriscole = 3) Then ScegliCarta1 = CartaPiuAlta(CartaVNoBriscola())
  451.         If (numVBriscole = 1 And numVNoBriscole = 2) Then
  452.           If (numVNoBriscoleC = 2 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaPiuAlta(CartaVNoBriscolaC())
  453.           If (numVNoBriscoleC = 1 And numVNoBriscoleNC = 1 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaVNoBriscolaC(1)
  454.           If (numVNoBriscoleNC = 2 And (numVBriscoleC = 1 Or numVBriscoleNC = 1)) Then ScegliCarta1 = CartaPiuAlta(CartaVNoBriscolaNC())
  455.         End If
  456.         If (numVBriscole = 2 And numVNoBriscole = 1) Then
  457.           If (numVNoBriscoleC = 1) Then ScegliCarta1 = CartaVNoBriscolaC(1)
  458.           If (numVNoBriscoleNC = 1) Then ScegliCarta1 = CartaVNoBriscolaNC(1)
  459.         End If
  460.       End If
  461.     'dato che il PC non ha una carta per vincere la mano, cerca di buttare la carta
  462.     'di punteggio più basso (possibilmente non briscola)
  463.     Else
  464.       If (numBriscole = 0 And numNoBriscole = 3) Then ScegliCarta1 = CartaPiuBassa(CartaNoBriscola())
  465.       If (numBriscole = 3 And numNoBriscole = 0) Then ScegliCarta1 = CartaPiuBassa(CartaBriscola())
  466.       If (numBriscole = 1 And numNoBriscole = 2) Then
  467.         If (numBriscoleC = 1 And numNoBriscoleC = 2) Then ScegliCarta1 = CartaPiuBassa(CartaNoBriscolaC())
  468.         If (numNoBriscoleC = 1 And numNoBriscoleNC = 1 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta1 = CartaNoBriscolaNC(1)
  469.         If (numNoBriscoleNC = 2 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta1 = CartaPiuBassa(CartaNoBriscolaNC())
  470.         If (numBriscoleNC = 1 And numNoBriscoleC = 2) Then ScegliCarta1 = CartaBriscolaNC(1)
  471.       End If
  472.       If (numBriscole = 2 And numNoBriscole = 1) Then
  473.         If (numBriscoleC = 1 And numBriscoleNC = 1 And numNoBriscoleC = 1) Then ScegliCarta1 = CartaBriscolaNC(1)
  474.         If (numNoBriscoleNC = 1 And ((numBriscoleC = 1 And numBriscoleNC = 1) Or numBriscoleNC = 2)) Then ScegliCarta1 = CartaNoBriscolaNC(1)
  475.         If (numBriscoleNC = 2 And numNoBriscoleC = 1) Then ScegliCarta1 = CartaPiuBassa(CartaBriscolaNC())
  476.       End If
  477.     End If
  478.     Exit Function
  479.   End If
  480. End Function
  481. Private Function ScegliCarta2(C() As Giocatore) As Giocatore
  482.   'funzione che serve per determinare che carta deve giocare il Computer quando
  483.   'il PC deve giocare per primo
  484.   Dim appoggio(1 To 3) As Giocatore
  485.   Dim CartaBriscola(1 To 3) As Giocatore
  486.   Dim CartaBriscolaC(1 To 3) As Giocatore
  487.   Dim CartaBriscolaNC(1 To 3) As Giocatore
  488.   Dim CartaNoBriscola(1 To 3) As Giocatore
  489.   Dim CartaNoBriscolaC(1 To 3) As Giocatore
  490.   Dim CartaNoBriscolaNC(1 To 3) As Giocatore
  491.   Dim CartaVBriscola(1 To 3) As Giocatore
  492.   Dim CartaVBriscolaC(1 To 3) As Giocatore
  493.   Dim CartaVBriscolaNC(1 To 3) As Giocatore
  494.   Dim CartaVNoBriscola(1 To 3) As Giocatore
  495.   Dim CartaVNoBriscolaC(1 To 3) As Giocatore
  496.   Dim CartaVNoBriscolaNC(1 To 3) As Giocatore
  497.   Dim CartaVincente(1 To 3) As Giocatore
  498.   Dim X, CarteOk As Integer
  499.   Dim numBriscole, numBriscoleC, numBriscoleNC As Integer
  500.   Dim numNoBriscole, numNoBriscoleC, numNoBriscoleNC As Integer
  501.   Dim numCarteVincenti As Integer
  502.   Dim numVBriscole, numVBriscoleC, numVBriscoleNC As Integer
  503.   Dim numVNoBriscole, numVNoBriscoleC, numVNoBriscoleNC As Integer
  504.   Dim Vincente As Boolean
  505.  
  506.   'controllo le carte disponibili del Computer
  507.   For X = 1 To 3
  508.      If (C(X).Carta <> 0) Then
  509.        CarteOk = CarteOk + 1
  510.        appoggio(CarteOk) = C(X)
  511.      End If
  512.   Next X
  513.  
  514.   'controllo i tipi di carte che ha il Computer
  515.   For X = 1 To CarteOk
  516.      'controllo quali carte il computer ha per vincere la mano e le memorizzo
  517.      Vincente = False
  518.      If Vincitore(CartaTavolo(2), appoggio(X)) = "C2" Then
  519.        numCarteVincenti = numCarteVincenti + 1
  520.        CartaVincente(numCarteVincenti) = appoggio(X)
  521.        Vincente = True
  522.      End If
  523.      'controllo le carte di briscola e non, carichi o non, e li memorizzo
  524.      If (appoggio(X).Seme = SemeBriscola) Then
  525.        If (Punti(appoggio(X).Carta) >= 10) Then
  526.          numBriscoleC = numBriscoleC + 1
  527.          CartaBriscolaC(numBriscoleC) = appoggio(X)
  528.          If (Vincente) Then
  529.            numVBriscoleC = numVBriscoleC + 1
  530.            CartaVBriscolaC(numVBriscoleC) = appoggio(X)
  531.          End If
  532.        Else
  533.          numBriscoleNC = numBriscoleNC + 1
  534.          CartaBriscolaNC(numBriscoleNC) = appoggio(X)
  535.          If (Vincente) Then
  536.            numVBriscoleNC = numVBriscoleNC + 1
  537.            CartaVBriscolaNC(numVBriscoleNC) = appoggio(X)
  538.          End If
  539.        End If
  540.        numBriscole = numBriscole + 1
  541.        CartaBriscola(numBriscole) = appoggio(X)
  542.        If (Vincente) Then
  543.          numVBriscole = numVBriscole + 1
  544.          CartaVBriscola(numVBriscole) = appoggio(X)
  545.        End If
  546.      Else
  547.        If (Punti(appoggio(X).Carta) >= 10) Then
  548.          numNoBriscoleC = numNoBriscoleC + 1
  549.          CartaNoBriscolaC(numNoBriscoleC) = appoggio(X)
  550.          If (Vincente) Then
  551.            numVNoBriscoleC = numVNoBriscoleC + 1
  552.            CartaVNoBriscolaC(numVNoBriscoleC) = appoggio(X)
  553.          End If
  554.        Else
  555.          numNoBriscoleNC = numNoBriscoleNC + 1
  556.          CartaNoBriscolaNC(numNoBriscoleNC) = appoggio(X)
  557.          If (Vincente) Then
  558.            numVNoBriscoleNC = numVNoBriscoleNC + 1
  559.            CartaVNoBriscolaNC(numVNoBriscoleNC) = appoggio(X)
  560.          End If
  561.        End If
  562.        numNoBriscole = numNoBriscole + 1
  563.        CartaNoBriscola(numNoBriscole) = appoggio(X)
  564.        If (Vincente) Then
  565.          numVNoBriscole = numVNoBriscole + 1
  566.          CartaVNoBriscola(numVNoBriscole) = appoggio(X)
  567.        End If
  568.      End If
  569.   Next X
  570.  
  571.   'se il Computer ha solo una carta butta quella
  572.   If (CarteOk = 1) Then
  573.     ScegliCarta2 = appoggio(1)
  574.     Exit Function
  575.   'se il Computer ha 2 carte.........
  576.   ElseIf (CarteOk = 2) Then
  577.     If (numBriscole = 0 And numNoBriscole = 2) Then ScegliCarta2 = CartaPiuBassa(CartaNoBriscola())
  578.     If (numBriscole = 2 And numNoBriscole = 0) Then ScegliCarta2 = CartaPiuBassa(CartaBriscola())
  579.     If (numBriscole = 1 And numNoBriscole = 1) Then
  580.       If (numBriscoleC = 1 And numNoBriscoleC = 1) Then ScegliCarta2 = CartaNoBriscolaC(1)
  581.       If (numNoBriscoleNC = 1 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta2 = CartaNoBriscolaNC(1)
  582.       If (numBriscoleNC = 1 And numNoBriscoleC = 1) Then ScegliCarta2 = CartaBriscolaNC(1)
  583.     End If
  584.     Exit Function
  585.   'se il Computer ha 3 carte.........
  586.   Else
  587.     If (numBriscole = 0 And numNoBriscole = 3) Then ScegliCarta2 = CartaPiuBassa(CartaNoBriscola())
  588.     If (numBriscole = 3 And numNoBriscole = 0) Then ScegliCarta2 = CartaPiuBassa(CartaBriscola())
  589.     If (numBriscole = 1 And numNoBriscole = 2) Then
  590.       If (numBriscoleC = 1 And numNoBriscoleC = 2) Then ScegliCarta2 = CartaPiuBassa(CartaNoBriscolaC())
  591.       If (numNoBriscoleC = 1 And numNoBriscoleNC = 1 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta2 = CartaNoBriscolaNC(1)
  592.       If (numNoBriscoleNC = 2 And (numBriscoleC = 1 Or numBriscoleNC = 1)) Then ScegliCarta2 = CartaPiuBassa(CartaNoBriscolaNC())
  593.       If (numBriscoleNC = 1 And numNoBriscoleC = 2) Then ScegliCarta2 = CartaBriscolaNC(1)
  594.     End If
  595.     If (numBriscole = 2 And numNoBriscole = 1) Then
  596.       If (numBriscoleC = 2 And numNoBriscoleC = 1) Then ScegliCarta2 = CartaNoBriscolaC(1)
  597.       If (numNoBriscoleNC = 1) Then ScegliCarta2 = CartaNoBriscolaNC(1)
  598.       If (numBriscoleC = 1 And numBriscoleNC = 1 And numNoBriscoleC = 1) Then ScegliCarta2 = CartaBriscolaNC(1)
  599.       If (numBriscoleNC = 2 And numNoBriscoleC = 1) Then ScegliCarta2 = CartaPiuBassa(CartaBriscolaNC())
  600.     End If
  601.     Exit Function
  602.   End If
  603. End Function
  604. Private Function Vincitore(Carta1 As Giocatore, Carta2 As Giocatore) As String
  605.   'funzione che, date due carte (Carta1 la prima giocata in tavola), restituisce la
  606.   'carta vincente
  607.   If ((Carta1.Seme <> SemeBriscola And Carta2.Seme <> SemeBriscola) Or (Carta1.Seme = SemeBriscola And Carta2.Seme = SemeBriscola)) Then
  608.     If (Carta1.Seme <> Carta2.Seme) Then
  609.       Vincitore = "C1"
  610.     Else
  611.       If (Punti(Carta1.Carta) > Punti(Carta2.Carta)) Then
  612.         Vincitore = "C1"
  613.       Else
  614.         Vincitore = "C2"
  615.       End If
  616.       If (Punti(Carta1.Carta) = Punti(Carta2.Carta)) Then
  617.         If (Carta1.Carta > Carta2.Carta) Then
  618.           Vincitore = "C1"
  619.         Else
  620.           Vincitore = "C2"
  621.         End If
  622.       End If
  623.     End If
  624.   ElseIf (Carta1.Seme = SemeBriscola) Then
  625.     Vincitore = "C1"
  626.   Else
  627.     Vincitore = "C2"
  628.   End If
  629. End Function
  630. Private Sub PulisciTavolo(Vincitore As String)
  631.   Dim tstart As Single
  632.  
  633.   'aspetto 2 secondi prima di togliere le carte dal tavolo
  634.   tstart = Timer
  635.   Do
  636.     DoEvents
  637.   Loop Until (Timer - tstart) > SleepTime
  638.  
  639.   'tolgo le carte dal tavolo
  640.   imgTable(1).Picture = LoadPicture("")
  641.   imgTable(1).BorderStyle = 0
  642.   imgTable(2).Picture = LoadPicture("")
  643.   imgTable(2).BorderStyle = 0
  644.  
  645.   'assegno i punteggi al giocatore o al computer
  646.   If (Vincitore = "C1" And Giocatore1 = "P") Or (Vincitore = "C2" And Giocatore1 = "C") Then
  647.       PuntiPlayer = PuntiPlayer + Punti(CartaTavolo(1).Carta) + Punti(CartaTavolo(2).Carta)
  648.       lblPlayer.Caption = PuntiPlayer
  649.       Giocatore1 = "P"
  650.   Else
  651.       PuntiComputer = PuntiComputer + Punti(CartaTavolo(1).Carta) + Punti(CartaTavolo(2).Carta)
  652.       lblComputer.Caption = PuntiComputer
  653.       Giocatore1 = "C"
  654.   End If
  655.  
  656.   'azzero i valori delle carte sul tavolo
  657.   CartaTavolo(1).Carta = 0
  658.   CartaTavolo(1).Seme = 0
  659.   CartaTavolo(1).FileCard = ""
  660.   CartaTavolo(2).Carta = 0
  661.   CartaTavolo(2).Seme = 0
  662.   CartaTavolo(2).FileCard = ""
  663.  
  664.   'fino a quando ci sono le carte...
  665.   If (numCarteTot > 0) Then
  666.    
  667.     'richiamo la funzione per ridare una carta per ognuno
  668.     Call GiveCards(1)
  669.    
  670.     'aggiorno il numero di carte rimaste
  671.     numCarteTot = numCarteTot - 2
  672.     lblNumeroCarte.Caption = numCarteTot & " cards"
  673.    
  674.     'se le carte sono finite cancello il mazzo
  675.     If (numCarteTot = 0) Then
  676.         imgMazzo.Picture = LoadPicture("")
  677.         imgMazzo.BorderStyle = 0
  678.         Line1.Visible = True
  679.         lblNumeroCarte.Visible = False
  680.     End If
  681.   Else
  682.     CartaComputer(CartaGiocataC).Carta = 0
  683.     CartaComputer(CartaGiocataC).Seme = 0
  684.     CartaComputer(CartaGiocataC).FileCard = ""
  685.     EndGame = EndGame + 1
  686.     If (EndGame = 3) Then
  687.         If (CInt(lblPlayer.Caption) + CInt(lblComputer.Caption)) <> PuntiTot Then
  688.             MsgBox "Points Error!", vbCritical, "Attention"
  689.         Else
  690.             If PuntiPlayer > 60 Then MsgBox "You have WIN!", vbInformation, "Information"
  691.             If PuntiComputer > 60 Then MsgBox "Computer has WIN!", vbInformation, "Information"
  692.             If PuntiPlayer = PuntiComputer Then MsgBox "Same Points!", vbInformation, "Information"
  693.             ScriviStatistiche
  694.         End If
  695.         imgSeme.Picture = LoadPicture("")
  696.         imgSeme.BorderStyle = 0
  697.         Line1.Visible = False
  698.         Exit Sub
  699.     End If
  700.     If (Giocatore1 = "C") Then GiocaPC
  701.   End If
  702. End Sub
  703. Private Function CartaPiuAlta(C() As Giocatore) As Giocatore
  704.     'funzione che serve per trovare la carta piu' alta in un array di carte
  705.     Dim appoggio(1 To 3) As Giocatore
  706.     Dim X, CarteOk As Integer
  707.     For X = 1 To 3
  708.         If (C(X).Carta <> 0) Then
  709.             CarteOk = CarteOk + 1
  710.             appoggio(CarteOk) = C(X)
  711.         End If
  712.     Next X
  713.     CartaPiuAlta = appoggio(1)
  714.     If (CarteOk >= 2) Then
  715.         For X = 1 To (CarteOk - 1)
  716.             If (Punti(appoggio(X + 1).Carta) > Punti(CartaPiuAlta.Carta) Or (Punti(appoggio(X + 1).Carta) = Punti(CartaPiuAlta.Carta) And appoggio(X + 1).Carta >= CartaPiuAlta.Carta)) Then CartaPiuAlta = appoggio(X + 1)
  717.         Next X
  718.     End If
  719. End Function
  720. Private Function CartaPiuBassa(C() As Giocatore) As Giocatore
  721.     'funzione che serve per trovare la carta piu' bassa in un array di carte
  722.     Dim appoggio(1 To 3) As Giocatore
  723.     Dim X, CarteOk As Integer
  724.     For X = 1 To 3
  725.         If (C(X).Carta <> 0) Then
  726.             CarteOk = CarteOk + 1
  727.             appoggio(CarteOk) = C(X)
  728.         End If
  729.     Next X
  730.     CartaPiuBassa = appoggio(1)
  731.     If (CarteOk >= 2) Then
  732.         For X = 1 To (CarteOk - 1)
  733.             If (Punti(appoggio(X + 1).Carta) < Punti(CartaPiuBassa.Carta) Or (Punti(appoggio(X + 1).Carta) = Punti(CartaPiuBassa.Carta) And appoggio(X + 1).Carta <= CartaPiuBassa.Carta)) Then CartaPiuBassa = appoggio(X + 1)
  734.         Next X
  735.     End If
  736. End Function
  737. Private Sub mnuChangeCards_Click()
  738.   Dim TipoMazzoOld, TipoDorsoOld As String
  739.   TipoMazzoOld = TipoMazzo
  740.   TipoDorsoOld = TipoDorso
  741.   frmChangeCards.Show 1
  742.   If (TipoMazzo <> TipoMazzoOld Or TipoDorso <> TipoDorsoOld) Then
  743.     Giocatore1 = "P"
  744.     Scozza
  745.   End If
  746. End Sub
  747. Private Sub mnuGameSpeed_Click()
  748.   On Error Resume Next
  749.   SleepTime = InputBox("Insert the game speed (sec)", "Game Speed", 2)
  750.   If Err.Number = 13 Then SleepTime = 2
  751.   On Error GoTo 0
  752. End Sub
  753. Private Sub mnuNewPlay_Click()
  754.   If EndGame <> 3 Then
  755.     If MsgBox("Do you want to clear the game?", vbExclamation + vbYesNo, "Attention!") = vbYes Then
  756.       Giocatore1 = "P"
  757.       Scozza
  758.     End If
  759.   Else
  760.     Giocatore1 = "P"
  761.     Scozza
  762.   End If
  763. End Sub
  764. Private Sub mnuShowScore_Click()
  765.   If mnuShowScore.Checked Then
  766.     'nasconde i punteggi
  767.     lblStaticComputer.Visible = False
  768.     lblComputer.Visible = False
  769.     lblStaticPlayer.Visible = False
  770.     lblPlayer.Visible = False
  771.  Else
  772.     'visualizza i punteggi
  773.     lblStaticComputer.Visible = True
  774.     lblComputer.Visible = True
  775.     lblStaticPlayer.Visible = True
  776.     lblPlayer.Visible = True
  777.   End If
  778.   mnuShowScore.Checked = Not (mnuShowScore.Checked)
  779. End Sub
  780. Private Sub mnuStatistic_Click()
  781.   Dim appoggio1, appoggio2, appoggio3 As String
  782.   Dim tot As Long
  783.   'apro il file delle statistiche
  784.   If (Dir(StatisticFile) <> "") Then
  785.     Open StatisticFile For Input As #1
  786.       Line Input #1, appoggio1
  787.       Line Input #1, appoggio2
  788.       Line Input #1, appoggio3
  789.       tot = Val(appoggio1) + Val(appoggio2) + Val(appoggio3)
  790.     Close #1
  791.   Else
  792.     appoggio1 = 0
  793.     appoggio2 = 0
  794.     appoggio3 = 0
  795.   End If
  796.   fraWins.Visible = True
  797.   lblWin(0).Visible = True
  798.   lblWin(1).Visible = True
  799.   lblWin(2).Visible = True
  800.   cmdOkWin.Visible = True
  801.   cmdOkWin.Enabled = True
  802.   lblWin(0).Caption = "Computer : " & appoggio1 & " (" & Format$(100 * (Val(appoggio1) / tot), "00.00") & "%)"
  803.   lblWin(1).Caption = "     Player : " & appoggio2 & " (" & Format$(100 * (Val(appoggio2) / tot), "00.00") & "%)"
  804.   lblWin(2).Caption = "  Standoff : " & appoggio3 & " (" & Format$(100 * (Val(appoggio3) / tot), "00.00") & "%)"
  805. End Sub
  806. Private Sub cmdOkWin_Click()
  807.   fraWins.Visible = False
  808.   lblWin(0).Visible = False
  809.   lblWin(1).Visible = False
  810.   lblWin(2).Visible = False
  811.   cmdOkWin.Visible = False
  812.   cmdOkWin.Enabled = False
  813. End Sub
  814. Private Sub mnuUnshroundGame_Click()
  815.   Dim i As Integer
  816.   'scopre o copre le carte del computer
  817.   For i = 1 To 3
  818.     If (imgComputer(i).BorderStyle <> 0) Then
  819.       If (mnuUnshroundGame.Checked) Then
  820.         imgComputer(i).Picture = LoadPicture(Dorso)
  821.       Else
  822.         imgComputer(i).Picture = LoadPicture(CartaComputer(i).FileCard)
  823.       End If
  824.     End If
  825.   Next
  826.   mnuUnshroundGame.Checked = Not (mnuUnshroundGame.Checked)
  827. End Sub
  828. Private Sub Form_Unload(Cancel As Integer)
  829.   If MsgBox("Are you sure?", vbExclamation + vbYesNo, "Exit game") = vbNo Then Cancel = -1
  830. End Sub
  831. Private Sub mnuAbout_Click()
  832.   frmAbout.Show vbModal
  833. End Sub
  834. Private Sub mnuExit_Click()
  835.   Unload Me
  836. End Sub
  837. Private Sub ScriviStatistiche()
  838.   Dim appoggio1, appoggio2, appoggio3 As String
  839.   'apro il file delle statistiche
  840.   If (Dir(StatisticFile) <> "") Then
  841.     Open StatisticFile For Input As #1
  842.       Line Input #1, appoggio1
  843.       Line Input #1, appoggio2
  844.       Line Input #1, appoggio3
  845.     Close #1
  846.     Open StatisticFile For Output As #1
  847.       If PuntiComputer > 60 Then appoggio1 = appoggio1 + 1
  848.       If PuntiPlayer > 60 Then appoggio2 = appoggio2 + 1
  849.       If PuntiComputer = PuntiPlayer Then appoggio3 = appoggio3 + 1
  850.       Print #1, appoggio1
  851.       Print #1, appoggio2
  852.       Print #1, appoggio3
  853.     Close #1
  854.   Else
  855.     MsgBox "I can't find the Statistic file!", vbCritical, "Attention"
  856.   End If
  857. End Sub



FrmchangedCards :



Codice sorgente - presumibilmente VB.NET

  1. Option Explicit
  2. Dim TipoMazzoOld, TipoDorsoOld As String
  3. Private Sub cmdOK_Click()
  4.     If cmbCardType.Text <> "" Or cmbBackCards.Text <> "" Then
  5.         If MsgBox("Are you sure to restart a new game?", vbExclamation + vbYesNo, "Attention") = vbYes Then
  6.           If cmbCardType.Text <> "" Then
  7.             TipoMazzo = cmbCardType.Text
  8.           Else
  9.             TipoMazzo = TipoMazzoOld
  10.           End If
  11.           If cmbBackCards.Text <> "" Then
  12.             TipoDorso = "Dorso_" & Format(cmbBackCards.ListIndex, "00") & ".bmp"
  13.           Else
  14.             TipoDorso = TipoDorsoOld
  15.           End If
  16.           Unload frmChangeCards
  17.         End If
  18.     Else
  19.         Unload frmChangeCards
  20.     End If
  21. End Sub
  22. Private Sub cmdCancel_Click()
  23.   Unload frmChangeCards
  24. End Sub
  25. Private Sub Form_Load()
  26.   Dim i As Integer
  27.   TipoMazzoOld = TipoMazzo
  28.   TipoDorsoOld = TipoDorso
  29.   For i = 1 To 5
  30.     cmbCardType.AddItem Choose(i, "Default", "Francesi", "Napoletane", "Piacentine", "Poker")
  31.   Next i
  32.   For i = 1 To 16
  33.     cmbBackCards.AddItem Choose(i, "Astronaut", "Blue", "Cars", "Clouds", "Classic", "Default", "Duke", "Dune", "Fish", "French", "Frog", "Hawaii", "Lines", "Pixellate", "Violet", "Vortex")
  34.   Next i
  35. End Sub
  36.  
  37. Briscola.bas(modulo):



Codice sorgente - presumibilmente VB.NET

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3. 'variabile globale Tipomazzo e TipoDorso
  4. Global TipoMazzo As String
  5. Global TipoDorso As String
  6.  
  7. 'struttura Giocatore
  8. Public Type Giocatore
  9.     Carta As Integer
  10.     Seme As Integer
  11.     FileCard As String
  12. End Type
  13.  
  14. 'funzione per mandare una email
  15. Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  16. Public Const SW_SHOWNORMAL = 1


PM Quote
Avatar
MeTeMpSiCoSi (Ex-Member)
Pro


Messaggi: 159
Iscritto: 14/03/2007

Segnala al moderatore
Postato alle 21:54
Domenica, 02/09/2007
Grazie, però potrei avere il progetto già fatto?anche per vedere il form e le img...Grazie mille cmq

PM Quote