# SonAsh

Robo Home | Changes | Preferences | AllPages

```package cx.sonnet;
import robocode.*;
import java.util.Vector;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
*-----------------------------------------------------------------
* @author:iiley (iiley@hotmail.com)
* http://www.robochina.org
* Ash:When you are smoking by the window,you will see the ash flying...
* ash is a microbot with the Cigaret's move scheme ... and a similar to Spark's gun.
* SonAsh: a sonnet version of Ash,14 lines.Squeezed from FemtoAsh,so it performace same to FemtoAsh.
*--------------------version 0.7 2003.9.14--------------
* 0.7:first released version.With a mine version symbol PM.
* Thanks kawigi for his open source nanobots,i learned much more from his bot FunkyFemto and FunkyMusic.
*--------------------version 0.7 2003.9.15--------------
* 0.8:Thanx Kawigi that told me how to make this runnalbe in JVM 1.3.
*+++++++++++++++++++++++++++++++++Open Source+++++++++++++++++++++++++++
*--
* This bot is open source.
* - Don't just copy-paste the code .
* - Don't just copy-paste and then improve.(I don't want to fight modified versions of my own bot)
* - Maybe some useful skill in this codes,if you use,Make your bot open source
* - And preferably give credit.:)
*
* If you want to know more or suggest,
* email me or post messages on www.robochina.org or www.robocoderepository's forums.
* every messages will be pleasent.
*--
*/
{
private static Object e_energy=new double,pattern = new StringBuffer(),nextP,myP,enemyP;
public void run( ) {
while(true){
}
}
public void onScannedRobot( ScannedRobotEvent e ) {
double absBearing,edistance,moveDistance,moveAngle,dist=0,index=0,searchlength = 80,power=Math.min(600d/e.getDistance()+0.5d,Math.min(getEnergy()/5d,Math.min(3d,e.getEnergy()/5d)));
//--------------movement---------------------
while(!new Rectangle2D.Double(23D, 23D, getBattleFieldWidth()-46D,  getBattleFieldHeight()-46D).contains((Point2D.Double)(nextP=nextPoint(((Point2D.Double)enemyP),absBearing+(moveAngle=Math.random()*1.6d-0.8d),-(moveDistance-=10d)/Math.cos(moveAngle)))));
setAhead((( moveAngle = robocode.util.Utils.normalRelativeAngle(Math.atan2( ((Point2D.Double)nextP).x-((Point2D.Double)myP).x,((Point2D.Double)nextP).y-((Point2D.Double)myP).y) - getHeadingRadians() ) ) == ( moveDistance = Math.atan( Math.tan( moveAngle ) ) ) ? 1 : - 1 )	* ((Point2D.Double)myP).distance(((Point2D.Double)nextP)) );	//move towards point
}
//-----------------pattern analyser--------------------
if(getGunHeat()<0.4d){
try{
while ((index = ((StringBuffer)pattern).indexOf(((StringBuffer)pattern).substring(0, (int)(searchlength-=2)), 1)+1) < 20);
while((++dist)*(20d-power*3d) - ((Point2D.Double)myP).distance((Point2D.Double)(enemyP=nextPoint(((Point2D.Double)enemyP),((byte)(((StringBuffer)pattern).toString().charAt((int)(--index)))-8)*0.3927,((byte)((StringBuffer)pattern).toString().charAt((int)(--index))))))<0);
}catch(Exception ee){}
}
scan();
}
public static Point2D.Double nextPoint(Point2D.Double originPoint,double angle,double distance){
return new Point2D.Double(originPoint.x+Math.sin(angle)*distance,originPoint.y+Math.cos(angle)*distance);
}
}
```

I suggest you make this bot compatible with Java 1.3 by adding a .toString() before the .charAt part. You should have noticed that in FunkyMusic? (which was my 5-line version of FunkyChicken). -- Kawigi

OK~~Thanx.~;] -- iiley

This sonnet development doesn't exactly help making our bot code more readable. =) -- PEZ

changed. Yes,you are right PEZ,i do not like to make sonnet,i like femto and haiku.~;]sonnet is worse than mini,so you can see there are only 2 or 3 sonnet this time but many femto. -- iiley

Sonnets are much more complex to write than a femto or haiku, that's for sure. Of course, David and I were agreeing that while the state of the art in nanos always gets simplified and shrunk, the state of the art in line-based bots will continually get more complex. -- Kawigi

That's partly because we now count semicolons I think. In any case, it's even more silly than minibot coding. But fun for a change. I like the immediate trade-off situations when producing haikus. -- PEZ

...or especially when making femtos. But you're right. It's self-code-obfuscation as an art. I suspect it will be almost comical to look at a Sonnet sometimes. -- Kawigi

Robo Home | Changes | Preferences | AllPages
{"ft_lang_label":"__label__en","ft_lang_prob":0.5310976,"math_prob":0.8382213,"size":5073,"snap":"2020-34-2020-40","text_gpt3_token_len":1393,"char_repetition_ratio":0.16946143,"word_repetition_ratio":0.0123203285,"special_character_ratio":0.3222945,"punctuation_ratio":0.23877327,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95297223,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-28T15:36:05Z\",\"WARC-Record-ID\":\"<urn:uuid:d2bd6551-a161-442a-95a0-702bed8001c8>\",\"Content-Length\":\"7946\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:698a772d-53f4-411a-8fe7-9dfa5ec685ec>\",\"WARC-Concurrent-To\":\"<urn:uuid:25767f75-131a-4aa3-bc94-cd9b2e4b9c07>\",\"WARC-IP-Address\":\"95.217.7.6\",\"WARC-Target-URI\":\"http://old.robowiki.net/cgi-bin/robowiki?SonAsh\",\"WARC-Payload-Digest\":\"sha1:BURICWIJX7K4AWA5QYTXEHHLC3SE2QC2\",\"WARC-Block-Digest\":\"sha1:UN7M2UK2JTBFPYKJOWDE2O22PTHTNYUD\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600401601278.97_warc_CC-MAIN-20200928135709-20200928165709-00491.warc.gz\"}"}