SRL Archive - News and General

WoodCutting Competion Results


SKy Scripter

2007-10-22 16:51:29

WoodCutting Results!



Lorax


Techinque - I Really liked how he had one color for every tree. Also he found the middle point of every tree. (22/ 25)
Creativity - Not much creativity just average but good. :) (15/ 20)
Speed - I really like the speed. it found every tree in about 30-40.msc on my computer ;) (25/ 25)
Accuracy - The accuracy was very good except. I didnt like how it would return more then one point on the same tree. also it moves the mouse on other things. like "Bushes" (18/ 25)
Debugging - The Debugging was low.. when i mean debugging i want to see pictures and ect.. :p (10/ 20)

Total (90/115)



program New;

{.include SRL/SRL.scar}

const
ShowMode = True; // If true, it won't stop, it will just show what it found.
TreeSizeTol = 60; // Maximum size of a tree.

var
x, y: Integer;

function FindMiddle(var Tree: TPoint): Boolean;
var
b: TPointArray;
C: TIntegerArray;
begin
Result := False;

FindColorsTolerance(b, 2186836, Tree.x - 30, Tree.y - 30, Tree.x + 30, Tree.y + 30, 15); // Looks for 'normal' green points around black points

try
c := GetColors(b);
except
Writeln('GetColors failed');
end;

ClearSameIntegersAndTPA(C, b); // Shortens arrays by deleting duplicates
Writeln(IntToStr(Length(C)) + ' different tree colors');

if ( Length(C) > 15 ) then // Considered a tree. Could perhaps be lowered.
begin

Result := True;
Tree := MiddleTPA(b); // Return the middle of the TPA.

end;
end;

function FindTree(var x, y: Integer; SizeTolerance: Integer): Boolean;
var
i: Integer;
b: TPointArray;
t: TPointArrayArray;
Tree: TPoint;
begin
Result := False;

FindColorsSpiralTolerance(MSCX, MSCY, b, 1536, MSX1, MSY1, MSX2, MSY2, 10); // Every tree has black-like points. This will search for them.

if ( Length(b) = 0 ) then
begin
Writeln('No black dots'); // Thus no trees.
Exit;
end;

t := SplitTPAex(b, SizeTolerance); // Divides the TPA into smaller groups with longer distances.

for i := 0 to High(t) do
begin
if ( Length(t[i]) > 5 ) then
begin
Tree := MiddleTPA(t[i]); // Gets center of TPA

if FindMiddle(Tree) then
begin
MMouse(Tree.x, Tree.y, 5, 5);
Wait(100 + Random(100));

if IsUpTextMultiCustom(['p down ', 'Chop d', 'hop do']) then
begin

GetMousePos(Tree.x, Tree.y);
if not(ShowMode)then
Break;

end;
end;
end;
end;
end;

begin
SetupSRL;
if(FindTree(x, y, TreeSizeTol))then
Writeln('Tree finding succeeded.');
end.

Santa_Clause


Techinque - I Liked how you used muilti colors then made them all one tpointarray. Then you found the middle. (18/ 25)
Creativity - There was some creativity making muilti colors one tpointarray, nothing special really though. (15/ 20)
Speed - Speed wasnt as fast.. took awhile.. (17 / 25)
Accuracy - it Was Accurate and found a the tree everytime. however, it would skip a tree or two somtimes. (20/ 25)
Debugging - it debugged through SCAR However, i couldnt see much of what was going on.. also i wanted to actually see a canvas display or somthing… (15 / 20)

Total (85/115)



{.include srl/srl.scar}

function FindItem(Item : string; ItemColours : TIntegerArray) : Boolean;
var
DoubleArray : Array Of Array Of TPoint;
SingleArray : Array Of TPoint;
x, y : integer;
I, J, K : integer;
ItemText : string;
MiddlePoint : TPoint;
begin
Disguise('Fixing Uptext');
ItemText := LowerCase(Item);
Delete(ItemText, 1, 1);
for I := 0 to 1 do
begin
Wait(2);
Disguise('Finding Colors ' + IntToStr(I));
for K := 0 to GetArrayLength(ItemColours) - 1 do
FindColorsSpiralTolerance(MICX, MICY, SingleArray, ItemColours[K], MSX1, MSY1, MSX2, MSY2, I); //Finds all ItemColours with a tolerance of 0 to 10, and adds them to SingleArray
Disguise('Re-arranging Array');
SingleArray := ReArrangeAndShortenArray(SingleArray, 10);
Disguise('Splitting TPA');
DoubleArray := SplitTPA(SingleArray);//Finds all clusters of points in SingleArray that were found together in groups of 5 pixels.
WriteLn(IntToStr(length(DoubleArray)));
for J := 0 to length(DoubleArray) - 1 do
begin
Wait(2);
Disguise('Finding Middle Point');
MiddlePoint := MiddleTPA(DoubleArray[J]);//Finds the middle point of TPoints in DoubleArray.
MMouse(MiddlePoint.X, MiddlePoint.Y, 2, 2);
Wait(5);
if IsUpText(ItemText) then
begin
GetMousePos(X, Y);
WriteLn(IntToStr(GetColor(X, Y)));
// Mouse(X, Y, 0, 0, False);
// ClickOption(ItemText, 1);
Result := True;
WriteLn(BoolToStr(Result));
//Exit;
end;
end;
end;
end;
var m, z : Integer;
begin
MarkTime(Z);
SetupSRL;
ClearDebug;
Disguise('SCAR');
ActivateClient;
Wait(2000);
M := TimeFromMark(Z);
FindItem('hop', [2245949, 3897966, 4558465]);
WriteLn(IntToStr(GetTimeRunning - M));
Disguise('Finished');
end.




