Robocode FAQ - 1.0.1 Thanks to Christian Krause for giving me a set of questions and answers to get started with on this. This FAQ includes updated answers (as of 1.0.1) to most questions he posted. I will add, modify, change based on feedback to this FAQ. Thanks much and have fun -- that's what it's all about! -Mat Robocode FAQ - 1.0.1 これのもとになった質問回答集を私に与えてくれた、Christian Krauseに感謝します。 このFAQは、彼がポストした質問のほとんどにたいする回答を(1.0.1に対応して)更新したものを、含んでいます。 私はこのFAQに、フィードバックに基づいて追加・修正・変更をします。 どうもありがとう。楽しんでください。 --- つまるところそれが本当の目的です! -Mat Q: Where can I find the latest version of this FAQ? A: http://robocode.alphaworks.ibm.com/help/robocode.faq.txt Q: このFAQの最新バージョンはどこにありますか? A: http://robocode.alphaworks.ibm.com/help/robocode.faq.txt Q: What distance unit is the game measured in? A: Pixels, if the game is not scaled down. Scaled-down pixels, if it is. Q: このゲームで測定される距離の単位はなんですか? A: ゲームが縮尺されていなければ、ピクセル数です。 縮尺されていれば、縮尺されたピクセル数です。 Q: What time unit is the game measured in? A: Frames, or ticks (like a clock tick), or turns, or simply timeslices. There is no one answer, although I'd love to standardize this if someone comes up with the perfect description. The method getTime() returns the current frame in the round, starting at 0. Q: このゲームで測定される時間の単位はなんですか? A: フレーム数、もしくは刻時数(時計の刻みのように)、もしくはターン数、もしくは単純にタイムスライス数です。 誰かが申し分のない説明を思いつけば私がこれを標準化したがっているにもかかわらず、 1つの答えはありません。 getTime()メソッドはそのラウンドにおける現在のフレームを返します。0からはじまります。 Q: What is the maximum velocity of a robot? A: 8 Q: ロボットの最大速度は? A: 8 Q: What is the acceleration and deceleration of a robot? A: Acceleration is 1 pixel/frame. Deceleration is at 2 pixels/frame. Q: ロボットの加速と減速は? A: 加速は1ピクセル/フレームです。減速は2ピクセル/フレームです。 Q: What is the maximum turning rate of a robot? A: (Thanks to Stuart for this one) 10 - .75 * getVelocity(); Q: ロボットの回転の割合の最大は? A: (これについてはStuartに感謝します。) 10 - 0.75 * getVelocity(); Q: What is the turning rate of the turret? A: 20 degrees/frame Q: 砲塔の回転の割合は? A: 20度/フレーム Q: What is the turning rate of the radar? A: 45 degrees/frame Q: レーダーの回転の割合は? A: 45度/フレーム Q: Do the turning rates of the robot/turret/radar affect each other? A: Yes. Since the radar is mounted on the gun, and the gun is mounted on the body, they can affect each other. If you are turning the gun left, and turning the radar right, the radar will only turn (45 - 20) = 25 degrees to the right. On the other hand, if they are both turning right, it will turn (45 + 20) = 65 degrees to the right. And of course, since the gun mounted on the body... Q: ロボット・砲塔・レーダーの回転の割合はお互いに影響しますか? A: はい。レーダーは大砲に搭載されていて、大砲は車体に搭載されているので、それらは互いに影響しえます。 大砲を左にレーダーを右に回転させているとすると、 レーダーは右に(45 - 20) = 25度しか回転しません。そうではなく、 両方とも右に回転させているとすると、レーダーは右に(45 + 20) = 65度回転します。 そしてもちろん、大砲は車体に搭載されているので……。 Q: Do the robot, turret, and radar have a rotational acceleration? A: No. Rotation is instantly at max turning rate. Q: ロボット・砲塔・レーダーには回転加速はありますか? A: いいえ。回転は即座に回転の割合の最大に達します。 Q: What happens when I hit a wall? A: Your robot's move is marked as complete, and (for AdvancedRobots) some damage is taken. The damage is: Math.abs(velocity) * .5 - 1; Q: 私が壁とぶつかったらどうなりますか? A: あなたのロボットの移動は完了したとマークされ、(AdvancedRobotなら)ダメージを受けます。 ダメージは: Math.abs(速度) * 0.5 - 1; Q: What happens when I hit another robot? A: If you are moving toward that robot, your move is marked as complete, and you receive 1.2 score points. Both robots take a constant .6 damage. Q: 私が他のロボットとぶつかったらどうなりますか? A: もしあなたがそのロボットに向かって動いていたら、あなたの動きは完了したとマークされ、あなたは1.2得点を受け取ります。 両方のロボットは一定の値0.6のダメージを受けます。 Q: What is the damage done by a bullet? A: damage = 4 * power; if (power > 1) damage += 2 * (power-1); Q: 弾丸によるダメージは? A: ダメージ = 4 * パワー; if (パワー > 1) ダメージ += 2 * (パワー - 1); Q: What is the power range of a bullet? A: .1 to 3 Q: 弾丸のパワーの範囲は? A: 0.1〜3 Q: What does it cost to fire a bullet? A: You transfer your energy to the bullet. So, fire(1) costs 1 energy. Q: 弾丸を発射すると何を費やしますか? A: あなたはエネルギーを弾丸に移し換えます。ですから、fire(1)はエネルギーを1消費します。 Q: Can I get that energy back? A: Yes, and then some. If the bullet hits another robot, you get 3 * power back... bullets steal energy. Q: そのエネルギーはもどりますか? A: はい、もっとたくさん。弾丸が他のロボットに命中すると、あなたは3 * パワー 取り戻します……。弾丸がエネルギーを奪うのです。 Q: What is the speed of a bullet? A: speed = 20 - 3 * power; So, 11 <= bullet speed <= 19.7 Q: 弾丸の速度は? A: 速度 = 20 - 3 * パワー; なので、11 <= 弾丸の速度 <= 19.7 Q: Do bullets inherit the velocity of the tank they are fired from? A: No. Q: 弾丸はそれを発射した戦車の速度を受け継ぎますか? A: いいえ。 Q: Why not? A: Umm... Err... They are energy bullets, and energy bullets defy normal laws of physics. :) Q: なぜですか? A: うーむ、えーと。それらはエネルギー弾丸で、エネルギー弾丸は物理学の通常の法則に逆らうのです。 :) Q: When can I fire a bullet? A: When getGunHeat() returns 0. Note that all guns are "hot" at the start of each round. Q: いつ私は弾丸を発射できますか? A: getGunHeat()が0を返すときです。各ラウンドの開始時にはすべての大砲が"熱い"ことに、注意してください。 Q: How much heat is generated when you fire? A: 1 + (firePower / 5); Q: 発射するときに発生する熱の量は? A: 1 + (発射パワー / 5); Q: How fast does gunheat drop? A: This is a battle setting. By default, .1 / tick. Q: どれだけはやく大砲の熱は下がりますか? A: これはバトルの設定です。デフォルトでは0.1/刻時です。 Q: What is 'disabled'? A: Disabled means you have 0 energy, but are not dead. You can recover from this state if a bullet you already fired hits someone. Q: 'disabled'とはなんですか? A: 'disabled'は、エネルギーは0だが死んではいないことを意味します。 すでに発射した弾丸が誰かに命中すれば、この状態から回復できます。 Q: What happens when I take an action, such as ahead(100)? A: Your thread goes to sleep, using Object.wait(). When all robots are in a wait state, the game updates positions and headings, generates events, then wakes up your thread. The first thing your thread does upon waking up is process any pending events. Q: 私が行動をとると何が起こりますか?たとえばahead(100)のような。 A: あなたのスレッドはObject.wait()によって眠りにつきます。 すべてのロボットが待機状態になると、ゲームは位置と方向を更新し、 イベントを生成し、それからあなたのスレッドを目覚めさせます。 スレッドが目覚めると最初にすることは、イベントキューにあるイベントすべてを処理することです。 Q: When is onSkippedTurn() called? A: If you process for an extremely long time, you will "skip a turn", which means you lose the opportunity to take action this frame. You will NOT receive this event until you finally do take action. If you skip two turns in a row, you will lose events. If you skip 30 turns in a row, you will be removed from the round and receive no score. The length of a turn is roughly 15 milliseconds per robot (varies by system) Q: いつonSkippedTurn()は呼び出されますか? A: あなたがきわめて長い時間に渡って処理をすると、あなたは"ターンをスキップ"します。 これは、あなたがこのフレームで行動をとる機会を無くしたことを意味します。 あなたはこのイベントを、ついに行動をとるまでは受け取り*ません*。 もしあなたが連続して2ターンをスキップすると、あなたはイベントを逸します。 もしあなたが連続して30ターンをスキップすると、あなたはそのラウンドから取り除かれ 得点は得られません。1ターンの長さは大体15ミリ秒/ロボットです(システムにより異なります)。 Q: Is acceleration applied before or after you move? A: Acceleration is applied after turning, and before you move. Heading, then acceleration, then velocity, then x/y. Q: 加速度が働くのは移動の前ですか、それとも後ですか? A: 加速度は回転の後・移動の前に働きます。 ヘディング、そして加速度、そして速度、そして(x, y)の順です。 Q: If I access the event queue while handling an event, is the event I'm handling still there? A: No, events are removed from the queue just before calling the event handler. Q: あるイベントをハンドルしているときにイベントキューにアクセスすると、そのイベントはまだキューにありますか? A: いいえ、イベントはイベントハンドラを呼び出す直前にキューから取り除かれます。 Q: How do I use getAllEvents()? A: (Based on answer from Graygoo) Add a condition that calls a function to record the state. For example: public void run() { addCustomEvent(new Condition("recordEverything") { public boolean test() { MyRobot.this.recordState(); return false; // False so we don't trigger an onCustomEvent handler } }; } public void recordState() { // call getAllEvents() clearAllEvents(); } Q: getAllEvents()はどのように使いますか? A: (Graygooの回答に基づきます。) ステートを記録するための機能を呼び出す条件(Condition)を追加してください。例えば: public void run() { addCustomEvent(new Condition("recordEverything") { public boolean test() { MyRobot.this.recordState(); return false; // falseなのでonCustomEventハンドラをトリガしません。 } }; } public void recordState() { // getAllEvents()を呼び出してください clearAllEvents(); } Q: Can I use an external IDE to compile robots? A: Yes, simply link to robocode.jar Q: 外部のIDEを使ってロボットをコンパイルできますか? A: はい、robocode.jarにリンクしてください。 Q: How big is the scan area? A: It's a pie are, 1200 in length, sweeping from the last position of your radar to the current position. You can see this by selecting "Visible scan arcs" in the options menu. Q: レーダー走査範囲の大きさは? A: パイのようで、長さは1200で、あなたのレーダーを最近の位置から現在の位置にさっと動かします。 Optionsメニューの中の"Visible Scan Arcs"を選ぶと、レーダー走査範囲を見ることができます。 Q: In what order to scanned robot events arrive? A: The events are sorted by distance, closest first. Q: ScannedRobotEventはどういう順序で送られてきますか? A: ScannedRobotEventは距離順でソートされ、最も近い物が最初です。 Q: In what order to the other events arrive? A: They are sorted by priority. You can see the default priorities in the AdvancedRobot api for setEventPriority. Q: それ以外のイベントはどういう順序で送られてきますか? A: 優先度でソートされます。デフォルトの優先度はAdvancedRobotのAPI文書のsetEventPriorityのところに書いてあります。 Q: Sometimes I don't receive the xxxx event. Why? A: If you take a time-consuming action (such as ahead(100) while handling an event, all events of lower or equal priority will be lost until that action ends. This includes custom events, which have a very high default priority (80). Q: xxxxイベントを受け取らないことがあります。なぜでしょう? A: あるイベントをハンドルしている間に、時間を消費する行動(ahead(100)など)を取ると、 優先度が同じもしくは低いすべてのイベントは、その行動が終わるまでは取り逃がされます。 これには、非常に高いデフォルトの優先度(80)を持つ、カスタムイベントも含まれます。 Q: So how do I avoid this? A: Event handlers, as a rule, should return quickly. You could, for example, simply set a state that indicates what you'd like to do, and take that action in your run() method. You might even create a very low-priority custom event that fires every turn. Q: ではどうやってこの現象を避けますか? A: イベントハンドラからは、たいていの場合、素早く戻ったほうがいいでしょう。 たとえばあなたは、何をしたいかを示すステートを設定するだけにして、run()メソッドの中でその行動を取ることができます。 すべてのターンで打ち出される、非常に優先度の低いカスタムイベントを作ることもできます。 Q: What about setInterruptible (AdvancedRobot)? A: setInterruptible will allow events of the SAME priority to restart the current event handler during an action. Q: setInterruptible(AdvancedRobotクラスのメソッド)はどういうものですか? A: setInterruptibleは、行動の間*同じ*優先度のイベントに、現在のイベントハンドラを再スタートできるようにします。 Q: What happens to the currently executed command in run(), when a similar command in an event is executed? A: The latter takes precedence. Q: run()のなかで現在実行されている命令は、イベントの中で類似の命令が実行されるとどうなりますか? A: 後者が優先されます。 Q: What's coming next for Robocode? A: The current todo-list can be seen at http://robocode.net/robocode.todo.txt Q: 次にRobocodeに起こることはなんですか? A: 現時点のtodo-リストを http://robocode.net/robocode.todo.txt で見ることができます。