FastFindMonster by n3ss3s
This time we find any monster, found hair dresser in 15ms..
MainC = maincolor of the monster, hair dresser's would be pink, then colors, fill there like [onecolor, second, etc] and Mx and My are the ones the coords return to if results true.
SCAR Code:
Function FastFindMonster(MainC: Integer; Colors: TIntegerArray; Var Mx, My: Integer): Boolean;
Var
I, C, CTS, L, X, Y, T: Integer;
Var
TPAA: TPointArrayArray;
Var
FinalTPA: TPointArray;
Begin
T := GetSystemTime;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
L := GetArrayLength(Colors);
SetArrayLength(TPAA, L);
If(FindColorTolerance(X, Y, MainC, MSX1, MSY1, MSX2, MSY2, 10))Then
begin
For I := 0 To L - 1 Do
Begin
FindColorsTolerance(TPAA[i], Colors[i], X - 15, Y - 15, X + 15, Y + 15, 10);
If(GetArrayLength(TPAA[i]) <= 0)Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;
End;
SetArrayLength(FinalTPA, L);
For C := 0 To L - 1 Do
Begin
FinalTPA[c] := MiddleTPA(TPAA[c]);
End;
MiddleTPAEx(FinalTPA, Mx, My);
Result := True;
End;
Writeln(IntToStr(GetSystemTime - T));
ColorToleranceSpeed(CTS);
End;
As usual free to use if credits to me..