Results 1 to 6 of 6
Thread: RNG Used To Move Mouse
- 12-10-2011, 10:09 PM #1
Member
- Join Date
- Dec 2011
- Posts
- 6
- Rep Power
- 0
RNG Used To Move Mouse
Alright so I am new here and new to Java but I want to create a simple java program used to
control the mouse randomly and click randomly.. I have been searching for hours and I can only find
some code that will help me.
I want to addJava Code:import java.awt.Robot; public class Main { public static void main(String[] argv) throws Exception { Robot robot = new Robot(); robot.mouseMove(,); } }
I have this code and been trying to mess around with it to see if It can take the highest value after the generation and make the mouse moveJava Code:import java.util.Random;
Im stuck now.Java Code:Random randomNumbers = new Random(); // random number generator int MoveUp = 0; // count of Ups rolled int MoveDown = 0; // count of Downs rolled int Moveright = 0; // count of Rights rolled int MoveLeft = 0; // count of Lefts rolled int face; // stores value? for ( int roll = 1; roll <= 6000; roll++ ) { face = 1 + randomNumbers.nextInt( 6 ); // number from 1 to 6 // determine roll value 1-6 and increment appropriate counter switch ( face ) { case 1: ++MoveUp; // increment the ups counter break; case 2: ++MoveDown; // increment the downs counter break; case 3: ++Moveright; // increment the rights counter break; case 4: ++MoveLeft; // increment the lefts counter break; } }
How can I make the java program take the highest value out of the 4. Then move the mouse in that direction then "Break" for a few seconds then do it again.
Any help is appreciated :)
- 12-10-2011, 10:44 PM #2
Re: RNG Used To Move Mouse
You could sort the values to get the highest one.How can I make the java program take the highest value out of the 4.
If you have no other use for the CPU, you could use the Thead sleep method to wait for a few seconds.move the mouse in that direction then "Break" for a few seconds
If you want to do other things while you wait, use a Timer class to call your 'move the mouse' code every few seconds
- 12-11-2011, 11:03 PM #3
Member
- Join Date
- Dec 2011
- Posts
- 6
- Rep Power
- 0
Re: RNG Used To Move Mouse
I still have not figured it out.. more help is appreciated
- 12-11-2011, 11:05 PM #4
Re: RNG Used To Move Mouse
What is the "it" that you are working on?
1) take the highest value after the generation
2) make the mouse move
3)Break" for a few seconds
4)then do it again.
Pick one and work on that one until it does what you want and then move to the next one.
- 12-11-2011, 11:32 PM #5
Member
- Join Date
- Dec 2011
- Posts
- 6
- Rep Power
- 0
Re: RNG Used To Move Mouse
Its for researching the randomness of the generators.
So basically I need a program that will move up when there are more up's generated out of about 1000 random generations.
I am contemplating on hiring a programmer to do this for me off of a website but there price for something like this is about 100-150$
- 12-11-2011, 11:36 PM #6
Similar Threads
-
JButton doesnt show unless you move mouse over it
By liluma in forum AWT / SwingReplies: 4Last Post: 12-06-2011, 03:33 AM -
Help!! Trying to write a program that make a square move with keyboard and mouse.
By ohkelvin in forum New To JavaReplies: 9Last Post: 06-17-2011, 05:10 AM -
how to move an image automatically without using mouse
By saranyabaskaran in forum New To JavaReplies: 6Last Post: 03-19-2011, 10:00 AM -
Mouse Listener for mouse floating over object?
By Krooger in forum AWT / SwingReplies: 1Last Post: 11-18-2009, 04:34 AM -
How can i move the mouse over a html element within web browser?
By bobomonkey in forum Advanced JavaReplies: 1Last Post: 10-30-2009, 06:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks