<?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=Sabreur%2FCode</id>
	<title>Sabreur/Code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=Sabreur%2FCode"/>
	<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Sabreur/Code&amp;action=history"/>
	<updated>2026-04-27T04:18:12Z</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=Sabreur/Code&amp;diff=58081&amp;oldid=prev</id>
		<title>Sheldor2 at 14:34, 2 March 2026</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Sabreur/Code&amp;diff=58081&amp;oldid=prev"/>
		<updated>2026-03-02T14:34:31Z</updated>

		<summary type="html">&lt;p&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 14:34, 2 March 2026&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-l102&quot; &gt;Line 102:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 102:&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;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;&amp;lt;/syntaxhighlight&amp;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;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Source Code]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sheldor2</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Sabreur/Code&amp;diff=57914&amp;oldid=prev</id>
		<title>Sheldor2 at 12:49, 19 May 2024</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Sabreur/Code&amp;diff=57914&amp;oldid=prev"/>
		<updated>2024-05-19T12:49:23Z</updated>

		<summary type="html">&lt;p&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 12:49, 19 May 2024&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;syntaxhighlight&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;syntaxhighlight &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;lang=&amp;quot;Java&amp;quot;&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;/*&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;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;Sabreur v1.1.2 by Sheldor.  05/27/2013&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;Sabreur v1.1.2 by Sheldor.  05/27/2013&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sheldor2</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Sabreur/Code&amp;diff=57849&amp;oldid=prev</id>
		<title>Sheldor2: Created page with &quot;&lt;syntaxhighlight&gt; /* Sabreur v1.1.2 by Sheldor.  05/27/2013 A NanoBot with multimode movement and linear targeting. Codesize: 245 Bytes with three colors.  Sabre is one of the...&quot;</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Sabreur/Code&amp;diff=57849&amp;oldid=prev"/>
		<updated>2024-04-29T14:57:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight&amp;gt; /* Sabreur v1.1.2 by Sheldor.  05/27/2013 A NanoBot with multimode movement and linear targeting. Codesize: 245 Bytes with three colors.  Sabre is one of the...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Sabreur v1.1.2 by Sheldor.  05/27/2013&lt;br /&gt;
A NanoBot with multimode movement and linear targeting.&lt;br /&gt;
Codesize: 245 Bytes with three colors.&lt;br /&gt;
&lt;br /&gt;
Sabre is one of the three forms of modern sport fencing,&lt;br /&gt;
along with Epee and Foil.  http://en.wikipedia.org/wiki/Sabre_%28fencing%29&lt;br /&gt;
&lt;br /&gt;
Credits:&lt;br /&gt;
Thanks go to the authors of the following bots: &lt;br /&gt;
oog.nano.Caligula, mz.NanoDeath, dz.MostlyHarmlessNano, gh.micro.GrubbmThree.&lt;br /&gt;
Also, a general thanks to all open source bot authors and contributors to the RoboWiki.&lt;br /&gt;
&lt;br /&gt;
Sabreur is open source and released under the terms of the RoboWiki Public Code License (RWPCL) - Version 1.1.&lt;br /&gt;
see license here: http://robowiki.net/wiki/RWPCL&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
package sheldor.nano;&lt;br /&gt;
&lt;br /&gt;
import robocode.*;&lt;br /&gt;
import robocode.util.Utils;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
&lt;br /&gt;
public class Sabreur extends AdvancedRobot&lt;br /&gt;
{&lt;br /&gt;
	//Global variables&lt;br /&gt;
	static double direction;&lt;br /&gt;
	static double enemyEnergy;&lt;br /&gt;
	static int    deathCount;&lt;br /&gt;
		&lt;br /&gt;
	//En garde!&lt;br /&gt;
	public void run()&lt;br /&gt;
	{&lt;br /&gt;
		//Set the bot's colors.&lt;br /&gt;
		setColors(Color.white, Color.black, Color.white);&lt;br /&gt;
		&lt;br /&gt;
		//Start spinning radar and initialize movement direction.&lt;br /&gt;
		setTurnRadarRightRadians(direction = 100000);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void onScannedRobot(ScannedRobotEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		//Local variables&lt;br /&gt;
		double absoluteBearing;&lt;br /&gt;
		double bearing;&lt;br /&gt;
		double lead;	&lt;br /&gt;
		&lt;br /&gt;
		//Linear targeting&lt;br /&gt;
		setTurnGunRightRadians(Utils.normalRelativeAngle((absoluteBearing = getHeadingRadians() + (bearing = e.getBearingRadians())) +&lt;br /&gt;
			(lead = Math.asin(e.getVelocity() / 14 * Math.sin(e.getHeadingRadians() - absoluteBearing))) - getGunHeadingRadians()));&lt;br /&gt;
								&lt;br /&gt;
		//One-way orbit/Oscillating movement&lt;br /&gt;
		//These modes alternate when the bot dies.&lt;br /&gt;
		if(enemyEnergy &amp;gt; (enemyEnergy = e.getEnergy()) &amp;amp;&amp;amp; (deathCount % 2) != 0)&lt;br /&gt;
		{&lt;br /&gt;
			onHitWall(null);&lt;br /&gt;
		}&lt;br /&gt;
		setAhead(direction);&lt;br /&gt;
		&lt;br /&gt;
		//Stay mostly perpendicular to the enemy, but try to maintain a distance of 160 pixels.&lt;br /&gt;
		//The absolute bearing variable is re-used here to represent the enemy distance.  This saves one byte.&lt;br /&gt;
		setTurnRightRadians(Math.cos(bearing - ((absoluteBearing = e.getDistance()) - 160) * (direction / 35000000)));&lt;br /&gt;
				&lt;br /&gt;
		//If the bot has died more than four times in the first twelve rounds, switch to ramming the enemy.&lt;br /&gt;
		//Notice that I use the same linear lead for ramming as I use in the gun code.&lt;br /&gt;
		if (deathCount &amp;gt; 3)&lt;br /&gt;
		{&lt;br /&gt;
			setTurnRightRadians(Math.tan(bearing += lead));&lt;br /&gt;
			setAhead(Math.cos(bearing) / 0);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		//Fire medium power bullets most of the time, but use full power at very close range.&lt;br /&gt;
		//If the enemy is weak, fire the minimum power needed to destroy them.&lt;br /&gt;
		setFire(Math.min(2 + (100 / (int)absoluteBearing), enemyEnergy / 4));&lt;br /&gt;
	&lt;br /&gt;
		//Pseudo-infinite radar lock&lt;br /&gt;
		setTurnRadarLeftRadians(getRadarTurnRemaining());&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void onBulletHit (BulletHitEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		//Adjust enemy energy variable when the bot hits the enemy.&lt;br /&gt;
		//This makes a big difference against linear targeting.&lt;br /&gt;
		enemyEnergy -= 10;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void onDeath(DeathEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		//If the bot dies in the first twelve rounds, increment the deathCount variable.&lt;br /&gt;
		if (getRoundNum() &amp;lt; 12)&lt;br /&gt;
		{&lt;br /&gt;
			deathCount++;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void onHitWall(HitWallEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		//Reverse movement direction when the bot hits a wall.&lt;br /&gt;
		direction = -direction;&lt;br /&gt;
	}&lt;br /&gt;
}																																														&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sheldor2</name></author>
		
	</entry>
</feed>