经典Robocode例子代码
经典Robocode例子代码 |
||||
作者:Alisdair | ||||
//*----------------------------------------------------------------------------------------------------------------*//
//* 翻译:天翼.李(Skyala.Li) //* 版权:Alisdair //* 译权:Robocode 中华联盟 www.robochina.org //* 有关翻译中的任何问题请与Skyala.Li联系:robocode@etang.com //* 转载请保留此文件头 @2002.10 31 All Rights Reserved //*----------------------------------------------------------------------------------------------------------------*// 经典Robocode新手入门例子,包括了移动,雷达,炮管。。。,看完它并应用它,保你Robocode一日千里。 注:翻译风格有所改变,有部分没有进行翻译,有些加入了天翼.李(Skyala.Li)的心得。我们在此只注重原理,不重形式。 大家可自行看看没有翻译的部分,也正好学习外语嘛!最后引入了About Duelist,快打到世界第一的机器人发展过程的一段文字。 此物出天上,望君好收藏!源代码也可于此下载(Skyala.li)
/** *About Duelist I started Duelist as a general purpose bot, based off of SnippetBot by Alisdair Owens. I quickly realized that melee and duel matches were two completely different ball games and for a time my code was riddled with if(duel) statements. Eventually I decided that I would focus on duels since they present a much simpler and more elegant problem than melee, to me at least, and Duelist was born. Duelist uses many common concepts found in the top bots. Among them, it fires virtual bullets, the idea made famous by SandboxLump (written by Paul Evans). Duelist also uses anti-gravity for movement, though it has been thoroughly overhauled to eliminate the problems with anti-gravity, such as getting stuck in a local minimum. I also keep statistics on how well my various targetting methods are doing in a data structure that persists from round to round, so that I can learn which methods work the best without having to guess randomly at the start of each round. Some things I think I'm the only bot out there doing: Conduct my initial radar sweep by turning the body, gun, and radar before setting them to move independantly. This saves about 3 turns in the beginning. Firing virtual bullets ONLY when I fire a real one. Although this slows down my learning, there's no better way to learn the movement of bots that attempt bullet dodging. Since they move when I fire, I learn only their dodging movement. Changing bullet power based on how hard the enemy is to hit as well as the current range. It's silly to fire a .5 power bullet at SittingDuck just because he's 900 units away from you. I'm sure someone else is doing this but I don't know of any personally so I'll list it here. In a straightforward anti-gravity movement system, you resolve the forces and move along the vector. If you visualize the battlefield as terrain with anti-gravity points being hills, what you're doing is always rolling downhill. However, you can get trapped in bad places this way. For example, if you're cornered, the walls will be repelling pushing you towards the enemy and the enemy will push you towards the walls, and you'll jiggle in place while he shoots you at his leisure. The method that I use to avoid this is to test how much force is at many different points around me and move towards the one with the lowest force. Using the hill analogy, rather than rolling downhill, I'm going to the place with the lowest elevation... even if I have to travel uphill for a while before I can go downhill to get there. I encourage you to play with this on your own, it certainly helped my bot's performance. :-) I may add more to this page if I discover that anyone is interested. */ |
经典Robocode例子代码相关推荐
- 经典Robocode例子代码- -SnippetBot
经典Robocode例子代码 - -SnippetBot 看过了Robocode的文章,对Robocde有了个大概了解,现在我我们就一个经典的Robocode例子源代码来分析Robocode也jav ...
- 经典Robocode例子代码--SnippetBot
经典Robocode例子代码 - -SnippetBot 看过了Robocode的文章,对Robocde有了个大概了解,现在我我们就一个经典的Robocode例子源代码来分析Robocode也jav ...
- 归算法及经典递归例子代码实现
递归(recursion):程序调用自身的编程技巧. 递归满足2个条件: 1)有反复执行的过程(调用自身) 2)有跳出反复执行过程的条件(递归出口) 递归例子: (1)阶乘 n! = n * (n-1 ...
- 经典php代码,HTML_php教程:经典PHP代码,经典循环例子
HTMLHEAD - phpStudy
经典循环例子 经典循环例子 for($counter = 1; $counter <= 6; $counter++) //循环6次 { print("counter is ...
- 经典php代码,10个非常经典的php代码片段.doc
10个非常经典的php代码片段.doc 还剩 8页未读, 继续阅读 下载文档到电脑,马上远离加班熬夜! 亲,喜欢就下载吧,价低环保! 内容要点: 27. set_error_handler('nett ...
- Python:利用python语言绘制多个子图经典案例、代码实现之详细攻略
Python:利用python语言绘制多个子图经典案例.代码实现之详细攻略 目录 利用python语言绘制多个子图代码实现.经典案例 1.绘制多个子图框架 多个子图绘制的经典案例 1.绘制多个直方图 ...
- FileInputStream与FileOutputStream 复制文件例子代码
FileInputStream与FileOutputStream 复制文件例子代码 try {File sourceFile = new File("C:\\Users\\prize\\De ...
- java2实用教程第5版第九章_java2实用教程(例子代码)第4版第九章.doc
java2实用教程(例子代码)第4版第九章 java2实用教程(例子代码)第4版第九章 例9_3 Lt4_3.java public clss Lt4_3 { public static void m ...
- Js+Css打造的红色经典伸缩菜单代码
代码简介: JS+Css伸缩菜单,红色,很好看.注:IE6下好像有点不正常,用的朋友自己修正下! 代码内容: <!DOCTYPE html PUBLIC "-//W3C//DTD XH ...
最新文章
- 用800行代码做个行为树(Behavior Tree)的库(2
- java中处理打折率_【JAVA300例】13、输入价格判断折扣,switch用法+int留整数方便判断...
- 2017.9.19 禁忌 失败总结
- 跟我学算法-集成算法
- 什么是面向服务的体系结构(SOA)?(转载)
- 同济大学 线性代数 第六版 pdf_线性代数思维导图专题
- 研磨设计模式之工厂方法模式-2
- windows7下的docker的安装及使用(持续更新,未完待续,每天一点点)
- 13个提炼卖点的角度,让你的产品大卖!
- 也谈360软件是否可靠
- Elastic:如何摄入 Websocket 数据到 Elasticsearch
- Mysql入门到放弃
- 直播预告:SIGDIAL2020最佳论文一作高信龙一评测任务导向型对话系统|AI TIME PHD对话系统专题-1...
- 【机器学习】阿里云天池竞赛——工业蒸汽量预测(1)
- idw matlab 程序_IDW 算法MATLAB 实现
- CoreData基础
- PAT(乙级)2020年春季考试真题解析
- 直流电机及PWM介绍
- 2、气体灭火系统的设计灭火浓度
- 信贷系统——增加2种模式访问模式A模式(通过销售人员入户的)B模式(通过Erp入户的)