Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sat Nov 23, 2024 9:54 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: bad tetris bot
Thanked: 0 time(s)  Unread post Posted: Sat Feb 18, 2012 11:29 am 
Silver Contributor
Silver Contributor



Joined: Fri May 13, 2011 6:57 am
Posts: 174
Been thanked: 6 time(s)
Has thanked: 0 time(s)
Contribution Points: 3266
Code:
 begin
     // Mouse.Click at pixel pattern("bigXbutton", "0", "yes", "Left")
     Macro.Pause("1000")
     Color.Find pixel pattern("{tl}", "0", "no", "xo", "yo")
     Color.Find pixel pattern("{br}", "0", "no", "xf", "yf")
     Variable.Calculate difference (Math)("xf", "xo", "width")
     Variable.Calculate difference (Math)("yf", "yo", "height")
     Color.Limit area of interest to coordinates("{xo}", "{yo}", "{width}", "{height}")
     Color.Wait for pixel pattern to appear("{start}", "0")
     Mouse.Click at pixel pattern("{start}", "0", "yes", "left")
     Color.Wait for pixel pattern to appear("{go}", "0")
     Macro.Pause("1500")
     Function.Execute repeatedly("run", "1000")
 end

function("run")
     begin
          Function.Execute("resetleft")
          Variable.Set("bestcol", "0")
          Variable.Set("bestval", "0")
          Variable.Set("bestorientation", "0")
          Variable.Set("ccol", "0")
          Variable.Set("corient", "0")
          begin loop("2")
               begin loop("10")
                    Macro.Pause("50")
                    Color.Find coordinate of occurrence on screen closest to coordinate (RGB)("102", "102", "102", "0", "{xf}", "{yf}", "xlast", "ylast")
                    Variable.Subtract (Math)("ylast", "5")
                    if  Variable.Is greater than (Math)("ylast", "{bestval}")
                         begin
                              Variable.Set("bestval", "{ylast}")
                              Variable.Set("bestcol", "{ccol}")
                              Variable.Set("bestorientation", "{corient}")
                         end
                    Function.Execute("goright")
                    Variable.Increment (Math)("ccol")
               end
               Function.Execute("turn")
               Variable.Increment (Math)("corient")
               Function.Execute("resetleft")
               Variable.Set("ccol", "0")
          end
          Function.Execute("turn")
          Function.Execute("turn")
          begin loop("{bestorientation}")
               Function.Execute("turn")
          end
          Function.Execute("goleft")
          Function.Execute("goleft")
          begin loop("{bestcol}")
               Function.Execute("goright")
          end
          Function.Execute("drop")
          Macro.Pause("700")
     end
function

function("resetleft")
     begin loop("10")
          Keyboard.Hold keys("{<left>}")
          Macro.Pause("50")
          Keyboard.Release keys("{<left>}")
          Macro.Pause("20")
     end
function

function("goleft")
     begin
          Keyboard.Hold keys("{<left>}")
          Macro.Pause("50")
          Keyboard.Release keys("{<left>}")
          Macro.Pause("20")
     end
function

function("goright")
     begin
          Keyboard.Hold keys("{<right>}")
          Macro.Pause("50")
          Keyboard.Release keys("{<right>}")
          Macro.Pause("20")
     end
function

function("turn")
     begin
          Keyboard.Hold keys("z")
          Macro.Pause("50")
          Keyboard.Release keys("z")
          Macro.Pause("20")
     end
function

function("drop")
     begin
          Keyboard.Hold keys("{<space>}")
          Macro.Pause("50")
          Keyboard.Release keys("{<space>}")
          Macro.Pause("20")
     end
function
 