1st Place goes to : Lorax

Congratz, Lorax

Harry

2007-10-22 16:52:36

What did Lorax win? :)

R0b0t1

2007-10-22 17:11:35

His name in a thread :p.

Bobarkinator

2007-10-22 19:36:56

Good job Lorax *surprise, surprise*

IronTeapot

2007-10-23 00:46:22

I really need to learn me some TPA stuff… it seems amazing for finding anything!

Lorax

2007-10-23 03:02:41

please note that by raising the BlackDot minimum count from 5 to 10 it will not find any bushes.. however it will neither find the smallest trees..
A simple check of Dist to previous points would allow me to not find multiple points in a tree :D

However I won 500k, but I didn't want them.. so he can use them for future competitions..

BobboHobbo

2007-10-23 07:12:00

Gratz Lorax, Bl santa :)

GoF

2007-10-23 07:54:35

Congrats :D Seems 1337.

Lorax

2007-10-23 15:59:46

Note that the ClearSameIntegersAndTPA is a function I made for the wizzyplugin which isn't in public version yet, if you need it just ask..

Santa_Clause

2007-10-24 02:23:04

What the?! Only us two joined? I thought there'd be like 10-15 people…oh well.

I didn't do that bad…just 5 points lower than a developer :p

You know, I actually thought I'd suck! Anyone want to tell me how to increase speed? It's something I have to work on fixing.

Lorax

2007-10-24 15:40:43

Mine is 40ms..

SKy Scripter

2007-10-24 16:27:47

From: Lorax
Mine is 40ms..


actually 30-40 .msc ;)

Santa_Clause

2007-10-25 04:19:38

I was saying that mine was slow and I need to improve it…?

n3ss3s

2007-10-25 04:24:26

SKY!!! You didnt tell when the deadline is so I didnt send you mine! :(

EDIT: aww, fucking shit it is there ;(

I guess I'll post mine anyways :(


Function FindAllTreesIn(x1, y1, x2, y2: Integer): TPointArray;
Var
HolyShitA3DArray: Array of Array of TPointArray;
Var
TPAA: Array of TPointArray;
Var
FinalTPA: TPointArray;
Var
I, C, CTS, M: Integer;
Var
O: TIntegerArray;
Var
Q: Integer;
Var
TP: TPoint;
Begin
O := [1850674, 1857871, 1995625];
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetArrayLength(TPAA, 3);
For C := 0 To 2 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPAA[c], O[c], x1, y1, x2, y2, 5);
End;
SetArrayLength(HolyShitA3DArray, 3);
For I := 0 To 2 Do
Begin
HolyShitA3DArray[i] := TPAToATPA(TPAA[i], 100);
End;
For C := 0 To 2 Do
Begin
For I := 0 To 2 Do
Begin
Try
FinalTPA := CombineTPA(FinalTPA, HolyShitA3DArray[c][i]);
Except
Writeln('Shit happens');
End;
End;
End;
TPAA := TPAToATPA(FinalTPA, 75);
Q := GetArrayLength(TPAA);
SetArrayLength(Result, Q);
For C := 0 To Q - 1 Do
Begin
Result[c] := MiddleTPA(TPAA[c]);
End;
TP := IntToPoint(MSCX, MSCY);
SortTPAFrom(Result, TP);
ColorToleranceSpeed(CTS);
End;
I wonder how much points I would've gotten…

Well gratz to Lorax, though there wasnt too many people..

Mine finds all trees on ms - their middles fast and 100% accurate..

EDIT: + mine doesnt need uptext checking! Aww SKy can I ask a phav0r? If you could, it'd be nice if you could rate mine, so I wont be thinking about it all nights..

EDIT EDIT:

However I won 500k, but I didn't want them.. so he can use them for future competitions..
new object finding competition!

Lorax

2007-10-25 16:20:23

n3ss3s - your script needs comments..
and debugging.

SKy Scripter

2007-10-25 17:24:26

Ill Make another competion, ony if a few more people join XD

Santa_Clause

2007-10-25 18:00:44

He also has alot more begins and ends than he needs.

R0b0t1

2007-10-25 21:42:12

Santa, you might want to utilize plugins :) . Or ask n3ss3s – I hate explaining.


SKy, if theres another one, can I use a plugin if I so desire?


EDIT: n3ss3s, if you didn't know, for statements are like "if" statements. If there is one argument, you don't need a begin/end clause.

SKy Scripter

2007-10-25 23:48:37

Plugins will be allowed in the next one :D, only if i get more people! :p

Eicca

2007-10-26 01:00:43

Hehe gratz! :)

n3ss3s

2007-10-26 02:54:19

Ooookaaay everybody get your asses competing!

About comments - shit, I copied the wrong one, I had one in the file which contains only the finder, comments etc, and then another in a powercutter file :p

Meh anyways waiting for the new one :)