<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=Module%2FRadar%2FSpinningBestStartDirection</id>
	<title>Module/Radar/SpinningBestStartDirection - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=Module%2FRadar%2FSpinningBestStartDirection"/>
	<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&amp;action=history"/>
	<updated>2026-04-24T23:58:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&amp;diff=16779&amp;oldid=prev</id>
		<title>RednaxelaBot: Using &lt;syntaxhighlight&gt;.</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&amp;diff=16779&amp;oldid=prev"/>
		<updated>2010-07-01T08:29:18Z</updated>

		<summary type="html">&lt;p&gt;Using &amp;lt;syntaxhighlight&amp;gt;.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 08:29, 1 July 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;package jab.radar;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;package jab.radar;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l55&quot; &gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff::1.12:old-1990:rev-16779 --&gt;
&lt;/table&gt;</summary>
		<author><name>RednaxelaBot</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&amp;diff=1990&amp;oldid=prev</id>
		<title>Jab: Module Radar SpinningBestStartDirection</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Module/Radar/SpinningBestStartDirection&amp;diff=1990&amp;oldid=prev"/>
		<updated>2008-03-26T21:13:22Z</updated>

		<summary type="html">&lt;p&gt;Module Radar SpinningBestStartDirection&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
package jab.radar;&lt;br /&gt;
&lt;br /&gt;
import robocode.util.Utils;&lt;br /&gt;
import jab.Module;&lt;br /&gt;
import jab.Radar;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Credits&lt;br /&gt;
 * SpinningBestStartDirection by jab. Code license: RWPCL&lt;br /&gt;
 * Calculate if the radar must turns clockwise or not.&lt;br /&gt;
 * The main idea is to start scanning the opposite quadrant (biggest area)&lt;br /&gt;
 * as quick as possible, and if it starts scanning that quadrant&lt;br /&gt;
 * scan in the direction of that quadrant that has more area.&lt;br /&gt;
 */&lt;br /&gt;
public class SpinningBestStartDirection extends Radar {&lt;br /&gt;
&lt;br /&gt;
	public SpinningBestStartDirection (Module bot) {&lt;br /&gt;
		super(bot);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	private double radarClockwise;&lt;br /&gt;
	&lt;br /&gt;
	public void scan() {&lt;br /&gt;
		// Get the start radar direction only when the battle begins&lt;br /&gt;
		if (radarClockwise==0) radarClockwise = getRadarDirection();&lt;br /&gt;
		bot.setTurnRadarRightRadians(Double.POSITIVE_INFINITY * radarClockwise);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	private int getRadarDirection() {&lt;br /&gt;
&lt;br /&gt;
		double width = bot.getBattleFieldWidth();&lt;br /&gt;
		double height = bot.getBattleFieldHeight();&lt;br /&gt;
&lt;br /&gt;
		double radarHeadingRadians = bot.getRadarHeadingRadians();&lt;br /&gt;
		double to0 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians));&lt;br /&gt;
		double to90 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians&lt;br /&gt;
				- Math.PI / 2));&lt;br /&gt;
		double to180 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians&lt;br /&gt;
				- Math.PI));&lt;br /&gt;
		double to270 = Math.abs(Utils.normalRelativeAngle(radarHeadingRadians&lt;br /&gt;
				- 3 * Math.PI / 2));&lt;br /&gt;
		// 1 2&lt;br /&gt;
		// 3 4&lt;br /&gt;
		if (bot.getX() &amp;lt;= width / 2 &amp;amp;&amp;amp; bot.getY() &amp;gt;= height / 2)&lt;br /&gt;
			return (to90 &amp;lt; to180) ? 1 : -1;&lt;br /&gt;
		if (bot.getX() &amp;gt;= width / 2 &amp;amp;&amp;amp; bot.getY() &amp;gt;= height / 2)&lt;br /&gt;
			return (to180 &amp;lt; to270) ? 1 : -1;&lt;br /&gt;
		if (bot.getX() &amp;lt;= width / 2 &amp;amp;&amp;amp; bot.getY() &amp;lt;= height / 2)&lt;br /&gt;
			return (to0 &amp;lt; to90) ? 1 : -1;&lt;br /&gt;
		return (to270 &amp;lt; to0) ? 1 : -1;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jab</name></author>
		
	</entry>
</feed>