VENOMWORLD

Tirage Euromillions

Voici un utilitaire simple. Qui comme sont nom l’indique, permet de simuler des grilles de tirages pour le jeu Euromillions.

Code source

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; + Autor : Venom +
; + Project name : Euromillions +
; + Version : V 1.0 +
; + Compilator : PureBasic V5.72 +
; + Date : 15/09/2020 +
; + OS : Windows 10 +
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Window Constants
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enumeration
#Window_0
EndEnumeration

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Gadgets Constants
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enumeration
#Ball_Vide
#Ball_Tirage1
#Ball_Tirage2
#Ball_Tirage3
#Ball_Tirage4
#Ball_Tirage5

#Star_Vide
#Star_Tirage1
#Star_Tirage2

#Lancer
EndEnumeration

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Initialisations
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
UsePNGImageDecoder()

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Declarations variables
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Global CheminBalls$ = « GFX\Balls\ », CheminStars$ = « GFX\Stars\ »
Global Dim Chiffre(50), Dim Etoile(12)

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Declarations procedures
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Declare TirageBalls()
Declare TirageStars()

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Ouverture de la fenetre principale
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If OpenWindow(#Window_0, 0, 0, 760, 140, « Tirage Euromillions », #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
If LoadImage(#Ball_Vide, CheminBalls$+ »vide.png », 0) ; affichage des balls vides au démarrage
ImageGadget(#Ball_Tirage1, 0, 0, ImageWidth(#Ball_Vide), ImageHeight(#Ball_Vide), ImageID(#Ball_Vide))
ImageGadget(#Ball_Tirage2, 110, 0, ImageWidth(#Ball_Vide), ImageHeight(#Ball_Vide), ImageID(#Ball_Vide))
ImageGadget(#Ball_Tirage3, 220, 0, ImageWidth(#Ball_Vide), ImageHeight(#Ball_Vide), ImageID(#Ball_Vide))
ImageGadget(#Ball_Tirage4, 330, 0, ImageWidth(#Ball_Vide), ImageHeight(#Ball_Vide), ImageID(#Ball_Vide))
ImageGadget(#Ball_Tirage5, 440, 0, ImageWidth(#Ball_Vide), ImageHeight(#Ball_Vide), ImageID(#Ball_Vide))
EndIf

If LoadImage(#Star_Vide, CheminStars$+ »vide.png », 0) ; affichage des etoiles vides au démarrage
ImageGadget(#Star_Tirage1, 550, 0, ImageWidth(#Star_Vide), ImageHeight(#Star_Vide), ImageID(#Star_Vide))
ImageGadget(#Star_Tirage2, 660, 0, ImageWidth(#Star_Vide), ImageHeight(#Star_Vide), ImageID(#Star_Vide))
EndIf

ButtonGadget(#Lancer, 5, 110, 750, 25, « Lancer un tirage »)

EndIf

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Boucle
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadget()

Case #Lancer
TirageBalls()
TirageStars()

EndSelect
EndIf
Until EventID = #PB_Event_CloseWindow

 

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Procedures
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure TirageBalls()
For a = 0 To 49
Chiffre(a) = a
Next

RandomizeArray(Chiffre())

If LoadImage(#Ball_Tirage1, CheminBalls$+Chiffre(0)+ ».png », 0)
ImageGadget(#Ball_Tirage1, 0, 0, ImageWidth(#Ball_Tirage1), ImageHeight(#Ball_Tirage1), ImageID(#Ball_Tirage1))
EndIf
If LoadImage(#Ball_Tirage2, CheminBalls$+Chiffre(1)+ ».png », 0)
ImageGadget(#Ball_Tirage2, 110, 0, ImageWidth(#Ball_Tirage2), ImageHeight(#Ball_Tirage2), ImageID(#Ball_Tirage2))
EndIf
If LoadImage(#Ball_Tirage3, CheminBalls$+Chiffre(2)+ ».png », 0)
ImageGadget(#Ball_Tirage3, 220, 0, ImageWidth(#Ball_Tirage3), ImageHeight(#Ball_Tirage3), ImageID(#Ball_Tirage3))
EndIf
If LoadImage(#Ball_Tirage4, CheminBalls$+Chiffre(3)+ ».png », 0)
ImageGadget(#Ball_Tirage4, 330, 0, ImageWidth(#Ball_Tirage4), ImageHeight(#Ball_Tirage4), ImageID(#Ball_Tirage4))
EndIf
If LoadImage(#Ball_Tirage5, CheminBalls$+Chiffre(4)+ ».png », 0)
ImageGadget(#Ball_Tirage5, 440, 0, ImageWidth(#Ball_Tirage5), ImageHeight(#Ball_Tirage5), ImageID(#Ball_Tirage5))
EndIf
EndProcedure

Procedure TirageStars()
For b = 0 To 11
Etoile(b) = b
Next

RandomizeArray(Etoile())

If LoadImage(#Star_Tirage1, CheminStars$+Etoile(0)+ ».png », 0)
ImageGadget(#Star_Tirage1, 550, 0, ImageWidth(#Star_Tirage1), ImageHeight(#Star_Tirage1), ImageID(#Star_Tirage1))
EndIf
If LoadImage(#Star_Tirage2, CheminStars$+Etoile(1)+ ».png », 0)
ImageGadget(#Star_Tirage2, 660, 0, ImageWidth(#Star_Tirage2), ImageHeight(#Star_Tirage2), ImageID(#Star_Tirage2))
EndIf
EndProcedure

Le logiciel est distribué à titre gratuit.

Néanmoins, si vous gagnez je ne suis pas contre un partage 😁

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *