SRL Archive - Test corner

Wanted: Sandwich Lady Testers...


WT-Fakawi

2006-04-30 19:41:45

I have written a draft SandWichLady Solver. I have a 4 second uncompressed True Color Screen Record of the SandWichLady: HERE (10 Meg)

Please run this script with the video and post me:

  • 1 Results.
  • 2. Computer Speed.
  • 3. Visual feedback. Lag?

Here is the Script:

Tthis is NOT a complete Sandwich solver, just a test of the engine!!

[php]
program SandWichLadySolver;
{.include SRL/SRL.scar}

var Baquette, Bread, ChocolateBar, Kebab, Pie, SquareSand,
TriangleSand, SquareTriangle, Solved: Integer;
SWText:array[1..7] of string;

//—————————————————————————-//

Procedure LoadSWBitMaps;
begin
Baquette := BitmapFromString(4, 6, 'AE9A62AE9A62B29E66957E' +
'36B09D64B4A067988037988037B29E669B83379B83379B83379D8' +
'5399D85399D85399D8539BFA96CBFA96CBFA96CBFA96CB4A067B6' +
'A268B6A268B6A268');

Bread := BitmapFromString(25, 1, '9F8111A889159F81119176116' +
'9550969550980680E80680E9F81119F8111886E0E645109846B0E' +
'846B0E9C7F11A28411A28411604D09604D09604D09604D097C660' +
'E7C660E7C660E7C660E');

ChocolateBar := BitmapFromString(6, 1, '4B2E1B5C39205C3920' +
'5C39206F45275C3920');

Kebab := BitmapFromString(1, 8, '564C09118E15118E156458090E' +
'84151195150E8815605409');

Pie := BitmapFromString(1, 10, 'BFB06CBFB06CC3B46FC2B36EBF' +
'B06C756D6C776F6E776F6E7971707B7272');

SquareSand := BitmapFromString(49, 1, 'z78DAA5CF310EC0' +
'201003C12F819D48D01EBEFCFF49408DA9D24CB9D28E40D4364ED' +
'3AB0259DF65181BD22A6F82E5A79DA8BAF9918FF35613F7C50494' +
'104240');

TriangleSand := BitmapFromString(1, 8, 'B29E66FBBC20F8' +
'BA1DFBBC20FBBC20FBBC20FBBD27B4A067');

SquareTriangle := BitmapFromString(1, 6, '519111519111E7AD1' +
'DFBC036FB5A4DE7301D');
end;

//—————————————————————————-//

procedure SetupSandWich;
begin
SWText[1]:='pie';
SWText[2]:='square';
SWText[3]:='bread';
SWText[4]:='triangle';
SWText[5]:='baguette';
SWText[6]:='chocolate';
SWText[7]:='kebab';
LoadSWBitMaps;
end;

//—————————————————————————-//

Function SWEngine(SWBitMap, SWDelay, SWSearchTime:integer; SWAcc:extended):Boolean;
var Dx,Dy,i,SX1, SY1, SX2, SY2:integer;
var acc:Extended;
begin
for I := 1 to 7 do
begin
case I of
1: begin
SX1 := 100; SY1 := 80; SX2 := 210; SY2:= 160;
end;
2: begin
SX1 := 210; SY1 := 80; SX2 := 320; SY2:= 160;
end;
3: begin
SX1 := 300; SY1 := 80; SX2 := 420; SY2:= 160;
end;
4: begin
SX1 := 90; SY1 := 160; SX2 := 170; SY2:= 264;
end;
5: begin
SX1 := 170; SY1 := 160; SX2 := 260; SY2:= 264;
end;
6: begin
SX1 := 260; SY1 := 160; SX2 := 352; SY2:= 264;
end;
7: begin
SX1 := 340; SY1 := 160; SX2 := 450; SY2:= 264;
end;
end;
MarkTime(Mark);
Repeat
FindDeformedBitmapToleranceIn(SWBitMap, Dx, Dy, SX1, SY1, SX2, SY2, 5, 1, True, acc);
begin
AddToReport('Slot '+IntTostr(I)+': ');
AddToReport('acc'+FloatToStr(acc));
if (acc >= SWAcc) then
begin
MMouse(Dx,Dy,0,0);
Result:=True;
Exit;
end;
end;
wait(SWDelay);
ClearReport;
until TimeFromMark(Mark)>SWSearchTime;
ClearReport;
end;
end;

//—————————————————————————-//

Function SolveSandWich:integer;
var c:integer;
begin

