![]() |
|
[Project]Math Bruteforcer - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: [Project]Math Bruteforcer (/Thread-Project-Math-Bruteforcer) |
[Project]Math Bruteforcer - 1llusion - 02-09-2011 Hi, so, I made this math bruteforcer. Its usage is: You write in a mathematical problem. Usually function. Also you type what it equals and it will count variable X. Code: Code: Public Class Form1
Dim arrText() As String
#Region "Functions"
Function check(ByVal result) 'Checking the result
Select Case result
Case result = NumericUpDown1.Value = False 'result isn't same as our chosen result
Return False
Case result = NumericUpDown1.Value = True 'result is same as our chosen result
Return True
End Select
End Function
Function count() 'counting the X
Dim result As Double
Dim MathStr As String = String.Empty
Dim x As Integer
For x = 0 To 1000 'Counting with numbers 0 to 1000
For i As Integer = 0 To UBound(arrText)
MathStr &= arrText(i) & If(i < UBound(arrText), "x", "")
Next
result = New DataTable().Compute(MathStr, Nothing) 'Counting
Select Case check(result) 'checking
Case True 'if the result equals our chosen result
Return x 'returns the lucky number
Exit Function
Case Else
End Select
Next
Return True
End Function
#End Region
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
arrText = TextBox1.Text.Split("x")
CheckForIllegalCrossThreadCalls = False
Dim t As New Threading.Thread(AddressOf count)
t.IsBackground = True
t.Start()
ListBox1.Items.Add(count())
End Sub
End ClassBetter for reading: http://pastebin.com/Hj6MsEPt So, the source has a problem, somehow it doesn't return what we want. Thats quite a problem since its the only purpose of the app... :8-s: Anyway I'm working on it and any help is accepted ![]() Enjoy! EDIT: Okay, updated the code with what Coder-san said Thanks a lot EDIT2: New error occured: "Cannot find column [x]" Now I'm completely lost, so sorry guyz Doesn't look like I was chosen to finish this ![]() Creds to: Coder-san RE: [Project]Math Bruteforcer - Coder-san - 02-11-2011 I exchanged cases by chance in the code I gave you. :p This will add "x" until it's the last number. Code: If(i < UBound(arrText),"x" ,"")RE: [Project]Math Bruteforcer - 1llusion - 02-11-2011 (02-11-2011, 01:00 PM)Coder-san Wrote: I exchanged cases by chance in the code I gave you. :p oh Well now I don't understand it ![]() I though it was adding var X until no "x" was found ![]() So this adds the var X as long as "x" is there right? ![]() Thanks!!! ![]() EDIT: Updated above post
|