Hallo, ich habe gerade etwas probleme mit dem erstellen eines Bots in c#.
Evt kann jemand den Fehler finden, ich komme jdenfalls ums verrecken auch nach 1h nachrechnen nicht drauf. Als belohnung gibts nen 0,10€ Psc rest und 4 Dota2- invites.
Code:
Code:
private void AddChangers()
{
// Abstand zweierpunkte d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)²}
int length = 0;
length = (int)Math.Sqrt((Math.Pow(Start.X - Stop.X,2)) + (Math.Pow(Start.Y - Stop.Y,2))); // Geht 100% /debugged
Point tempStart = Start;
Point tempStop = Stop;
AllowedToSet = true;
int m = (Start.Y - Stop.Y) / (Start.X - Stop.X);
int b = Start.Y - m * Start.X;
while ((length -= 50) > +50)
{
//// Berchnung der neuen Punkte y = m*x+b
int ynew = ((m * (Start.X += 10)) + b);
Stop.X = Start.X;
Stop.Y = ynew;
Start = tempStart;
scanarea();
SetNewConnector((object)Stop, null);
Start.X += 10;
tempStart = Stop;
}
Start = Start;
Stop = tempStop;
scanarea();
AllowedToSet = false;
}
Der Code berchnet zuerst den Abstand zwischen 2 Koordinaten und soll dann die berechnete Länge in 50er Schritten abfahren. Dabei soll jedesmal die Methode "scanarea" ausgeführt werden.
Mfg