for c:=1 to 7 do
begin
if FindText(x,y,SWText[c],UpChars,107,260,424,300) then
begin
result:=c;
writeln('Looking for :'+SWText[c]);
if C=1 then
begin
SWEngine(Pie,50,2000,0.5);
end;
if C=2 then
begin
SWEngine(SquareSand,20,5000,0.3);
end;
if C=3 then
begin
SWEngine(Bread,50,2000,0.5);
end;
if C=4 then
begin
SWEngine(TriangleSand,100,6000,0.7);
end;
if C=5 then
begin
SWEngine(Baquette,100,4000,0.6);
end;
if C=6 then
begin
SWEngine(ChocolateBar,50,2000,0.7);
end;
if C=7 then
begin
SWEngine(Kebab,50,3000,0.5);
end;
end;
end;
end;

//—————————————————————————-//

procedure TestSandWich;
var c:integer;
begin
for c:=1 to 7 do
begin
writeln('Solving :'+SWText[c]);
if C=1 then
begin
if SWEngine(Pie,50,2000,0.5) then
begin
writeln('Solved Pie');
Solved:=Solved+1;
end
else writeln('Missed Pie');
end;
if C=2 then
begin
if SWEngine(SquareSand,20,5000,0.30) then
begin
writeln('Solved Square Sandwich');
Solved:=Solved+1;
end
else writeln('Missed Square Sandwich');
end;
if C=3 then
begin
if SWEngine(Bread,50,2000,0.5) then
begin
writeln('Solved Bread');
Solved:=Solved+1;
end
else
writeln('Missed Bread');
end;
if C=4 then
begin
if SWEngine(TriangleSand,100,6000,0.7) then
begin
writeln('Solved Triangle Sandwich');
Solved:=Solved+1;
end
else
writeln('Missed Triangle Sandwich');
end;
if C=5 then
begin
if SWEngine(Baquette,100,4000,0.6) then
begin
writeln('Solved Baquette');
Solved:=Solved+1;
end
else
writeln('Missed Baquette');
end;
if C=6 then
begin
if SWEngine(ChocolateBar,50,500,0.2) then
begin
writeln('Solved Chocolate Bar');
Solved:=Solved+1;
end
else
writeln('Missed Chocolate Bar');
end;
if C=7 then
begin
if SWEngine(Kebab,50,3000,0.5) then
begin
writeln('Solved Kebab');
Solved:=Solved+1;
end
else
writeln('Missed Kebab');
end;
end;
end;

begin
SetupSRL;
SetupSandWich;
MouseSpeed:=1;
TestSandWich;

Writeln('Solved '+IntToStr(Solved)+ ' Ladies');

// If you want to individual test the engine unblank any of these;

//SWEngine(Pie,100,3000,0.7);
//SWEngine(SquareSand,20,5000,0.30);
//SWEngine(Bread,50,2000,0.5);
//SWEngine(TriangleSand,100,6000,0.7);
//SWEngine(Baquette,100,4000,0.6);
//SWEngine(ChocolateBar,50,500,0.2);
//SWEngine(Kebab,50,3000,0.5);
//SWEngine(SquareTriangle,50,3000,0.5);

end.[/php]

Pwnd

2006-04-30 19:56:14

Erm, well.. It was, I must say, very uneventful.

Successfully compiled
Solving :pie
Missed Pie
Solving :square
Missed Square Sandwich
Solving :bread
Missed Bread
Solving :triangle
Successfully executed
I stopped it thinking it wasn't getting anywhere.
P4 2.4 ghz. 1024 mb ram.
No substantial lag, but a tiny bit right when it started running. Could have been my computer though.

WT-Fakawi

2006-04-30 20:00:27

Problem is: It is only a 4 seconds loop. The normal loop of sandwhich goodies is much longer, butI didnt want to make it a bigger file.
On a 10 second loop I get a 100% hit.

Try again please. It is the loop, I am sure of it. Ow, and try to let it run all through the end :)

timmyboy

2006-04-30 20:25:49

Successfully compiled
Solving :pie
Solved Pie
Solving :square
Missed Square Sandwich
Solving :bread
Missed Bread
Solving :triangle
Solved Triangle Sandwich
Solving :baguette
Solved Baquette
Solving :chocolate
Solved Chocolate Bar
Solving :kebab
Solved Kebab
Solved 5 Ladies
Successfully executed

A like 1 second lag, maybe less, barley anything.
AMD Athlon 512mb.
Took a really long time on the Pie and Square Sandwich, and some time on the Bread and Triangle Sandwich. Everything else was quite fast.

Dankness

2006-04-30 21:01:51

worked pretty good against a real sandwich lady for me, i think the pie mighta misclickd when it moved to it not sure.

torrent

2006-04-30 22:41:30

