http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&feed=atom&action=history
Module/Radar/SpinningBestStartDirection - Revision history
2024-03-28T17:56:53Z
Revision history for this page on the wiki
MediaWiki 1.34.1
http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&diff=16779&oldid=prev
RednaxelaBot: Using <syntaxhighlight>.
2010-07-01T08:29:18Z
<p>Using <syntaxhighlight>.</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 08:29, 1 July 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del class="diffchange diffchange-inline">pre</del>></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><<ins class="diffchange diffchange-inline">syntaxhighlight</ins>></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>package jab.radar;</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>package jab.radar;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l55" >Line 55:</td>
<td colspan="2" class="diff-lineno">Line 55:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></<del class="diffchange diffchange-inline">pre</del>></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></<ins class="diffchange diffchange-inline">syntaxhighlight</ins>></div></td></tr>
</table>
RednaxelaBot
http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&diff=1990&oldid=prev
Jab: Module Radar SpinningBestStartDirection
2008-03-26T21:13:22Z
<p>Module Radar SpinningBestStartDirection</p>
<p><b>New page</b></p><div><pre><br />
package jab.radar;<br />
<br />
import robocode.util.Utils;<br />
import jab.Module;<br />
import jab.Radar;<br />
<br />
<br />
/**<br />
* Credits<br />
* SpinningBestStartDirection by jab. Code license: RWPCL<br />
* Calculate if the radar must turns clockwise or not.<br />
* The main idea is to start scanning the opposite quadrant (biggest area)<br />
* as quick as possible, and if it starts scanning that quadrant<br />
* scan in the direction of that quadrant that has more area.<br />
*/<br />
public class SpinningBestStartDirection extends Radar {<br />
<br />
public SpinningBestStartDirection (Module bot) {<br />
super(bot);<br />
}<br />
<br />
private double radarClockwise;<br />
<br />
public void scan() {<br />
// Get the start radar direction only when the battle begins<br />
if (radarClockwise==0) radarClockwise = getRadarDirection();<br />
bot.setTurnRadarRightRadians(Double.POSITIVE_INFINITY * radarClockwise);<br />
}<br />
<br />
<br />
private int getRadarDirection() {<br />
<br />
double width = bot.getBattleFieldWidth();<br />
double height = bot.getBattleFieldHeight();<br />
<br />
double radarHeadingRadians = bot.getRadarHeadingRadians();<br />
double to0 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians));<br />
double to90 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians<br />
- Math.PI / 2));<br />
double to180 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians<br />
- Math.PI));<br />
double to270 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians<br />
- 3 * Math.PI / 2));<br />
// 1 2<br />
// 3 4<br />
if (bot.getX() <= width / 2 && bot.getY() >= height / 2)<br />
return (to90 < to180) ? 1 : -1;<br />
if (bot.getX() >= width / 2 && bot.getY() >= height / 2)<br />
return (to180 < to270) ? 1 : -1;<br />
if (bot.getX() <= width / 2 && bot.getY() <= height / 2)<br />
return (to0 < to90) ? 1 : -1;<br />
return (to270 < to0) ? 1 : -1;<br />
}<br />
<br />
}<br />
</pre></div>
Jab