knows only 2 general piece orientations (will only effectively use the rotate button once)
tl is 34,34,34,-1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,-2,0,37,37,37,-1,0,149,149,149,-1,0,149,149,149,-3,1,150,150,150,-1,0,150,150,150,-4,0,60,60,60,-3,2,255,255,255,-2,1,255,255,255,-3,1,153,153,153,-3,-1,255,255,255,-3,0,24,24,24,-3,0,204,204,204,-2,0,255,255,255,-3,-1,153,153,153,-5,-1,229,229,229,-1,0,153,153,153,-1,0,153,153,153,-2,0,153,153,153,-3,1,255,255,255,-3,1,153,153,153,-1,0,197,197,197,-1,0,255,255,255,-1,0,255,255,255,-1,0,255,255,255,-1,0,216,216,216,0,1,153,153,153
and
br is
34,34,34,0,1,34,34,34,3,0,0,0,0,1,0,0,0,0,2,0,0,0,0,2,0,23,23,23,1,0,34,34,34,1,0,34,34,34,1,0,21,21,21,1,0,0,0,0,1,-1,0,0,0,1,0,0,0,0,0,-2,0,0,0,1,-3,0,0,0,0,-2,0,0,0,0,-2,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,-1,0,0,0,0,-1,-1,0,0,0,-1,-1,34,34,34,-1,-1,34,34,34,-1,0,34,34,34,-1,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,-1,-2,34,34,34,-1,0,34,34,34,0,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,0,-1,34,34,34,1,-1,34,34,34,1,-1,34,34,34,1,0,34,34,34,1,-1,34,34,34,1,0,34,34,34,2,0,0,0,0,1,0,0,0,0,1,0,0,0,0,2,0,0,0,0,1,0,26,26,26,1,1,26,26,26,0,1,26,26,26,1,0,26,26,26
start is
18,154,255,1,0,17,150,249,11,-1,15,124,202,9,0,15,124,202,5,1,255,255,255,18,3,255,255,255,6,0,15,124,202,1,0,15,124,202,2,0,255,255,255,4,0,255,255,255,2,0,255,255,255,7,0,15,124,202,5,1,74,156,215,7,0,15,124,202,1,0,15,124,202,2,0,18,154,255,-1,-1,16,143,236,-20,-2,134,189,228,-11,0,15,124,202,-20,0,15,124,202,-16,1,164,205,235,-11,0,16,137,226,-9,0,18,154,255,-6,0,18,154,255,1,0,18,154,255,18,1,15,124,202,26,3,15,124,202,26,1,149,197,232,16,2,255,255,255,11,0,18,154,255,1,0,18,154,255,1,0,18,154,255,2,-2,18,154,255,1,-1,18,154,255,1,-1,18,154,255,0,-1,18,154,255,0,-1,18,154,255,-2,-1,18,154,255,-20,3,15,124,202,-7,1,119,181,225
go is
146,232,15,1,0,146,232,15,2,0,146,232,15,1,0,146,232,15,2,0,146,232,15,1,0,146,232,15,1,0,146,232,15,1,0,146,232,15,1,1,146,232,15,1,0,146,232,15,1,0,146,232,15,1,0,47,151,2,2,0,47,151,2,2,0,47,151,2,1,0,47,151,2,2,0,146,232,15,1,-2,146,232,15,2,0,146,232,15,3,-2,146,232,15,3,-1,146,232,15,1,-1,146,232,15,2,-1,146,232,15,1,-1,146,232,15,3,-3,146,232,15,2,-3,146,232,15,3,-1,146,232,15,2,-2,146,232,15,2,-1,146,232,15,3,0,146,232,15,1,0,146,232,15,1,0,146,232,15,2,0,146,232,15,1,0,146,232,15,0,1,146,232,15,2,1,146,232,15,1,1,146,232,15,1,0,146,232,15,1,0,146,232,15,1,1,146,232,15,1,0,146,232,15,1,1,146,232,15,2,0,146,232,15,1,1,146,232,15,1,2,146,232,15,0,1,146,232,15,1,2,146,232,15,0,1,146,232,15,0,2,146,232,15,0,1,146,232,15,1,0,146,232,15,0,1,146,232,15,1,0,146,232,15,1,0,146,232,15,1,0,146,232,15,1,0,146,232,15,6,0,47,151,2,6,1,146,232,15,3,0,146,232,15

made for this game
http://www.tetrisfriends.com/games/Battle2P/game.php

_________________
A train stops at a train station, a bus stops at a bus station.
On my desk, there's a workstation...


Top
 Profile  
Reply with quote  
 Post subject: Re: bad tetris bot
Thanked: 0 time(s)  Unread post Posted: Mon Feb 20, 2012 3:42 am 
Active User
Active User



Joined: Fri Feb 17, 2012 3:50 am
Posts: 31
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 2048
Refer to this.

viewtopic.php?f=10&t=257


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group