Sample Code: Making Robots in Java (JRobot)示例代码:使机器人在Java ( jrobot )
I talked about我曾谈及 JRobots, an extremely addictive Java game jrobots ,一个非常令人上瘾的java游戏 where you develop robots in java to fight against other JRobots in a monthly battle royale.如果您开发的机器人在Java打击其他jrobots在每月大逃杀。 Today I will present you with a simple sample JRobot to encourage you to participate in this contest.今天,我将目前你一个简单的样本jrobot鼓励你参加本次竞赛。 It kicks the butt of all sample JRobots provided in the download bundle and even some veterans.它踢屁股的所有样本jrobots提供的下载包,甚至一些退伍军人。
JRobots developers are hesitant to provide actual code because of two reasons; jrobots发展犹豫不决提供实际的程式码,因为两个原因;
1. 1 。 It will lead to proliferation of copy-cat JRobots with a different name which are just a waste of time for all.这将导致扩散复制猫jrobots与一个不同的名称,这只是浪费时间,为所有。
2. 2 。 Nobody likes to reveal their secrets没有人愿意透露他们的机密 ![]()
I have considered them over the years.我曾经考虑他们多年来。 I have come to the conclusion that the benefits of providing simple code for developers to begin with far outweighs other concerns.我已得出结论,认为好处,提供简单的程式码,为开发人员开始与远远超过其他关注的问题。 So here is a simple JRobot which despite its simplicity can really kick butt of many JRobots.因此,这里是一个简单的jrobot虽然简单真的可以踢屁股许多jrobots 。 It was initially released as CounterStrike.据初步公布的作为反击。 However now the CounterStrike code is slightly more sophisticated.不过,现在反击代码是稍微更复杂。 So I am releasing this JRobot named Simple.所以我释放这jrobot命名为简单。
public class __Simple_ extends JJRobot { void main() { int distance, angle = 0; while (true) { while((distance = scan(angle, 1)) == 0) angle++; cannon(angle, distance); drive(angle, 100); } } } 公共类__simple_延伸jjrobot (无效的Main ( ) (诠释的距离,角度= 0 ;则(真实) (而( (距离=扫描(角度来看, 1 ) ) == 0 )的角度来看+ + ;景隆(角度,距离) ;驱动器(角度看, 100 ) ; ) ) ) Download the source下载源码 here这里 . 。
You can see how easy it is to start coding JRobots.你可以看到它是如何的方便,开始编码jrobots 。 What are you waiting for?你还在等什么呢?
See you in the arena.看到你在舞台上。 My JRobots are Bizarro, Janeway, Shrike and CounterStrike.我jrobots是bizarro , janeway ,伯劳和反击。
Filed under提起下 Headline News头条新闻 , , How To如何 , , Java Software Java软件 , , Web网页 , , Web Services Web服务 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article电子邮件此文章
You may also like to read您也可以想读 |




































May 5th, 2006 at 11:55 am 2006年5月5日上午11时55分
necesito el codigo fuente del juego del gato en java … por favor atuda necesito下午codigo富恩特删除juego删除加托恩华…每间房有利于atuda