I was surprised at how well that worked. I was basically blindly cycling between left,down,right (with one accidental up) and got to 1024 on my first try.
for (y=0; y<=1000; y++) { press(39); //right press(40); //down press(37); //left press(40); //down }
this gave me 1024 in couple of tries :D http://i58.tinypic.com/am9sh4.png