|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#31
|
||||
|
||||
|
Re: Please help Wave Robotics earn $1,000!!!
I think your underestimating... as students get off school this afternoon, I expect the numbers to start skyrocketing. Can we hit 100k tonight?
|
|
#32
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
I'm so tempted to write an automated coin deposit script...
|
|
#33
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
And that's the 50,000th coin. You guys are awesome. Hope you win
![]() |
|
#34
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
We can do it!
100,000 by midnight. (And let's do it w/o all those slick scripts I know you guys could come up with.) |
|
#35
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
Quote:
I apologize for using magic numbers for pixel locations. Also, do not run this if you're not willing to give up the use of your computer for a minute. Code:
/*
Copyright (C) 2011 Evan Foote
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Robot;
public void robotRunner()
{
try
{
Robot myRobot = new Robot();
myRobot.delay(4000);
//get the current system time for reference on how long to run
long time = System.currentTimeMillis();
int loops = 0;
int x = 560; //coordinate of the screen in pixels where the coins appear
int y = 560;
int dx = 0; //or offset, where we're sampling
int dy = 0;
int xmax = 240; //size of the rectangle we're sampling
int ymax = 150;
int xsamp = 40; //AKA the step size between samples
int ysamp = 20;
Color c; //the sampled color
int cnt = 0; //The number of coins we've found
//run main loop for about 1 minute
while (System.currentTimeMillis() - time < 1*60*1000)
{
//iterate through each coordiante in the sample space
for (dx = 0; dx < xmax; dx += xsamp)
{
for (dy = 0; dy < ymax; dy += ysamp)
{
//snag the color where we're sampling
c = myRobot.getPixelColor(x + dx, y + dy);
//check and see if the color is something other than white (like yellow)
if (notWhite(c))
{
//move the mouse to that location
myRobot.mouseMove(x + dx, y + dy);
//increment the count so we know when to stop
cnt++;
//subtract this sample so we can check again
dy -= ysamp;
//left click the mouse, wait, drag it to the piggy bank, wait,
//release it, wait.
myRobot.mousePress(16);
myRobot.delay(50);
myRobot.mouseMove(448, 537);
myRobot.delay(50);
myRobot.mouseRelease(16);
myRobot.delay(50);
//TODO: CAN BETTER THIS CODE by:
//checking that the coin traveled with the mouse. If it didn't,
//subtract 1 from the cnt and try again.
//alright, grabbed 5 coins. click on the refresh button
if(cnt == 5)
{
myRobot.mouseMove(1109, 87);
myRobot.delay(50);
myRobot.mousePress(16);
myRobot.delay(50);
myRobot.mouseRelease(16);
//wait a second for the page to refresh. Slower internet speeds
//should wait longer.
myRobot.delay(1000);
break;
}//if count is at 5
}//if sample is not white
}//for each y pixel
//Putting this in the outer for loop so we can break from it
//as well.
if (cnt == 5)
{
//reset the count and the iteration
cnt = 0;
break;
}
}//for each x row
//if dy >= ymax, it means that we've traveled all the way and didn't
//spot 5 coins. something went bad, refresh the page.
if (dy >= ymax)
{
myRobot.mouseMove(1109, 87);
myRobot.delay(50);
myRobot.mousePress(16);
myRobot.delay(50);
myRobot.mouseRelease(16);
myRobot.delay(1000);
cnt = 0;
}
loops++;
}//while loop
System.out.println("Number of loops run: " + loops);
}//try
catch(Exception e)
{
//not sure what would cause above code to be more than exceptional, but
//if it is, I don't care and we can stop running here.
}
}
private boolean notWhite (Color c)
{
return (c.getRed() + c.getBlue() + c.getGreen() < 255*3);
}
|
|
#36
|
|||||
|
|||||
|
Re: Please help Wave Robotics earn $1,000!!!
I suggest you remove the script. It's highly likely that the rules don't have anything good to say about macros to gain points. This could result in Wave Robotics losing by default.
Last edited by gyroscopeRaptor : 04-05-2011 at 21:35. |
|
#37
|
|||||
|
|||||
|
Re: Please help Wave Robotics earn $1,000!!!
60,000
![]() |
|
#38
|
||||
|
||||
|
Re: Please help Wave Robotics earn $1,000!!!
Just dropped a few coins in for WAVE. You guys are awesome, good luck!
|
|
#39
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
Quote:
(Not badmouthing this at all, just curious if any of the FRC students want to put all that vision processing they did to good use) |
|
#40
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
Imagine a world solely consisting of FIRST students. Oh the things that we could do.
|
|
#41
|
||||
|
||||
|
Re: Please help Wave Robotics earn $1,000!!!
Team 11, MORT, is helping out. I have been repeating the refresh cycle for about an hour now. I talked to our website site manager, and the link is now posted on the homepage of our team website as well as on our facebook page. With a score of 63,000 to 15,000, all of chief delphi helping you out, and calling in reinforcements, I seriously doubt that you can lose this. Good luck on getting the 1,000 dollars!!
|
|
#42
|
||||
|
||||
|
Re: Please help Wave Robotics earn $1,000!!!
If I vote for you guys will you make an attempt to help the technology needs at Emmeline Cook Elementary School? Or atleast help their technology education?
|
|
#43
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
A robot demo for the kids would be cool. Very GP.
|
|
#44
|
||||
|
||||
|
Re: Please help Wave Robotics earn $1,000!!!
I voted for you guys because I believe that you guys will do something like ^ that!
![]() |
|
#45
|
|||
|
|||
|
Re: Please help Wave Robotics earn $1,000!!!
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|