Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/26/2014 in all areas

  1. Or you could use the RegWrite
    1 point
  2. Welcome to autoit forums......We are here to help you not coding for you......at least i am not going to coding any thing for you. Try something that you want then i shall help you. if i could...................
    1 point
  3. Melba23

    Lottery - Challenge

    jguinch, I am not sure the word "readable" is entirely correct in the post above! M23
    1 point
  4. Melba23

    Removed

    Myicq, Please read this announcement. Code removed - thread locked. M23
    1 point
  5. jguinch

    Lottery - Challenge

    Hey hey ! Just one line ! RegExp not already optimized.. Local $tab[] = [ ",01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49", StringMid($tab[0], Random(0, 48, 1) * 3 + 2, 2), StringReplace($tab[0], "," & $tab[1], ""), StringMid($tab[2], Random(0, 47, 1) * 3 + 2, 2), StringReplace($tab[2], "," & $tab[3], ""), StringMid($tab[4], Random(0, 46, 1) * 3 + 2, 2), StringReplace($tab[4], "," & $tab[5], ""), StringMid($tab[6], Random(0, 45, 1) * 3 + 2, 2), StringReplace($tab[6], "," & $tab[7], ""), StringMid($tab[8], Random(0, 44, 1) * 3 + 2, 2), StringReplace($tab[8], "," & $tab[9], ""), StringMid($tab[10], Random(0, 43, 1) * 3 + 2, 2), StringReplace($tab[10], "," & $tab[11], ""), StringMid($tab[12], Random(0, 42, 1) * 3 + 2, 2), Number($tab[1]) & "," & Number($tab[3]) & "," & Number($tab[5]) & "," & Number($tab[7]) & "," & Number($tab[9]) & "," & Number($tab[11]) & "," & Number($tab[13]), InputBox("Lottery", "Enter your numbers from 1 to 49, separates by a comma (ex : 1,5,10,37,15,43,2)", "1,2,3,4,5,6,7", "", 500, 150) , ( StringRegExp($tab[15], "^(([1-9]|([1-4]\d)),){6}([1-9]|([1-4]\d))$") ) ? 1 : (0 * MsgBox(16, "Lottery", "You must enter 7 numbers, separate by a comma")) , (($tab[16] = 0) ? 0 : (((UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){0}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){1}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){2}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){3}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){4}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){5}([^,]+).*", ",$1,"), 3 ) ) + UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){6}([^,]+).*", ",$1,"), 3 ) ) ) = 7 ) ? 1 : 0 * MsgBox(16, "Lottery", "You cannot choose a same number more than one time") ) ) , StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){0}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){1}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){2}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){3}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){4}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){5}([^,]+).*", ",$1,") ) + StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){6}([^,]+).*", ",$1,") ) , (( $tab[17] = 0 )? 0 : MsgBox(0, "", "You " & (( $tab[18] = 7 ) ? "win" : "loose" ) & @CRLF & @CRLF & "Computer choice : " & $tab[14] & @CRLF & "Your choice : " & $tab[15] & @CRLF & @CRLF & "You found " & $tab[18] & " good numbers" ) ) ] Here is a readable code : Local $tab[] = [ _ ",01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49", _ StringMid($tab[0], Random(0, 48, 1) * 3 + 2, 2), _ StringReplace($tab[0], "," & $tab[1], ""), _ StringMid($tab[2], Random(0, 47, 1) * 3 + 2, 2), _ StringReplace($tab[2], "," & $tab[3], ""), _ StringMid($tab[4], Random(0, 46, 1) * 3 + 2, 2), _ StringReplace($tab[4], "," & $tab[5], ""), _ StringMid($tab[6], Random(0, 45, 1) * 3 + 2, 2), _ StringReplace($tab[6], "," & $tab[7], ""), _ StringMid($tab[8], Random(0, 44, 1) * 3 + 2, 2), _ StringReplace($tab[8], "," & $tab[9], ""), _ StringMid($tab[10], Random(0, 43, 1) * 3 + 2, 2), _ StringReplace($tab[10], "," & $tab[11], ""), _ StringMid($tab[12], Random(0, 42, 1) * 3 + 2, 2), _ Number($tab[1]) & "," & Number($tab[3]) & "," & Number($tab[5]) & "," & Number($tab[7]) & "," & Number($tab[9]) & "," & Number($tab[11]) & "," & Number($tab[13]), _ InputBox("Lottery", "Enter your numbers from 1 to 49, separates by a comma (ex : 1,5,10,37,15,43,2)", "1,2,3,4,5,6,7", "", 500, 150) , _ ( StringRegExp($tab[15], "^(([1-9]|([1-4]\d)),){6}([1-9]|([1-4]\d))$") ) ? 1 : (0 * MsgBox(16, "Lottery", "You must enter 7 numbers, separate by a comma")) , _ (($tab[16] = 0) ? 0 : _ (((UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){0}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){1}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){2}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){3}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){4}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){5}([^,]+).*", ",$1,"), 3 ) ) + _ UBound( StringRegExp( "," & StringReplace($tab[15], ",", ",,") & "," , StringRegExpReplace($tab[15] , "(?:[^,]+,){6}([^,]+).*", ",$1,"), 3 ) ) ) = 7 ) ? 1 : 0 * MsgBox(16, "Lottery", "You cannot choose a same number more than one time") ) ) , _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){0}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){1}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){2}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){3}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){4}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){5}([^,]+).*", ",$1,") ) + _ StringRegExp("," & $tab[14] & ",", StringRegExpReplace($tab[15] , "(?:[^,]+,){6}([^,]+).*", ",$1,") ) , _ (( $tab[17] = 0 )? 0 : _ MsgBox(0, "", "You " & (( $tab[18] = 7 ) ? "win" : "loose" ) & @CRLF & @CRLF & "Computer choice : " & $tab[14] & @CRLF & "Your choice : " & $tab[15] & @CRLF & @CRLF & "You found " & $tab[18] & " good numbers" ) _ ) ]
    1 point
  6. That video seems familiar When you start creating regular expressions, debug them using http://regex101.com/
    1 point
×
×
  • Create New...