-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5ceca4
commit 7efd57b
Showing
1 changed file
with
38 additions
and
6 deletions.
There are no files selected for viewing
44 changes: 38 additions & 6 deletions
44
your_code_here/src/nl/ordina/nerdingout/round_3/WalTal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,44 @@ | ||
package nl.ordina.nerdingout.round_3; | ||
|
||
import java.awt.Color; | ||
|
||
import robocode.AdvancedRobot; | ||
import robocode.HitRobotEvent; | ||
import robocode.HitWallEvent; | ||
import robocode.ScannedRobotEvent; | ||
import static robocode.util.Utils.*; | ||
|
||
public class WalTal extends AdvancedRobot { | ||
@Override | ||
public void run() { | ||
while(true) { | ||
// start your engines for round 3! | ||
} | ||
} | ||
@Override | ||
public void run() { | ||
setTurnLeft(Math.random() * 90); | ||
setAdjustRadarForRobotTurn(true); | ||
setColors(Color.CYAN, Color.YELLOW, Color.MAGENTA); | ||
turnLeft(getHeading()); | ||
setAhead(1000); | ||
while (true) { | ||
turnRadarLeft(90); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void onHitWall(HitWallEvent event) { | ||
turnRight(90); | ||
setAhead(100000); | ||
} | ||
|
||
@Override | ||
public void onScannedRobot(ScannedRobotEvent event) { | ||
if (event.getDistance() < 300) { | ||
turnGunRight(normalRelativeAngleDegrees(((getHeading() - | ||
getGunHeading()) + event.getBearing()))); | ||
setFire(3); | ||
} | ||
} | ||
|
||
@Override | ||
public void onHitRobot(HitRobotEvent event) { | ||
setAhead(100000); | ||
} | ||
} |