コンピュータ MainStream の 478 番の書き込みへコメントを付けます.
ボード:
T-Net - 管理人室
フリートーク - フリートーク MainStream
音楽 - 音楽 MainStream
コンピュータ音楽 - コンピュータ音楽 MainStream
コンピュータ音楽 - MIDI
コンピュータ音楽 - DTM おすすめリンク集
コンピュータ音楽 - 音楽理論・作曲技術
コンピュータ音楽 - 習作 発表会
コンピュータ音楽 - オリジナル音楽 発表会
コンピュータ音楽 - 既存曲の研究
フラクタル・Math Art - フラクタル・Math Art MainStream
フラクタル・Math Art - TFEngine & T-Fract 開発室
コンピュータ - コンピュータ MainStream
コンピュータ - プログラミングのお話
コンピュータ - UNIX
コンピュータ - インターネット
ゲーム - ゲーム MainStream
ゲーム - PlayStation
ゲーム - PlayStation2
ハンドル(名前):
(guest)
Subject:
書き込み:(1行は折り返さないように30文字程度で改行してください。)
> package tos; > import robocode.*; > import java.awt.Color; > /** > * Robotos0 - a robot by (your name here) > */ > public class Robotos0 extends Robot > { > ScannedRobotEvent target; > /** > * run: Robotos0's default behavior > */ > public void run() { > // After trying out your robot, try uncommenting the import at the top, > // and the next line: > setColors(new Color(128, 160, 128), null, null); > setAdjustGunForRobotTurn (true); > turnRadarRight(360); > while(true) { > turnRight(target.getBearing() + 0); > ahead(200); > turnRadarRight(360); > } > } > /** > * onScannedRobot: What to do when you see another robot > */ > public void onScannedRobot(ScannedRobotEvent e) { > double degree; > target = e; > if (e.getDistance() > 400) return; > turnRadarRight (0); > degree = e.getBearing() + getHeading() - getGunHeading(); > if (degree < -180) degree += 360; > if (degree > 180) degree -= 360; > turnGunRight ( degree ); > fire (1); > } > /** > * onHitByBullet: What to do when you're hit by a bullet > */ > public void onHitByBullet(HitByBulletEvent e) { > turnLeft(90 - e.getBearing()); > ahead(50); > } > public void onHitWall(HitWallEvent e) > { > turnRight(target.getBearing()); > ahead(100); > } > }
■ メインページ