dam icant downlaod the video.. it says loading but it wont pop up sayign the downlaod thing..

EDIT: NVM THE DOWNLAOD LOADED AFTER 10 mins of leaving the page on

Intel pentium 2(lol i know its old.)
256 mb ram/ 3gb harddrive


Successfully compiled
Solving :pie
Solved Pie
Solving :square
Missed Square Sandwich
Solving :bread
Missed Bread
Solving :triangle
Missed Triangle Sandwich
Solving :baguette
Solved Baquette
Solving :chocolate
Solved Chocolate Bar
Solving :kebab
Missed Kebab
Solved 3 Ladies
Successfully executed

WT-Fakawi

2006-05-01 02:01:11

it needs to be fast as possible, since you have less than 15 seconds or so…

The Un-Named

2006-05-01 02:25:45

Solving :pie
Missed Pie
Solving :square
Missed Square Sandwich
Solving :bread
Missed Bread
Solving :triangle
Missed Triangle Sandwich
Solving :baguette
Missed Baquette
Solving :chocolate
Missed Chocolate Bar
Solving :kebab
Missed Kebab
Solved 0 Ladies
Successfully executed

Laggy. Sorry, Fawk!

Spky

2006-05-01 07:52:24

Worked nicely :


Successfully compiled
Solving :pie
Solved Pie
Solving :square
Missed Square Sandwich
Solving :bread
Solved Bread
Solving :triangle
Solved Triangle Sandwich
Solving :baguette
Solved Baquette
Solving :chocolate
Solved Chocolate Bar
Solving :kebab
Solved Kebab
Solved 6 Ladies
Successfully executed
2.01 GHz. 512 Mb of RAM.

No lag at all except the pie and square sandwhich, they both took much longer to solve.

ub3r |<1||3r*1337*

2006-05-01 08:09:04

Solving :pie
Missed Pie
Solving :square
Missed Square Sandwich
Solving :bread
Missed Bread
Solving :triangle
Missed Triangle Sandwich
Solving :baguette
Missed Baquette
Solving :chocolate
Missed Chocolate Bar
Solving :kebab
Missed Kebab
Solved 0 Ladies

my computer is 3.23GHz 512mb RAM with windows XP. hmm…

WT-Fakawi

2006-05-03 19:15:05

I have finished working on the SandWichlady.

The Engine is 100% now. I have speed it up to some extend that it will find the answer usually between 6-12 seconds.

Would you please try it out for me. Dowmload the video if neccesary and post small report and findings.

P.S. Sometimes it cant find the shapes. This is because the videoloop is too small. Items loop in 4-6 seconds.


[php]program SandWichLadySolver;
{.include SRL/SRL.scar}

var Baquette, Bread, ChocolateBar, Kebab, Pie, SquareSand,
TriangleSand, SquareTriangle, SandAnswer: Integer;
SandItemText:array[1..7] of string;
SandArray: array[1..7] of array [1..5] of integer;
//—————————————————————————-//

procedure LoadSandArray;
begin
SandArray[1][1]:=100; SandArray[1][2]:=80; SandArray[1][3]:=210; SandArray[1][4]:=160;
SandArray[2][1]:=210; SandArray[2][2]:=80; SandArray[2][3]:=320; SandArray[2][4]:=160;
SandArray[3][1]:=300; SandArray[3][2]:=80; SandArray[3][3]:=420; SandArray[3][4]:=160;
SandArray[4][1]:=90; SandArray[4][2]:=160; SandArray[4][3]:=170; SandArray[4][4]:=264;
SandArray[5][1]:=170; SandArray[5][2]:=160; SandArray[5][3]:=260; SandArray[5][4]:=264;
SandArray[6][1]:=260; SandArray[6][2]:=160; SandArray[6][3]:=352; SandArray[6][4]:=264;
SandArray[7][1]:=340; SandArray[7][2]:=160; SandArray[7][3]:=450; SandArray[7][4]:=264;

end;

Procedure LoadSWBitMaps;
begin
Baquette := BitmapFromString(4, 6, 'AE9A62AE9A62B29E66957E' +
'36B09D64B4A067988037988037B29E669B83379B83379B83379D8' +
'5399D85399D85399D8539BFA96CBFA96CBFA96CBFA96CB4A067B6' +
'A268B6A268B6A268');

Bread := BitmapFromString(25, 1, '9F8111A889159F81119176116' +
'9550969550980680E80680E9F81119F8111886E0E645109846B0E' +
'846B0E9C7F11A28411A28411604D09604D09604D09604D097C660' +
'E7C660E7C660E7C660E');

ChocolateBar := BitmapFromString(6, 1, '4B2E1B5C39205C3920' +
'5C39206F45275C3920');

