': This program uses
': InForm - GUI library for QB64 - Beta version 7
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - [member=2]FellippeHeitor[/member]
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------
': Controls' IDs: ------------------------------------------------------------------
REM NOTICE: THIS FORM HAS BEEN RECENTLY EDITED
'>> The controls in the list below may have been added or renamed,
'>> and previously existing controls may have been deleted since
'>> this program's structure was first generated.
'>> Make sure to check your code in the events SUBs so that
'>> you can take your recent edits into consideration.
': ---------------------------------------------------------------------------------
CONST paper
= 1, rock
= 2, scissor
= 3, spok
= 4, lizard
= 5, draws
= 2, looses
= 3, wins
= 1
'$INCLUDE:'InForm\InForm.ui'
'$INCLUDE:'InForm\xp.uitheme'
'$INCLUDE:'RockHandScissor.frm'
': Event procedures: ---------------------------------------------------------------
Caption(LB) = "0000"
PlayerChoose = 0
Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = True ' hide help label
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = True
Control(Frame2).Hidden = True ' hide frame2
Control(Frame2).Disabled = True
SUB __UI_BeforeUpdateDisplay
'This event occurs at approximately 30 frames per second.
'You can change the update frequency by calling SetFrameRate DesiredRate%
IF PlayerChoose
= 20 THEN ' wait 2 sec restoreGame
IF PlayerChoose
THEN PlayerChoose
= PlayerChoose
+ 1 ' here we pass one time(20 frames) into sub_Display before to reset the game
'If you set __UI_UnloadSignal = False here you can
'cancel the user's request to close.
' user chooses to play paper
Control(assetssassojpegPX).Disabled = True ' hide images of rock and scissor
Control(assetsforbicepngPX).Disabled = True
Control(assetsspokpngPX).Disabled = True
Control(assetslizardpngPX).Disabled = True
Control(assetssassojpegPX).Hidden = True
Control(assetsforbicepngPX).Hidden = True
Control(assetsspokpngPX).Hidden = True
Control(assetslizardpngPX).Hidden = True
Control(assetsRPSLS_helpjpgPX).Disabled = True ' hide AI's choice
Control(assetsRPSLS_helpjpgPX).Hidden = True
playAI paper
' user chooses to play rock
Control(assetscartajpegPX).Disabled = True ' hide paper and scissor
Control(assetsforbicepngPX).Disabled = True
Control(assetsspokpngPX).Disabled = True
Control(assetslizardpngPX).Disabled = True
Control(assetsspokpngPX).Hidden = True
Control(assetslizardpngPX).Hidden = True
Control(assetscartajpegPX).Hidden = True
Control(assetsforbicepngPX).Hidden = True
Control(assetsRPSLS_helpjpgPX).Disabled = True ' hide AI's choice
Control(assetsRPSLS_helpjpgPX).Hidden = True
playAI rock
'user chooses to play scissor
Control(assetssassojpegPX).Disabled = True ' hide rock and paper
Control(assetscartajpegPX).Disabled = True
Control(assetsspokpngPX).Disabled = True
Control(assetslizardpngPX).Disabled = True
Control(assetsspokpngPX).Hidden = True
Control(assetslizardpngPX).Hidden = True
Control(assetssassojpegPX).Hidden = True
Control(assetscartajpegPX).Hidden = True
Control(assetsRPSLS_helpjpgPX).Disabled = True ' hide AI's choice
Control(assetsRPSLS_helpjpgPX).Hidden = True
playAI scissor
Control(assetssassojpegPX).Disabled = True ' hide rock and paper
Control(assetscartajpegPX).Disabled = True
Control(assetsforbicepngPX).Disabled = True
Control(assetslizardpngPX).Disabled = True
Control(assetsforbicepngPX).Hidden = True
Control(assetslizardpngPX).Hidden = True
Control(assetssassojpegPX).Hidden = True
Control(assetscartajpegPX).Hidden = True
playAI spok
Control(assetssassojpegPX).Disabled = True ' hide rock and paper
Control(assetscartajpegPX).Disabled = True
Control(assetsspokpngPX).Disabled = True
Control(assetsforbicepngPX).Disabled = True
Control(assetsspokpngPX).Hidden = True
Control(assetsforbicepngPX).Hidden = True
Control(assetssassojpegPX).Hidden = True
Control(assetscartajpegPX).Hidden = True
playAI lizard
Control(HelpBT).Disabled = True
Control(Frame2).Hidden = False ' show frame2
Control(Frame2).Disabled = False
Control(assetssassojpegPX).Disabled = False ' show and activate 3 image buttons for user
Control(assetsforbicepngPX).Disabled = False
Control(assetscartajpegPX).Disabled = False
Control(assetsspokpngPX).Disabled = False
Control(assetslizardpngPX).Disabled = False
Control(assetssassojpegPX).Hidden = False
Control(assetsforbicepngPX).Hidden = False
Control(assetscartajpegPX).Hidden = False
Control(assetsspokpngPX).Hidden = False
Control(assetslizardpngPX).Hidden = False
Control(assetsRPSLS_helpjpgPX).Hidden = True ' hide help/AI image
Control(assetsRPSLS_helpjpgPX).Disabled = True
Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = True ' hide help label
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = True
IF Control
(ChooseYourMoveAndWaitAIsOneLB
).Disabled
= False
THEN ' here we reactivate the game
Control(StartBT).Disabled = False
Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = True ' hide help label
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = True
Caption(ChooseYourMoveAndWaitAIsOneLB) = "Choose your move and wait AI's one"
Control(Frame2).Hidden = True ' hide frame2
Control(Frame2).Disabled = True
Control(assetssassojpegPX).Disabled = False ' activate 5 image button for user
Control(assetsforbicepngPX).Disabled = False
Control(assetscartajpegPX).Disabled = False
Control(assetsspokpngPX).Disabled = False
Control(assetslizardpngPX).Disabled = False
Control(assetssassojpegPX).Hidden = False
Control(assetsforbicepngPX).Hidden = False
Control(assetscartajpegPX).Hidden = False
Control(assetsspokpngPX).Hidden = False
Control(assetslizardpngPX).Hidden = False
' here we show the help
Control(StartBT).Disabled = True 'disable help button
Caption(ChooseYourMoveAndWaitAIsOneLB) = "Choose your move and wait AI's one"
Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = False ' show help label
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = False
Control(assetssassojpegPX).Disabled = True ' hide 5 image button for user
Control(assetsforbicepngPX).Disabled = True
Control(assetscartajpegPX).Disabled = True
Control(assetsspokpngPX).Disabled = True
Control(assetslizardpngPX).Disabled = True
Control(assetssassojpegPX).Hidden = True
Control(assetsforbicepngPX).Hidden = True
Control(assetscartajpegPX).Hidden = True
Control(assetsspokpngPX).Hidden = True
Control(assetslizardpngPX).Hidden = True
Control(Frame2).Hidden = False 'show frame2
Control(Frame2).Disabled = False
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\RPSLS_help.jpg" ' load and show help picture
Control(assetsRPSLS_helpjpgPX).Redraw = True
CASE ROCKHANDSCISSORGAMELB
CASE ChooseYourMoveAndWaitAIsOneLB
Control(assetssassojpegPX).Disabled = False 'activate 5 image buttons for user
Control(assetsforbicepngPX).Disabled = False
Control(assetscartajpegPX).Disabled = False
Control(assetsspokpngPX).Disabled = False
Control(assetslizardpngPX).Disabled = False
Control(assetsspokpngPX).Hidden = False
Control(assetslizardpngPX).Hidden = False
Control(assetssassojpegPX).Hidden = False
Control(assetsforbicepngPX).Hidden = False
Control(assetscartajpegPX).Hidden = False
Control(HelpBT).Disabled = False ' activate help button
Control(assetsRPSLS_helpjpgPX).Redraw = True ' force to show AI's choice
PlayerChoose = 0 ' reset the chooser game
'here there is the output sound + images for user
' and adjourn score of game
Control(assetsRPSLS_helpjpgPX).Hidden = False ' show image of ai's choice
Control(assetsRPSLS_helpjpgPX).Disabled = False
Control(assetsRPSLS_helpjpgPX).Redraw = True ' force to show image of ai's choice
Caption
(LB
) = STR$(VAL(Caption
(LB
)) + 10) Caption(ChooseYourMoveAndWaitAIsOneLB) = " YOU WIN!! "
Caption
(LB
) = STR$(VAL(Caption
(LB
)) + 5) Caption(ChooseYourMoveAndWaitAIsOneLB) = " YOU DRAW!! "
Caption
(LB
) = STR$(VAL(Caption
(LB
)) - 10) Caption(ChooseYourMoveAndWaitAIsOneLB) = " YOU LOOSE!! "
Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = False 'show result as text in helplabel
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = False
PlayerChoose = 1 ' the user has made his choice
choosen
= INT(RND * 5) + 1 ' ai chooses Control(ChooseYourMoveAndWaitAIsOneLB).Hidden = True ' hide help label
Control(ChooseYourMoveAndWaitAIsOneLB).Disabled = True
LoadImage Control(assetsRPSLS_helpjpgPX), "" ' reset to null image of ai's choice
' AI chooses to play paper
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\carta.jpg"
'draw
results draws
' failure
results looses
' victory
results wins
' failure
results looses
' victory
results wins
' AI chooses to play rock
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\sasso.jpg"
'victory
results wins
' draw
results draws
' loose
results looses
'victory
results wins
' loose
results looses
' AI chooses to play scissor
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\forbice.png"
'failure
results looses
' victory
results wins
' draw
results draws
' victory
results wins
'failure
results looses
' AI chooses to play spok
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\Spok.png"
' victory
results wins
'failure
results looses
'failure
results looses
' draw
results draws
' victory
results wins
'AI chooses to play lizard
LoadImage Control(assetsRPSLS_helpjpgPX), "assets\lizard.png"
'failure
results looses
' victory
results wins
' victory
results wins
'failure
results looses
' draw
results draws
CASE ROCKHANDSCISSORGAMELB
CASE ROCKHANDSCISSORGAMELB
CASE ChooseYourMoveAndWaitAIsOneLB
'This event occurs right before a control loses focus.
'To prevent a control from losing focus, set __UI_KeepFocus = True below.
CASE ROCKHANDSCISSORGAMELB
CASE ROCKHANDSCISSORGAMELB
'When this event is fired, __UI_KeyHit will contain the code of the key hit.
'You can change it and even cancel it by making it = 0