KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > thewayout > two > SteeringConstants


1 package de.thewayout.two;
2
3 /**
4  * The interface SteeringConstants contains only constants for use
5  * by the framework and your classes. Just let your classes
6  * implement this interface to make all constants known within your
7  * class.
8  *
9  *
10  * @author Steffen Gemkow
11  */

12 public interface SteeringConstants {
13
14     /**
15      * The constant MIN_SPEED defines the lowest possible speed (0).
16      * Remember to slow down to MIN_SPEED before changing direction.
17      */

18     public static final long MIN_SPEED = 0;
19
20     /**
21      * The constant MAX_SPEED defines the upper speed limit in our little universe.
22      * No space ship (not even robots) can go faster than this. But be careful:
23      * the more you speed up, the more you have to slow down. And you can scan
24      * only a few positions around (not enough when going full speed).
25      */

26     public static final long MAX_SPEED = 10;
27
28     /**
29      * Command to set new direction. Changing direction requires the speed to be 0!
30      */

31     public static final int STEERING_TURN_X_PLUS = 0;
32
33     /**
34      * Command to set new direction. Changing direction requires the speed to be 0!
35      */

36     public static final int STEERING_TURN_X_MINUS = 1;
37
38     /**
39      * Command to set new direction. Changing direction requires the speed to be 0!
40      */

41     public static final int STEERING_TURN_Y_PLUS = 2;
42
43     /**
44      * Command to set new direction. Changing direction requires the speed to be 0!
45      */

46     public static final int STEERING_TURN_Y_MINUS = 3;
47
48     /**
49      * Command to set new direction. Changing direction requires the speed to be 0!
50      */

51     public static final int STEERING_TURN_Z_PLUS = 4;
52
53     /**
54      * Command to set new direction. Changing direction requires the speed to be 0!
55      */

56     public static final int STEERING_TURN_Z_MINUS = 5;
57
58     /**
59      * Command for increasing speed. Watch your way and remember that slowing down
60      * needs time as well. ;-)
61      */

62     public static final int STEERING_SPEED_UP = 6;
63
64     /**
65      * Command for decreasing speed. You probably detected something in your way
66      * and want to avoid any demage. Hope it's not to late for that. ;-)
67      */

68     public static final int STEERING_SLOW_DOWN = 7;
69
70     /**
71      * Command for leaving everything unchanged (speed and direction are fine).
72      */

73     public static final int STEERING_NO_CHANGE = 8;
74
75     /**
76      * Constant which maybe returned by getDirection() indicating the
77      * next step would leed to a position with a higher x value.
78      *
79      * @see de.thewayout.two.SpaceShip#getDirection()
80      */

81     public static final int DIRECTION_X_PLUS = STEERING_TURN_X_PLUS;
82
83     /**
84      * Constant which maybe returned by getDirection() indicating the
85      * next step would leed to a position with a lower x value.
86      *
87      * @see de.thewayout.two.SpaceShip#getDirection()
88      */

89     public static final int DIRECTION_X_MINUS = STEERING_TURN_X_MINUS;
90
91     /**
92      * Constant which maybe returned by getDirection() indicating the
93      * next step would leed to a position with a higher y value.
94      *
95      * @see de.thewayout.two.SpaceShip#getDirection()
96      */

97     public static final int DIRECTION_Y_PLUS = STEERING_TURN_Y_PLUS;
98
99     /**
100      * Constant which maybe returned by getDirection() indicating the
101      * next step would leed to a position with a lower y value.
102      *
103      * @see de.thewayout.two.SpaceShip#getDirection()
104      */

105     public static final int DIRECTION_Y_MINUS = STEERING_TURN_Y_MINUS;
106
107     /**
108      * Constant which maybe returned by getDirection() indicating the
109      * next step would leed to a position with a higher z value.
110      *
111      * @see de.thewayout.two.SpaceShip#getDirection()
112      */

113     public static final int DIRECTION_Z_PLUS = STEERING_TURN_Z_PLUS;
114
115     /**
116      * Constant which maybe returned by getDirection() indicating the
117      * next step would leed to a position with a lower z value.
118      *
119      * @see de.thewayout.two.SpaceShip#getDirection()
120      */

121     public static final int DIRECTION_Z_MINUS = STEERING_TURN_Z_MINUS;
122
123     /** Constant POSITION_STATUS_UNKNOWN describes whot is known about a position out of reach: nothing. */
124     public static final int POSITION_STATE_UNKNOWN = -1;
125
126     /**
127      * Constant POSITION_STATUS_FREE describes a position as free (it is obviously whithin reach).
128      * A SpaceShip can get on that position.
129      */

130     public static final int POSITION_STATE_FREE = 0;
131
132     /**
133      * Constant POSITION_STATUS_BLOCKED describes a position as blocked (it is obviously whithin reach).
134      * No Spaceship can get on that position, because it is used by a planet or something.
135      */

136     public static final int POSITION_STATE_BLOCKED = 1;
137
138     /** Constant POWER_SPEED_UP defines the amount of power used up by speeding up. */
139     long POWER_SPEED_UP = 2;
140
141     /** Constant POWER_SLOW_DOWN defines the amount of power used up by slowing down. */
142     long POWER_SLOW_DOWN = 2;
143
144     /** Constant POWER_CHANGE_DIR defines the amount of power used up by changing direction. */
145     long POWER_CHANGE_DIR = 1;
146
147     /** Constant POWER_CHANGE_DIR defines the amount of power used by life support (once per time slice). */
148     long POWER_LIFE_SUPPORT = 1;
149
150     /** Constant POWER_FACTOR_CRASH defines the factor by which the speed of a ship is mutliplied to
151      * calculate the power consumed by the shields when chrashing into a blocked position. */

152     long POWER_FACTOR_CRASH = 3;
153
154     /** Constant POWER_FACTOR_ROBOT_CRASH defines the factor by which the speed of a ship is mutliplied to
155      * calculate the power consumed by the shields when chrashing into another ship. */

156     long POWER_FACTOR_ROBOT_CRASH = 5;
157
158     /**
159      * Constant CAUSE_SPEED_UP defines the string explaning speeding up
160      * to be the cause of power consumption.
161      */

162     String JavaDoc CAUSE_SPEED_UP = "speed_up";
163
164     /**
165      * Constant CAUSE_SLOW_DOWN defines the string explaning
166      * breaking (slowing down) to be the cause of power consumption.
167      */

168     String JavaDoc CAUSE_SLOW_DOWN = "slow_down";
169
170     /**
171      * Constant CAUSE_CHANGE_DIR defines the string explaning a change
172      * in direction to be the cause of power consumption.
173      */

174     String JavaDoc CAUSE_CHANGE_DIR = "change_dir";
175
176     /**
177      * Constant CAUSE_LIFE_SUPPORT defines the string explaning regular and permanant
178      * activities (like life support) to be the cause of power consumption.
179      */

180     String JavaDoc CAUSE_LIFE_SUPPORT = "life_support";
181
182     /**
183      * Constant CAUSE_CRASH defines the string explaning a crash with a blocked position
184      * to be the cause of power consumption.
185      */

186     String JavaDoc CAUSE_CRASH = "crash";
187
188     /**
189      * Constant CAUSE_ROBOT_CRASH defines the string explaning a crash with a robot
190      * to be the cause of power consumption.
191      */

192     String JavaDoc CAUSE_ROBOT_CRASH = "robot_crash";
193 }
194
Popular Tags