Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim pic(4) As PictureBox
- Dim Cartes(51) As Integer
- Dim anti_clone(51) As Boolean
- Dim main(4) As Integer
- Dim ninja(4) As Integer
- Dim Cpt_Cartes As Integer
- Dim Option_Enable As Boolean
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- numCredit.Value = 50
- Creer_Le_Poker()
- End Sub
- Private Sub Creer_Le_Poker()
- Dim i As Integer
- For i = 0 To pic.GetUpperBound(0)
- pic(i) = New PictureBox
- With pic(i)
- .Visible = True
- .Width = 130
- .Height = 200
- .Left = 20 + (i * 160)
- .Top = 20
- .BorderStyle = BorderStyle.Fixed3D
- .SizeMode = PictureBoxSizeMode.StretchImage
- End With
- Me.Controls.Add(pic(i))
- Next
- End Sub
- Private Sub cmdJouer_Click(sender As Object, e As EventArgs) Handles cmdJouer.Click
- numMise.Enabled = False
- cmdJouer.Enabled = False
- cmdContinuer.Enabled = True
- numCredit.Value = numCredit.Value - numMise.Value
- Cpt_Cartes = 0
- Dim cpt As Integer
- Dim c As Integer
- Dim i As Integer
- Dim hasard As New Random
- For i = 0 To Cartes.GetUpperBound(0)
- Cartes(i) = (cpt)
- cpt += 1
- Next
- Dim temp As Integer
- Dim i1, i2, i3 As Integer
- For c = 0 To 30000
- For i1 = 0 To Cartes.GetUpperBound(0)
- i2 = hasard.Next(0, Cartes.GetUpperBound(0))
- temp = Cartes(i1)
- Cartes(i1) = Cartes(i2)
- Cartes(i2) = temp
- Next i1
- Next
- 'Array.Sort(Cartes)
- For i = 0 To main.GetUpperBound(0)
- main(i) = Cartes(i)
- Next
- For i = 0 To main.GetUpperBound(0)
- pic(i).Image = imaCartes.Images(main(i))
- Cpt_Cartes += 1
- Next
- End Sub
- Private Sub CarteSelection(sender As Object, e As EventArgs)
- End Sub
- Private Sub cmdContinuer_Click(sender As Object, ass As EventArgs) Handles cmdContinuer.Click
- Dim i As Integer
- Dim Filtre_Condition As Boolean
- Dim Carte_haute As Boolean = True
- Dim cpt, cpt_coeur, cpt_trefle, cpt_carreau, cpt_pique As Integer
- Dim hasard As New Random
- If chkGarder1.Checked = False Then
- i = Cpt_Cartes
- main(0) = Cartes(51)
- pic(0).Image = imaCartes.Images(main(0))
- Cpt_Cartes += 1
- End If
- If chkGarder2.Checked = False Then
- i = Cpt_Cartes
- main(1) = Cartes(50)
- pic(1).Image = imaCartes.Images(main(1))
- Cpt_Cartes += 1
- End If
- If chkGarder3.Checked = False Then
- i = Cpt_Cartes
- main(2) = Cartes(49)
- pic(2).Image = imaCartes.Images(main(2))
- Cpt_Cartes += 1
- End If
- If chkGarder4.Checked = False Then
- i = Cpt_Cartes
- main(3) = Cartes(48)
- pic(3).Image = imaCartes.Images(main(3))
- Cpt_Cartes += 1
- End If
- If chkGarder5.Checked = False Then
- i = Cpt_Cartes
- main(4) = Cartes(47)
- pic(4).Image = imaCartes.Images(main(4))
- Cpt_Cartes += 1
- End If
- 'Royale Flush
- Array.Sort(main)
- For i = 0 To main.GetUpperBound(0)
- If main(i) >= 8 And main(i) <= 12 And main(4) = main(3) + 1 And main(3) = main(2) + 1 And main(2) = main(1) + 1 And main(1) = main(0) + 1 Then
- cpt_coeur += 1
- End If
- If cpt_coeur = 5 Then
- MsgBox("Royale Flush!!")
- txtGain.Text = numMise.Value * 100
- numCredit.Value = numCredit.Value + (numMise.Value * 100)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 21 And main(i) <= 25 And main(4) = main(3) + 1 And main(3) = main(2) + 1 And main(2) = main(1) + 1 And main(1) = main(0) + 1 Then
- cpt_trefle += 1
- End If
- If cpt_trefle = 5 Then
- MsgBox("Royale Flush!!")
- txtGain.Text = numMise.Value * 100
- numCredit.Value = numCredit.Value + (numMise.Value * 100)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 34 And main(i) <= 38 And main(4) = main(3) + 1 And main(3) = main(2) + 1 And main(2) = main(1) + 1 And main(1) = main(0) + 1 Then
- cpt_carreau += 1
- End If
- If cpt_carreau = 5 Then
- MsgBox("Royale Flush!!")
- txtGain.Text = numMise.Value * 100
- numCredit.Value = numCredit.Value + (numMise.Value * 100)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 47 And main(i) <= 51 And main(4) = main(3) + 1 And main(3) = main(2) + 1 And main(2) = main(1) + 1 And main(1) = main(0) + 1 Then
- cpt_pique += 1
- End If
- If cpt_pique = 5 Then
- MsgBox("Royale Flush!!")
- txtGain.Text = numMise.Value * 100
- numCredit.Value = numCredit.Value + (numMise.Value * 100)
- Filtre_Condition = True
- Carte_haute = False
- End If
- Next
- 'Straight flush
- cpt = 0
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- Array.Sort(main)
- 'If main(i) >= 39 And main(i) <= 51 Or main(i) >= 26 And main(i) <= 38 Or main(i) >= 13 And main(i) <= 25 Or main(i) >= 0 And main(i) <= 12 Then
- If main(4) = main(3) + 1 And main(3) = main(2) + 1 And main(2) = main(1) + 1 And main(1) = main(0) + 1 Then
- cpt += 1
- If cpt = 5 Then
- MsgBox("Straight flush")
- 'straight_Flush = True
- Filtre_Condition = True
- Carte_haute = False
- txtGain.Text = numMise.Value * 50
- numCredit.Value = numCredit.Value + (numMise.Value * 50)
- End If
- End If
- 'End If
- Next
- End If
- 'Four of kind
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(4) = ninja(3) And ninja(3) = ninja(2) And ninja(2) = ninja(1) Or ninja(0) = ninja(1) And ninja(1) = ninja(2) And ninja(2) = ninja(3) Then
- MsgBox("Four of kind")
- 'multi_filtre = True
- Filtre_Condition = True
- Carte_haute = False
- txtGain.Text = numMise.Value * 25
- numCredit.Value = numCredit.Value + (numMise.Value * 25)
- End If
- End If
- 'Full house
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(4) = ninja(3) And ninja(3) = ninja(2) And ninja(1) = ninja(0) Or ninja(0) = ninja(1) And ninja(1) = ninja(2) And ninja(3) = ninja(4) Then
- MsgBox("Full house")
- Filtre_Condition = True
- 'multi_filtre = True
- Carte_haute = False
- txtGain.Text = numMise.Value * 20
- numCredit.Value = numCredit.Value + (numMise.Value * 20)
- End If
- End If
- 'Flush
- If Filtre_Condition = False Then ' ici si la condition du filtre est fausse, il va continuer l'évaluation de la main pour évaluer une flush
- ' sans que cette condition et celle de la straight rentre en clonflit
- For i = 0 To main.GetUpperBound(0)
- If main(i) >= 0 And main(i) <= 12 Then
- cpt_coeur += 1
- End If
- If cpt_coeur = 5 Then
- MsgBox("Flush")
- txtGain.Text = numMise.Value * 15
- numCredit.Value = numCredit.Value + (numMise.Value * 15)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 13 And main(i) <= 25 Then
- cpt_trefle += 1
- End If
- If cpt_trefle = 5 Then
- MsgBox("Flush")
- txtGain.Text = numMise.Value * 15
- numCredit.Value = numCredit.Value + (numMise.Value * 15)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 26 And main(i) <= 38 Then
- cpt_carreau += 1
- End If
- If cpt_carreau = 5 Then
- MsgBox("Flush")
- txtGain.Text = numMise.Value * 15
- numCredit.Value = numCredit.Value + (numMise.Value * 15)
- Filtre_Condition = True
- Carte_haute = False
- End If
- If main(i) >= 39 And main(i) <= 51 Then
- cpt_pique += 1
- End If
- If cpt_pique = 5 Then
- MsgBox("Flush")
- txtGain.Text = numMise.Value * 15
- numCredit.Value = numCredit.Value + (numMise.Value * 15)
- Filtre_Condition = True
- Carte_haute = False
- End If
- Next
- End If
- 'Straight
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(4) = ninja(3) + 1 And ninja(3) = ninja(2) + 1 And ninja(2) = ninja(1) + 1 And ninja(1) = ninja(0) + 1 Then
- MsgBox("Straight")
- Filtre_Condition = True
- txtGain.Text = numMise.Value * 10
- numCredit.Value = numCredit.Value + (numMise.Value * 10)
- Carte_haute = False
- End If
- End If
- 'three of a kind
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(0) = ninja(1) And ninja(1) = ninja(2) Or ninja(1) = ninja(2) And ninja(2) = ninja(3) Or ninja(4) = ninja(3) And ninja(3) = ninja(2) Then
- MsgBox("Three of a kind")
- txtGain.Text = numMise.Value * 5
- numCredit.Value = numCredit.Value + (numMise.Value * 5)
- Carte_haute = False
- Filtre_Condition = True
- 'three_kind = True
- End If
- End If
- ' two pairs
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(0) = ninja(1) And ninja(2) = ninja(3) Or ninja(1) = ninja(2) And ninja(3) = ninja(4) Or ninja(0) = ninja(1) And ninja(3) = ninja(4) Then
- MsgBox("two pairs")
- txtGain.Text = numMise.Value * 3
- numCredit.Value = numCredit.Value + (numMise.Value * 3)
- Filtre_Condition = True
- Carte_haute = False
- End If
- End If
- 'pair
- If Filtre_Condition = False Then
- For i = 0 To main.GetUpperBound(0)
- ninja(i) = main(i) Mod 13
- Next
- Array.Sort(ninja)
- If ninja(0) = ninja(1) Or ninja(1) = ninja(2) Or ninja(2) = ninja(3) Or ninja(3) = ninja(4) Then
- If ninja(0) >= 9 And ninja(1) >= 9 Or ninja(1) >= 9 And ninja(2) >= 9 Or ninja(2) >= 9 And ninja(3) >= 9 Or ninja(3) >= 9 And ninja(4) >= 9 Then
- MsgBox("pairs")
- txtGain.Text = numMise.Value * 1
- numCredit.Value = numCredit.Value + (numMise.Value * 1)
- Filtre_Condition = True
- Carte_haute = False
- Else
- MsgBox("Main pairs infèrieure au valet, votre main est perdante")
- Filtre_Condition = True
- Carte_haute = False
- End If
- End If
- End If
- 'Main haute
- If Carte_haute = True Then
- MsgBox("main haute. votre main est perdante")
- txtGain.Text = "-" & numMise.Value
- End If
- numMise.Enabled = True
- cmdJouer.Enabled = True
- numMise.Enabled = True
- cmdContinuer.Enabled = False
- Uncheck_after_play() 'ici on appelle on bloque de code qui a pour but de décocher les cases
- End Sub
- Private Sub Uncheck_after_play()
- ' ici losrque le tour de jeux est terminer on décoche les case pour
- ' éviter que elle restent cocher et ennuiyer le joueur a devoir les décocher
- chkGarder1.Checked = False
- chkGarder2.Checked = False
- chkGarder3.Checked = False
- chkGarder4.Checked = False
- chkGarder5.Checked = False
- End Sub
- Private Sub cmdQuitte_Click(sender As Object, e As EventArgs) Handles cmdQuitte.Click
- If MsgBox("Voulez-vous quitter le jeux ? ", MsgBoxStyle.YesNo) = MsgBoxResult.Ok Then
- Application.Exit()
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement