MylesMadness
2009-06-26 05:20:14
{.include srl/srl.scar}
type
TPostion = record
TPA: TPointArray;
Colors: TIntegerArray;
end;
Procedure RemoveTPointFromArray(Index:Integer; Var Arr:TPointArray);
begin
tSwap(Arr[Index], Arr[High(Arr)]);
SetArrayLength(Arr, High(Arr));
end;
Procedure RemoveIntFromArray(Index:Integer; Var Arr:TIntegerArray);
begin
Swap(Arr[Index], Arr[High(Arr)]);
SetArrayLength(Arr, High(Arr));
end;
Procedure FilterUnWantedPoints(var Stuff:TPostion);
var
Skip:TIntegerArray;
I:Integer;
begin
Skip:= [65536, 16711422, 12961221, 14869218, 16777215, 15527148, 195836, 56797, 60909, 52428,
13816530, 982782, 1310462, 62965, 2105598, 395004, 789758, 3553023, 217, 188, 241,
206, 233, 64768, 58880, 51456, 49152, 44800, 61440, 16215571, 9716750, 13129742];
For I:=0 to high(Stuff.colors)do
If InIntArray(Skip, Stuff.Colors[i]) then
begin
RemoveTPointFromArray(I, Stuff.TPA);
RemoveIntFromArray(I, Stuff.Colors);
end;
end;
Function MakePostionFinder:String;
var
I:Integer;
Postion:TPostion;
begin
FindColorsTolerance(Postion.TPA, 0, MMX1, MMY1, MMX2, MMY2, 421);
Postion.TPA:=RemoveDistTPointArray(MMCX, MMCY, 79, Postion.TPA, True);
Postion.Colors:=GetColors(Postion.TPA);
FilterUnWantedPoints(Postion);
Result:='''';
For I:=0 to high(Postion.TPA) do
begin
If I mod 40 = 0 then
Result:=Result+IntToStr(Postion.TPA[i].x)+','+IntToStr(Postion.TPA[i].y)+','+IntToStr(Postion.Colors[i])+'|';
If I mod 240 = 0 then
Result:=Result+''' +'+#13+' ''';
end;
result:=Result+'''';
end;
Function StringToPostion(Loc:String):TPostion;
var
Strs, Strs2:TStringArray;
I:Integer;
begin
Strs:=Explode('|', Loc);
SetArrayLength(Result.Colors, High(Strs)+1);
SetArrayLength(Result.TPA, High(Strs)+1);
For I:=0 to high(Strs)do
begin
Strs2:=Explode(',', Strs[i]);
Result.Colors[i]:=StrToInt(Strs2[2]);
Result.TPA[i]:=Point(StrToInt(Strs2[0]), StrToInt(Strs2[1]))
end;
end;
Function AtPos(Loc:String):Boolean;
var
MP: TDTMPointDef;
SP: array of TDTMPointDef;
DDTM: TDTM;
I:Integer;
P:TPostion;
Dtm, x, y:Integer;
begin
P:=StringToPostion(Loc);
MP.x := MMCX;
MP.y := MMCY;
MP.areasize := 3;
MP.color := GetColor(MMCX, MMCY);
MP.tolerance := 50;
SetArrayLength(SP, High(P.TPA)+1);
for I := 0 to High(P.TPA) do
begin
SP[i].x := P.TPA[i].x;
SP[i].y := P.TPA[i].y;
SP[i].areasize := 3;
SP[i].areashape := 0;
SP[i].color := P.Colors[i];
SP[i].tolerance := 0;
end;
DDTM.MainPoint :=MP;
DDTM.SubPoints :=SP;
DTM:=AddDTM(DDTM);
result:= DTMRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2);
FreeDTM(DTM);
end;Basicly you run
Writeln(MakePostionFinder); then you do S:='TheCrapYouGotAbove';
If AtPos(S) then
Writeln('yays')
else
Writeln('boos');Also it seems that symbols make it not work. If anyone has ideas to fix this please post