Kebab := BitmapFromString(1, 8, '564C09118E15118E156458090E' +
'84151195150E8815605409');

Pie := BitmapFromString(1, 10, 'BFB06CBFB06CC3B46FC2B36EBF' +
'B06C756D6C776F6E776F6E7971707B7272');

SquareSand := BitmapFromString(49, 1, 'z78DAA5CF310EC0' +
'201003C12F819D48D01EBEFCFF49408DA9D24CB9D28E40D4364ED' +
'3AB0259DF65181BD22A6F82E5A79DA8BAF9918FF35613F7C50494' +
'104240');

TriangleSand := BitmapFromString(1, 8, 'B29E66FBBC20F8' +
'BA1DFBBC20FBBC20FBBC20FBBD27B4A067');

SquareTriangle := BitmapFromString(1, 6, '519111519111E7AD1' +
'DFBC036FB5A4DE7301D');
end;

//—————————————————————————-//

procedure SetupSandWich;
begin
SandItemText[1]:='pie';
SandItemText[2]:='square';
SandItemText[3]:='bread';
SandItemText[4]:='triangle';
SandItemText[5]:='baguette';
SandItemText[6]:='chocolate';
SandItemText[7]:='kebab';
LoadSWBitMaps;
LoadSandArray;
end;

//—————————————————————————-//

Function GetSandQuestion:integer;
var c:integer;
begin
for c:=1 to 7 do
begin
if FindText(x,y,SandItemText[c],UpChars,107,260,424,300) then
begin
Result:=c;
Exit;
end
end;
if Result = 0 then
begin
writeln('couldnt find question: logging out');
Logout;
end;
end;

//—————————————————————————-//

Function SearchAllbyColor(ItemColor:integer; tol:integer):Integer;
var i:integer;
begin
for i := 1 to 7 do
begin
AddToReport('Slot '+IntTostr(I)+': ');
MarkTime(Mark);
Repeat
wait(100);
if FindColorSpiralTolerance(x,y,ItemColor, SandArray[1], SandArray[2], SandArray[3], SandArray[4], tol) then
begin
result:=I;
SandArray[5]:=1; // set multimatched colors to array
AddToReport('Found '+IntTostr(I)+': ');
end
until TimeFromMark(Mark)>1000;
ClearReport;
end;
for i := 1 to 7 do
begin
if SandArray[5]=1 then writeln('Close Match in Slot:'+IntToStr(i)+'. Scanning Slots '++IntToStr(i));
end
end;

//—————————————————————————-//

Function FindSandbyShape(SWBitMap, SWDelay, SWSearchTime:integer; SWAcc:extended):Boolean;
var Dx,Dy,i:integer;
var acc:Extended;
begin
for i:= 1 to 7 do
begin
if SandArray[5]=1 then
begin
AddToReport('Slot '+IntTostr(I)+': ');
MarkTime(Mark);
Repeat
FindDeformedBitmapToleranceIn(SWBitMap, Dx, Dy, SandArray[1], SandArray[2], SandArray[3], SandArray[4], 5, 1, True, acc);
begin
AddToReport('Slot '+IntTostr(I)+': ');
AddToReport('acc'+FloatToStr(acc));
if (acc >= SWAcc) then
begin
MMouse(Dx,Dy,0,0);
Result:=True;
Exit;
end;
end;
wait(SWDelay);
ClearReport;
until TimeFromMark(Mark)>SWSearchTime;
ClearReport;
end
end;
end;

//—————————————————————————-//

Function SolveSandWich:Boolean;
begin
//SandAnswer:=GetSandQuestion;

case SandAnswer of
1: begin // pie
if SearchAllbyColor(6579308,10)<> 0 then // Pie Grey
begin
if FindSandbyShape(Pie,100,3000,0.7) then Result:=True;
end;
end;
2: begin // square
if SearchAllbyColor(1948408,20)<> 0 then // Cheese Yellow
begin
if FindSandbyShape(SquareSand,20,5000,0.30) then Result:=True;
end;
end;
3: begin // bread
if SearchAllbyColor(1147295,5)<> 0 then // Bread Light Brown
begin
if FindSandbyShape(Bread,50,2000,0.5) then Result:=True;
end;
end;
4: begin // triangle
if SearchAllbyColor(1948408,20)<> 0 then // Cheese Yellow
begin
if FindSandbyShape(TriangleSand,100,6000,0.7) then Result:=True;
end;
end;
5: begin // baguette
if SearchAllbyColor(5802396,5)<> 0 then // Common Baguette Color
begin
if FindSandbyShape(Baquette,100,4000,0.6) then Result:=True;
end;
end;
6: begin // chocolate
if SearchAllbyColor(2111836,10)<> 0 then // Chocolat Brown
begin
if FindSandbyShape(ChocolateBar,50,500,0.2) then Result:=True;
end;
end;
7: begin // kebab
if SearchAllbyColor(1414417,70)<> 0 then // Leaf Green
begin
if FindSandbyShape(Kebab,50,3000,0.5) then Result:=True;
end;
end;
end;


