-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alphonse.java
61 lines (53 loc) · 1.13 KB
/
Alphonse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package KKJ;
import robocode.*;
import java.awt.Color;
/**
* Alphonse - a robot by Kevin, Kieran, & Joe
*/
public class Alphonse extends Robot
{
public void run() {
setBodyColor(new Color(140, 172, 183));
setGunColor(new Color(94, 125, 127));
setRadarColor(new Color(139, 172, 181));
setScanColor(new Color(153, 217, 234));
setBulletColor(new Color(227, 66, 52));
int count = 0;
turnRight(360-getHeading());
ahead((getBattleFieldHeight()-getY())-100);
turnRight(90);
ahead((getBattleFieldWidth()-getX())-100);
turnGunRight(90);
while(true) {
if (count == 0)
{
turnRight(90);
ahead(getY()-100);
count++;
}
if (count == 1)
{
turnRight(90);
ahead(getX()-100);
count++;
}
if (count == 2)
{
turnRight(90);
ahead((getBattleFieldHeight()-getY())-100);
count++;
}
if (count == 3)
{
turnRight(90);
ahead((getBattleFieldWidth()-getX())-100);
count = 0;
}
}
}
public void onScannedRobot(ScannedRobotEvent e) {
fire(2);
}
/*public void onHitRobot(HitRobotEvent e){
}*/
}