Mast3rpyr0 Posted June 7, 2008 Share Posted June 7, 2008 Simple 50 line app to generate 1000 numbers for each of the 3 numbers in the Pick 3. Which ever number, 0-9, is picked the most is set as one of the digits. expandcollapse popup#include <GuiConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "_exit") Global $firstPick, $secondPick, $thirdPick, $arr[10] $gui = GUICreate("Pick 3 Picker", 300, 200) $goBtn = GUICtrlCreateButton(" Generate ", 100, 25, 100) $first = GUICtrlCreateLabel("1 - ", 25, 80) $second = GUICtrlCreateLabel("2 - ", 25, 120) $third = GUICtrlCreateLabel("3 - ", 25, 160) GUISetState(@SW_SHOW, $gui) While 1 $gMsg = GUIGetMsg() Switch $gMsg Case $GUI_EVENT_CLOSE _exit() Case $goBtn $firstPick = genDigits() $secondPick = genDigits() $thirdPick = genDigits() _updateCtrls() EndSwitch WEnd Func genDigits() For $x = 1 To 1000 Step 1 $temp = Random(0, 9, 1) $arr[$temp] = $arr[$temp] + 1 Next $y = _ArrayMaxIndex($arr) Global $arr[10] Return $y EndFunc Func _updateCtrls() GUICtrlSetData($first, "1 - " & $firstPick) GUICtrlSetData($second, "2 - " & $secondPick) GUICtrlSetData($third, "3 - " & $thirdPick) EndFunc Func _exit() exit EndFunc My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
martin Posted June 7, 2008 Share Posted June 7, 2008 Simple 50 line app to generate 1000 numbers for each of the 3 numbers in the Pick 3. Which ever number, 0-9, is picked the most is set as one of the digits. expandcollapse popup#include <GuiConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "_exit") Global $firstPick, $secondPick, $thirdPick, $arr[10] $gui = GUICreate("Pick 3 Picker", 300, 200) $goBtn = GUICtrlCreateButton(" Generate ", 100, 25, 100) $first = GUICtrlCreateLabel("1 - ", 25, 80) $second = GUICtrlCreateLabel("2 - ", 25, 120) $third = GUICtrlCreateLabel("3 - ", 25, 160) GUISetState(@SW_SHOW, $gui) While 1 $gMsg = GUIGetMsg() Switch $gMsg Case $GUI_EVENT_CLOSE _exit() Case $goBtn $firstPick = genDigits() $secondPick = genDigits() $thirdPick = genDigits() _updateCtrls() EndSwitch WEnd Func genDigits() For $x = 1 To 1000 Step 1 $temp = Random(0, 9, 1) $arr[$temp] = $arr[$temp] + 1 Next $y = _ArrayMaxIndex($arr) Global $arr[10] Return $y EndFunc Func _updateCtrls() GUICtrlSetData($first, "1 - " & $firstPick) GUICtrlSetData($second, "2 - " & $secondPick) GUICtrlSetData($third, "3 - " & $thirdPick) EndFunc Func _exit() exit EndFunc Not a clue what it's for What is the purpose of the function genDigits? It will be biased towards lower numbers and so will not be so random as Random(0, 9, 1). For example, if the scores for digits selected after 1000 selections are equal for one or more digit then _ArrayMaxIndex($arr) will return the first one it finds. Looks to me like Random(0, 9, 1) would be better than genDigits(). #include <GuiConstants.au3> HotKeySet("{ESC}", "_exit") Global $firstPick, $secondPick, $thirdPick, $arr[10] $gui = GUICreate("Pick 3 Picker", 300, 200) $goBtn = GUICtrlCreateButton(" Generate ", 100, 25, 100) $first = GUICtrlCreateLabel("1 - ", 25, 80) $second = GUICtrlCreateLabel("2 - ", 25, 120) $third = GUICtrlCreateLabel("3 - ", 25, 160) GUISetState(@SW_SHOW, $gui) While 1 $gMsg = GUIGetMsg() Switch $gMsg Case $GUI_EVENT_CLOSE _exit() Case $goBtn _updateCtrls() EndSwitch WEnd Func _updateCtrls() GUICtrlSetData($first, "1 - " & Random(0,9,1)) GUICtrlSetData($second, "2 - " & Random(0,9,1)) GUICtrlSetData($third, "3 - " & Random(0,9,1)) EndFunc Func _exit() exit EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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