end;

//—————————————————————————-//

var StartMark, EndMark,c:integer;

begin
SetupSRL;
SetupSandWich;
MouseSpeed:=1;
ClearDebug;
for SandAnswer := 1 to 7 do
begin
writeln('');
writeln('Solving:'+ SandItemText[SandAnswer]);
StartMark:=GetTickCount;
if not SolveSandwich then
writeln('Couldnt solve '+SandItemText[SandAnswer])
else
begin
EndMark:=GetTickCount;
WriteLn('Solved in :'+ IntToStr((EndMark-StartMark)/1000)+' Secs');
end;
for c:=1 to 7 do SandArray[c][5]:=0; // reset array
end;

end.[/php]

Sdcit

2006-05-03 19:19:12

Hgoooooooooooooooooooooooooooooooooooooooo Fakawi :d :d :d

WT-Fakawi

2006-05-03 19:24:07

Solving:pie
Close Match in Slot:2. Scanning Slots 2
Solved in :10 Secs

Solving:square
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:7. Scanning Slots 7
Solved in :13 Secs

Solving:bread
Close Match in Slot:6. Scanning Slots 6
Solved in :8 Secs

Solving:triangle
Close Match in Slot:7. Scanning Slots 7
Solved in :9 Secs

Solving:baguette
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:4. Scanning Slots 4
Close Match in Slot:5. Scanning Slots 5
Close Match in Slot:7. Scanning Slots 7
Solved in :16 Secs

Solving:chocolate
Close Match in Slot:3. Scanning Slots 3
Solved in :8 Secs

Solving:kebab
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:4. Scanning Slots 4
Close Match in Slot:7. Scanning Slots 7
Solved in :11 Secs
Successfully executed

Ejjman

2006-05-03 19:50:44

Solving:pie
Close Match in Slot:6. Scanning Slots 6
Solved in :11 Secs

Solving:square
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:7. Scanning Slots 7
Couldnt solve square

Solving:bread
Close Match in Slot:4. Scanning Slots 4
Couldnt solve bread

Solving:triangle
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:7. Scanning Slots 7
Solved in :9 Secs

Solving:baguette
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:2. Scanning Slots 2
Close Match in Slot:4. Scanning Slots 4
Close Match in Slot:5. Scanning Slots 5
Close Match in Slot:7. Scanning Slots 7
Solved in :20 Secs

Solving:chocolate
Close Match in Slot:3. Scanning Slots 3
Solved in :8 Secs

Solving:kebab
Close Match in Slot:1. Scanning Slots 1
Close Match in Slot:2. Scanning Slots 2
Close Match in Slot:7. Scanning Slots 7
Solved in :10 Secs
Successfully executed

There was like, next to no lag
Intel pentium processor

torrent

2006-05-04 17:41:20

ill try this out on my pentium 2 comp lol.. im curious to see how this goes :)

Krazy_Meerkat

2006-05-08 06:09:58

Excellent work Fawk! FINALLY someone has used FindDeformedBitmapToleranceIn.
All praise to Fawk :D

Black Hat

2006-05-15 18:35:25

Solving :pie
Solved Pie
Solving :square
Missed Square Sandwich
Solving :bread
Solved Bread
Solving :triangle
Solved Triangle Sandwich
Solving :baguette
Solved Baquette
Solving :chocolate
Solved Chocolate Bar
Solving :kebab
Solved Kebab
Solved 6 Ladies
Successfully executed

AMD 2.8 X 2 (Duel Core) which is 5.6 and system mem is 2gp X 2 (Duel Channel) which is 4gp

Cheesehunk

2006-05-15 19:05:39

From: Dreadsthegreat
Solving :pie
Solved Pie
Solving :square
Missed Square Sandwich
Solving :bread
Solved Bread
Solving :triangle
Solved Triangle Sandwich
Solving :baguette
Solved Baquette
Solving :chocolate
Solved Chocolate Bar
Solving :kebab
Solved Kebab
Solved 6 Ladies
Successfully executed

AMD 2.8 X 2 (Duel Core) which is 5.6 and system mem is 2gp X 2 (Duel Channel) which is 4gp


It's already been solved..:p

Thanks for the help though..