Baku Posted July 16, 2005 Share Posted July 16, 2005 (edited) I think this is a good idea to introduce newcommers with the random-function. expandcollapse popup#include <GuiConstants.au3> GUICreate("WhiteJoe", 245, 65, (@DesktopWidth - 245) / 2, (@DesktopHeight - 105) / 2, $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_EX_STATICEDGE) HotKeySet("{ESC}", "_exit") Func _exit() Exit EndFunc ;==>_exit $points = "0" $Button_3 = GUICtrlCreateButton("Take", 10, 10, 110, 20) $Button_4 = GUICtrlCreateButton("Stop", 130, 10, 100, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_3 get() Case $msg = $Button_4 computer() Case Else ;;; EndSelect WEnd Exit Func get() $add = Random(1, 11, 1) $points = $add + $points If $points > 21 Then $msgbox = MsgBox(4 + 32, "You loose!", $points & " Points. - " & "You loose!" & @LF & "New game?") Select Case $msgbox = 7 Exit Case Else $points = "0" EndSelect $points = "0" ElseIf $points = 1 Then MsgBox(64, "Points", "1 Point") Else MsgBox(64, "Points", $points & " points") EndIf Return $points EndFunc ;==>get Func computer() $compoints = Random(14, 24, 1) If $compoints > $points And $compoints < 22 Then $msgbox = MsgBox(4 + 32, "Computer wins!", "Computer wins with " & $compoints & " points. (You have " & $points & " points)" & @LF & "New game?") Select Case $msgbox = 7 Exit Case Else $punkte = "0" EndSelect ElseIf $compoints = $points Then $msglos = MsgBox(4 + 32, "Draw!", "Draw with " & $compoints & " points." & @LF & "New game?") Select Case $msglos = 7 Exit Case Else $points = "0" EndSelect Else $msgwin = MsgBox(4 + 32, "You win!", "You win with " & $points & " points. (Computer has " & $compoints & " points)" & @LF & "New game?") Select Case $msgwin = 7 Exit Case Else $points = "0" EndSelect EndIf EndFunc ;==>computer Edited July 17, 2005 by Baku Link to comment Share on other sites More sharing options...
LxP Posted July 17, 2005 Share Posted July 17, 2005 Small bug:You win with 18 points. (Computer has 23 points.)New game?[Yes]One more / Stop[One more]20 points Link to comment Share on other sites More sharing options...
Baku Posted July 17, 2005 Author Share Posted July 17, 2005 Whoops Thank you, fixed that, i forgot to reset the points Link to comment Share on other sites More sharing options...
LxP Posted July 17, 2005 Share Posted July 17, 2005 Small bug:You win with 21 points. (Computer has 18 points.)New game?[No]One more / StopI think the script should be exiting at this point. Link to comment Share on other sites More sharing options...
Baku Posted July 17, 2005 Author Share Posted July 17, 2005 I guess i figured it out now ;D I'm gonna try add a static scoretable soon, if i find the command for updating labels ;D Link to comment Share on other sites More sharing options...
LxP Posted July 17, 2005 Share Posted July 17, 2005 Good luck with that! It will be great to see how far this gets. If you're interested in working on a GUI then look for cards.dll somewhere in your Windows folder tree -- it contains bitmaps of the cards and some nice backs too. Link to comment Share on other sites More sharing options...
busysignal Posted July 19, 2005 Share Posted July 19, 2005 I guess i figured it out now ;DI'm gonna try add a static scoretable soon, if i find the command for updating labels ;D<{POST_SNAPBACK}>Is the code in you first post have all the fixes? Just wondering...Cheers.. Link to comment Share on other sites More sharing options...
Baku Posted July 19, 2005 Author Share Posted July 19, 2005 yup, the first post has no known bugs ;D Link to comment Share on other sites More sharing options...
busysignal Posted July 21, 2005 Share Posted July 21, 2005 yup, the first post has no known bugs ;D<{POST_SNAPBACK}>Thanks for the update..Cheers.. Link to comment Share on other sites More sharing options...
Proph Posted July 21, 2005 Share Posted July 21, 2005 You win with 17 points. (Computer has 15 points)New game?I think dealer is supposed to hit on anything under 17? Link to comment Share on other sites More sharing options...
busysignal Posted July 22, 2005 Share Posted July 22, 2005 I think dealer is supposed to hit on anything under 17?<{POST_SNAPBACK}>That is correct. Cheers.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now