Difference between revisions of "Talk:Exterminans2oo8"
Jump to navigation
Jump to search
(reply) |
(New section: Wall smoothing) |
||
Line 3: | Line 3: | ||
The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --[[User:Jab |Jab]] | The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --[[User:Jab |Jab]] | ||
:Thanks, that's exactly what I've been looking for :) If I understood the event handling process correctly onScannedRobot is called last, after the other events. Ramming and bullets thus are already taken into consideration. The only needed thing is checking when the enemy hit the wall. Thanks for the hint, I'll implement that in the next version. And someday I'll also use WaveSurfing, but that still needs quite some coding :/ --[[User:Altglass|altglass]] | :Thanks, that's exactly what I've been looking for :) If I understood the event handling process correctly onScannedRobot is called last, after the other events. Ramming and bullets thus are already taken into consideration. The only needed thing is checking when the enemy hit the wall. Thanks for the hint, I'll implement that in the next version. And someday I'll also use WaveSurfing, but that still needs quite some coding :/ --[[User:Altglass|altglass]] | ||
+ | |||
+ | == Wall smoothing == | ||
+ | |||
+ | I've tried implementing Voidious' WallSmoothing algorithm (http://robowiki.net/cgi-bin/robowiki?WallSmoothing#fast) in the OscillatorMovement. But somehow it crashes into the walls anyway. | ||
+ | |||
+ | This is my code: | ||
+ | |||
+ | <pre> | ||
+ | double turnAngle = 0; | ||
+ | if(e!=null) turnAngle = e.bearing+Math.PI/2; | ||
+ | double absAngle = r.getHeadingRadians() + turnAngle; | ||
+ | double ahead = 50+random.nextInt(100)*(Math.sin(r.getTime()/a)+Math.cos(r.getTime()/b)); | ||
+ | int clockwise = (r.getHeading()>=0)?1:-1; | ||
+ | clockwise *= (ahead>0)?1:-1; | ||
+ | double goAngle = wallSmoothing(r.getX(),r.getY(),absAngle,clockwise,1); | ||
+ | r.setTurnRight(goAngle - r.getHeadingRadians()); | ||
+ | r.setAhead(ahead); | ||
+ | </pre> | ||
+ | |||
+ | What am I doing wrong? | ||
+ | |||
+ | I've compiled a testing version that does not fire and only drives around in OscillatorMovement. You can find it at http://d-gfx.kognetwork.ch/robocode/altglass.Exterminans2oo8_test0331WS.jar | ||
+ | |||
+ | Any help is appreciated --[[User:Altglass|altglass]] |
Revision as of 15:02, 31 March 2008
Hi, two comments: May be RWPCL is the license that you want for your bot. The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --Jab
- Thanks, that's exactly what I've been looking for :) If I understood the event handling process correctly onScannedRobot is called last, after the other events. Ramming and bullets thus are already taken into consideration. The only needed thing is checking when the enemy hit the wall. Thanks for the hint, I'll implement that in the next version. And someday I'll also use WaveSurfing, but that still needs quite some coding :/ --altglass
Wall smoothing
I've tried implementing Voidious' WallSmoothing algorithm (http://robowiki.net/cgi-bin/robowiki?WallSmoothing#fast) in the OscillatorMovement. But somehow it crashes into the walls anyway.
This is my code:
double turnAngle = 0; if(e!=null) turnAngle = e.bearing+Math.PI/2; double absAngle = r.getHeadingRadians() + turnAngle; double ahead = 50+random.nextInt(100)*(Math.sin(r.getTime()/a)+Math.cos(r.getTime()/b)); int clockwise = (r.getHeading()>=0)?1:-1; clockwise *= (ahead>0)?1:-1; double goAngle = wallSmoothing(r.getX(),r.getY(),absAngle,clockwise,1); r.setTurnRight(goAngle - r.getHeadingRadians()); r.setAhead(ahead);
What am I doing wrong?
I've compiled a testing version that does not fire and only drives around in OscillatorMovement. You can find it at http://d-gfx.kognetwork.ch/robocode/altglass.Exterminans2oo8_test0331WS.jar
Any help is appreciated --altglass