none
would it be posible to run an algorythm in string shape for this brute force algorythm generator? RRS feed

  • Question

  • objective= Math.GetRandomNumber(1000000)
    For i=100 To 1000000
      For j=1 To text.getlength(i)
        number=i
        digit= Text.GetSubText(number,j,1)
        If digit=9 Then
          digit="*"
        ElseIf digit="0" then
          digit="+"
        EndIf
        
        numero= Text.Append(numero,digit)
      EndFor
      algorythm=numero
      numero=""
      If Text.EndsWith(algorythm,"*")Or Text.EndsWith(algorythm,"+") Then
        algorythm=Text.Append(algorythm,2)
      EndIf
       If Text.StartsWith(algorythm,"*")Or Text.StartsWith(algorythm,"+") Then
        algorythm=Text.Append(2,algorythm)
      EndIf 
      TextWindow.WriteLine(algorythm)
      Program.Delay(200)
      
      'Execute string algorythm variable that i dont know how
     'compare the result with the objective number and break from for loop if equal 
      
      
    EndFor  
    Tuesday, September 4, 2018 5:03 PM

Answers

  • Hi,

    You algorythm works, although slow.  Youn break of of the loop by setting i to 1000000.

      If (algorythm = objective) Then
        i = 1000000
      EndIf
    However, this is a lot of work and very slow and may not find any result if objective has 0 or 9 in it.  If you can describe what the objective is there may be a faster way.


    Tuesday, September 4, 2018 6:05 PM
    Moderator