Code : Tout sélectionner
#White=$FFFFFF:#Black=$000000:#Red=$0000FF:#Yellow=$00FFFF:#Bordo=$9F0560:#Gris=$384053:#pink=$745DDA:#Blu=$FCE303:#Gren=$6EFF91
#pourtour=#Black
#interieur=#Blu
#numero=#Black
#case_proposee=#Bordo
#case_remplie=#Pink
#tableau=#Black
#essai_1ere_case=#Bordo
Global etape=1,x=1,y=1,cas=31,nextcase,choix,num=1,pa,fin
Global Dim Lis.l(197):For k=1 To 28:lis(k)=-1:lis(k+168)=-1:Next
For k=1 To 13:For l=0 To 3:lis(k*14+l-1)=-1:Next:Next
Global Dim opt.l(9):opt(1)=12:opt(2)=27:opt(3)=29:opt(4)=16:opt(5)=-12:opt(6)=-27:opt(7)=-29:opt(8)=-16
Procedure.d Rnd(x,y):ProcedureReturn Int(x*Pow(10,y))/Pow(10,y):EndProcedure
Procedure Mod(x,y):a.d=rnd(x-Int(x/y)*y,5):If a<0:a+y:EndIf:ProcedureReturn a:EndProcedure
Procedure GetXY(a):x=Int((a-1)/14):y=a-14*x:x+1:x-2:y-2:EndProcedure
Procedure Next_Case(p):For choix=1 To 8:nextcase=cas+opt(mod(choix+p-2,8)+1)
If lis(nextcase)=0:Break:EndIf:Next
If choix=9:fin=1:Else:GetXY(nextcase):FillArea(20*x-9,20*y-9,-1,#case_proposee):pa=mod(choix+p-1,8):EndIf
EndProcedure
Procedure Draw_Num(num):DrawText(20*x-8,20*y-7,Str(num),#numero,#case_remplie)
FillArea(20*x-9, 20*y-9, -1, #case_remplie):SetWindowTitle(0,"SUS 100 !!! sus="+Str(num))
EndProcedure
Procedure Fin():MessageRequester("SUS 100","Died at "+Str(num)+Chr(10)+"Programmed by ramam2000@gmail.com"):End:EndProcedure
If OpenWindow(0,0,0,220,220,"SUS 100 !!!",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If CreateImage(0,220,220) And StartDrawing(ImageOutput(0))
CreateGadgetList(WindowID(0)):Box(0,0,220,220,#interieur)
For k=1 To 11:LineXY(10,20*k-10,210,20*k-10,#tableau):LineXY(20*k-10,10,20*k-10,210,#tableau):Next
FillArea(1,1,-1,#pourtour):GetXY(cas):FillArea(20*x-9,20*y-9,-1,#essai_1ere_case)
StopDrawing():ImageGadget(0,0,0,200,200,ImageID(0)):EndIf
AddKeyboardShortcut(0,#PB_Shortcut_Space,1):AddKeyboardShortcut(0,#PB_Shortcut_Return,2)
AddKeyboardShortcut(0,#PB_Shortcut_Left,3):AddKeyboardShortcut(0,#PB_Shortcut_Up,4)
AddKeyboardShortcut(0,#PB_Shortcut_Right,5):AddKeyboardShortcut(0,#PB_Shortcut_Down,6)
AddKeyboardShortcut(0,#PB_Shortcut_Escape,7)
Repeat:Event=WaitWindowEvent()
If event=#PB_Event_Menu:touche=EventMenu():If touche=7:fin():EndIf
If etape=1
If touche<7 And touche>0
If touche=4:cas-1:ElseIf touche=3:cas-14:ElseIf touche=6:cas+1:ElseIf touche=5:cas+14:EndIf
If cas<28:cas+14:ElseIf cas>168:cas-14:EndIf
If mod(cas,14)=2:cas+1:ElseIf mod(cas,14)=13:cas-1:EndIf
StartDrawing(ImageOutput(0)):FillArea(20*x-9,20*y-9,-1,#interieur)
GetXY(cas):FillArea(20*x-9,20*y-9,-1,#essai_1ere_case)
StopDrawing():ImageGadget(0,0,0,200,200,ImageID(0)):EndIf
If touche=2:etape=2
StartDrawing(ImageOutput(0)):FillArea(20*x-9,20*y-9,-1,#interieur)
GetXY(cas):Draw_Num(1):Next_Case(1):lis(cas)=1
StopDrawing():ImageGadget(0, 0, 0, 200, 200, ImageID(0)):EndIf
ElseIf etape=2
If touche=1
StartDrawing(ImageOutput(0)):FillArea(20*x-9,20*y-9,-1,#interieur)
Next_Case(pa+1):StopDrawing():ImageGadget(0,0,0,200,200,ImageID(0))
ElseIf touche=2
cas=nextcase:lis(cas)=num:num+1:StartDrawing(ImageOutput(0))
FillArea(20*x-9, 20*y-9, -1, #interieur):Draw_Num(num)
Next_Case(1):StopDrawing():ImageGadget(0, 0, 0, 200, 200, ImageID(0)):If fin=1:fin():EndIf
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow:EndIf
j'aimerai entendre votre avis
merci