Difference between revisions of "User talk:Awesomeness"

From Robowiki
Jump to navigation Jump to search
Line 59: Line 59:
  
 
* For the second method, your first value would be Math.sin(angle+Math.PI), and the second value would be Math.cos(angle+Math.PI). (Keep in mind that you can't return two values from one method unless putting them in an object/array or something) --[[User:Rednaxela|Rednaxela]] 01:31, 29 March 2009 (UTC)
 
* For the second method, your first value would be Math.sin(angle+Math.PI), and the second value would be Math.cos(angle+Math.PI). (Keep in mind that you can't return two values from one method unless putting them in an object/array or something) --[[User:Rednaxela|Rednaxela]] 01:31, 29 March 2009 (UTC)
 +
 +
(edit conflict)
 +
 +
* Although [[Rednaxela]] already answered, I believe he's methods may be too Robocodish, as I think he still has the rotated Math we use here. But I may be wrong.
 +
 +
* First let me clarify. I think you have the 0,0 on the top left corner, am I right? That's the only reason I would understand your results for question1, and probably makes sense since you are using display coordinates.
 +
 +
* Being that the case, the first method is something like this
 +
<pre>
 +
double angle(double x, double y, double x2, double y2) {
 +
  double alpha = Math.atan2(-(y2 - y), x2 - x);
 +
  return Math.PI / 2 - alpha;
 +
}
 +
</pre>
 +
:see that atan2(y, x) will give you the angle from origin (0,0) to (x, y). The minus sign in the y parameter is to account for the fact that 0,0 is on top left and not bottom left as in regular math. PI / 2 should be the vertical vector you mention, the may need some tweaking, but they are small if any.
 +
 +
* For the second method, I will give a hint and let you try work it out. The sine of an angle represents the y-axis, and the cosine is x-axis. Try working out them for your fits. Use a calculator to check the values, Windows calc can handle sin/cos of Degrees or radians, and most scientific calculators do as well.
 +
 +
Hope it helps. Ask again after some work ;-). --[[User:Zyx|zyx]] 01:47, 29 March 2009 (UTC)

Revision as of 03:47, 29 March 2009

Note for you, Horizon Component System broke in 1.7. It cannot perform a radar lock so it can't dodge/fire effectively. Try robocode 1.6.0 or 1.6.1 and let see can you get score at this rate high? » Nat | Talk » 02:28, 13 March 2009 (UTC)

Shoot, 1.6.1 doesn't work on my computer. Strange...Awesomeness 02:52, 13 March 2009 (UTC)

Welcome to Robocode Awesomeness, good luck and have fun. Shout when in trouble. --zyx 03:09, 13 March 2009 (UTC)

Welcome to the wiki indeed! About Horizon, maybe Horizon is fixed as of 1.7.1 Beta2? I haven't tested 1.7.1 Beta2 yet. And Nat, any reason you haven't made a bug report for it or is it the same bug as one already reported? --Rednaxela 03:21, 13 March 2009 (UTC)

  • I haven't download the 1.7beta2 yet. But, about bug report, I completely forget! Thanks for remind. I think there isn't anyone know this except me. » Nat | Talk » 11:25, 13 March 2009 (UTC)

Um... I do have one problem. Whenever I try to use things such as GF targeting, Surfing, etc. The tutorials never use the methods properly or something. It gives a can't find symbol error for every custom method in the code. =/ -- Awesomeness

Er, what method are you using to compile it? The tutorials are using methods just fine. --Rednaxela 03:45, 13 March 2009 (UTC)

The compiler ALWAYS gives me errors unless I set it to "-classpath /Users/student/Documents/Robocode/libs/robocode.jar". Maybe that's cuz I use a mac. Awesomeness 14:36, 13 March 2009 (UTC)

Er, you always need to include the classpath if you're compiling from the command line normally. It has nothing to do with using a mac. The only way to go without it is either by including it in the CLASSPATH environment variable, or using an IDE like Eclipse --Rednaxela 17:16, 13 March 2009 (UTC)

I'm not using a terminal to compile, I'm just changing the compiler settings for the classpath. I really need GF or PM targeting for my bot! =( Awesomeness 19:01, 13 March 2009 (UTC)

So what are you using? The editor/compiler built into Robocode? It should work straight out the box... --Skilgannon 19:25, 13 March 2009 (UTC)


I use the Javac thingy, not Jikes. It doesn't matter which I use, I'm pretty sure, I seem to get the same output for them no matter which compiler I use. Same errors with the default classpath.

NEVERMIND!!! YEEEAAAHHH! I got GuessFactor targeting to work perfectly! And with my already good movement strategy, it's awesome! I'm so proud of myself because I thought up this movement concept myself, and I checked, no one else uses it! It's a truly original strategy! I think...

Umm... I just had a thought... If two robots battle each other and use static variables with the same name(s), will the robots mess up? --Awesomeness

Nope, they won't. Robocode loads each robot with a seperate classloader, which makes it so individual robots in battle keep completely seperated static data. --Rednaxela 02:23, 14 March 2009 (UTC)

Okay. Can someone take a look at my page, Fission? I need help making it into a jar.


For Elite: Have you try just 35 rounds? Many of nanobot's pattern matcher get stuck exactly after round 35... And I think I look correct, but

22 robar.nano.Assertive 0.3 62.58 70.73 1730.7

22th is now Assertive. PlusarNano is at 29th. » Nat | Talk » 09:46, 17 March 2009 (UTC)

Hmm... You're right. Either way, I easily beat the 29th bot so I'm happy =D


Hi, good luck for the rumble! If you have any questions about nanos, I'm a nano-freak. ;) Looking for strong nano-dodgers try the Neophyte series, Freddie, Mosquito series, AceSurf, Acero, RaikoNano. --HUNRobar 20:54, 18 March 2009 (UTC)

  • I think the strong of Neophyte is not for movement, at least not a dodge, but it come from its distance control (180px) and good gun. That why PRAL and SRAL perform so good per LT. » Nat | Talk » 03:29, 19 March 2009 (UTC)

Trigonometry Question

Ok, this is kind of unrelated, but all you guys here are experts at trigonometry,and although I go to a VERY advanced school, I'm only 13, and I have a limited understanding. I am making a java application totally unrelated to Robocode. Say I have this scenario:

I've made a dot that moves around with the arrow keys, but I want another dot to follow it. I've made the first dot move according to the arrow keys, and I could make the follower dot's movement simple, but I want it to move DIRECTLY towards the arrow key mover dot. To do this I need two things:

-A method returning a double and taking parameters x, y, x2, and y2 giving the angle in radians between them in comparison to vertical. For example, if x and y are 0, 0 and x1 and y2 are 2, 2, then the angle you'd get is 2.35619449, or 135 degrees in radians.

-A way to get the change in x and y when given an angle. It returns x and y and takes a double called angle. For example, if the angle was 90 degrees, (in radians, though, of course) then it would return 1, 0, if it was 180 degrees, it'd return 0, 1, and if it was 270 degrees it'd be -1, 0.

Sorry if this is confusing... Someone help, please! --Awesomeness (moved by --zyx 01:24, 29 March 2009 (UTC))

  • That first method is equal to Math.atan2(x2-x1,y1-y2). --Rednaxela 01:27, 29 March 2009 (UTC)
  • For the second method, your first value would be Math.sin(angle+Math.PI), and the second value would be Math.cos(angle+Math.PI). (Keep in mind that you can't return two values from one method unless putting them in an object/array or something) --Rednaxela 01:31, 29 March 2009 (UTC)

(edit conflict)

  • Although Rednaxela already answered, I believe he's methods may be too Robocodish, as I think he still has the rotated Math we use here. But I may be wrong.
  • First let me clarify. I think you have the 0,0 on the top left corner, am I right? That's the only reason I would understand your results for question1, and probably makes sense since you are using display coordinates.
  • Being that the case, the first method is something like this
double angle(double x, double y, double x2, double y2) {
  double alpha = Math.atan2(-(y2 - y), x2 - x);
  return Math.PI / 2 - alpha;
}
see that atan2(y, x) will give you the angle from origin (0,0) to (x, y). The minus sign in the y parameter is to account for the fact that 0,0 is on top left and not bottom left as in regular math. PI / 2 should be the vertical vector you mention, the may need some tweaking, but they are small if any.
  • For the second method, I will give a hint and let you try work it out. The sine of an angle represents the y-axis, and the cosine is x-axis. Try working out them for your fits. Use a calculator to check the values, Windows calc can handle sin/cos of Degrees or radians, and most scientific calculators do as well.

Hope it helps. Ask again after some work ;-). --zyx 01:47, 29 March 2009 (UTC)