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
Test di memoria - MEM.frm

MEM.frm

Caricato da: Antometal
Scarica il programma completo

  1. Public N, Volte As Integer
  2. Const Oss = "Osserva attentamente le lettere", Dig = "Digita le lettere appena osservate nello stesso ordine in cui sono state presentate", Err1 = "Errore! Le lettere erano:", Err2 = "Sono state digitate:", Giusto = "Giusto:" & vbCrLf & "Tutte le lettere sono nell' ordine corretto", Titolo = "Test di memoria..."
  3.  
  4. Private Sub ERRORE()
  5. Guida.Caption = Err1
  6. Guida2.Caption = Err2
  7. lbl1.Visible = True
  8. lbl2.Visible = True
  9. Ritenta.Visible = True
  10. Ritenta.Default = True
  11.     For i = 0 To N
  12.         Sorg(i).Visible = True
  13.     Next i
  14. End Sub
  15.  
  16. Private Sub Azzera()
  17. Dim Risposta As VbMsgBoxResult
  18. Volte = 0
  19. Guida.Caption = Oss
  20. Guida2.Caption = ""
  21. lbl1.Visible = False
  22. lbl2.Visible = False
  23. N = N + 1
  24. Me.Caption = "Livello" & N + 1 & " - " & Titolo
  25. TM.Enabled = True
  26.     For i = 0 To 9
  27.         Mem(i).Visible = False
  28.         Mem(i).Text = ""
  29.         Sorg(i).Visible = False
  30.         Sorg(i).Caption = ""
  31.     Next i
  32.     If N = 10 Then
  33.         sbagliato = False
  34.             For i = 0 To N - 1
  35.                     If Sorg(i).Caption <> Mem(i).Text Then sbagliato = True
  36.             Next i
  37.             If sbagliato = False Then
  38.                 Me.Caption = Titolo
  39.                 Risposta = MsgBox(String(86, "*") & vbCrLf & "Complimenti, sei riuscito a superare tutti i 10 livelli di difficoltà" & vbCrLf & "Vuoi riprovare?" & vbCrLf + Chr(10) & String(86, "*"), vbRetryCancel + vbDefaultButton1 + vbQuestion, "GAME OVER")
  40.                     If Risposta = vbRetry Then cmdInizia_Click
  41.                     If Risposta = vbCancel Then End
  42.             Else: ERRORE
  43.             End If
  44.     End If
  45. End Sub
  46.  
  47. Private Sub Continua_Click()
  48. Azzera
  49. Continua.Visible = False
  50. Continua.Default = False
  51. End Sub
  52.  
  53. Private Sub cmdInizia_Click()
  54. Randomize
  55. N = -1
  56. Azzera
  57. Me.Caption = "Livello" & N + 1 & " - " & Titolo
  58. TM.Enabled = True
  59. cmdInizia.Visible = False
  60. End Sub
  61.  
  62. Private Sub Mem_Change(Index As Integer)
  63. On Error Resume Next
  64. Dim Sbaglio As Boolean
  65. Sbaglio = False
  66. Mem(Index).Text = UCase(Mem(Index).Text)
  67.     If Index < N And Mem(Index).Text <> "" Then Mem(Index + 1).SetFocus
  68.     If Index = N Then
  69.             For i = 0 To N
  70.                     If Mem(i).Text <> Sorg(i).Caption Then Sbaglio = True
  71.             Next i
  72.     End If
  73.     If Sbaglio = True Then ERRORE
  74.     If Index = N And Sbaglio = False Then
  75.         Guida.Caption = Giusto
  76.         Continua.Visible = True
  77.         Continua.Default = True
  78.         Guida2.Caption = ""
  79.     End If
  80. End Sub
  81.  
  82. Private Sub Ritenta_Click()
  83. Azzera
  84. N = N - 1
  85. Ritenta.Visible = False
  86. Ritenta.Default = False
  87. End Sub
  88.  
  89. Private Sub TM_Timer()
  90.     If N < 10 Then
  91.         If Volte <= N Then
  92.             Sorg(Volte).Caption = Chr(Int(Rnd * 25) + 65)
  93.             Sorg(Volte).Visible = True
  94.         End If
  95.         If Volte <= N + 1 Then Volte = Volte + 1
  96.         If Volte = N + 2 Then
  97.                 For i = 0 To N
  98.                     Sorg(i).Visible = False
  99.                     Mem(i).Visible = True
  100.                 Next i
  101.             Mem(0).SetFocus
  102.             Guida.Caption = ""
  103.             Guida2.Caption = Dig
  104.             TM.Enabled = False
  105.         End If
  106.     End If
  107. End Sub