Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // game loop
- while (true) {
- int SX = in.nextInt();
- int SY = in.nextInt();
- int max = 0;
- int maxI = 0;
- for (int i = 0; i < 8; i++) {
- int MH = in.nextInt(); // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.
- if(MH > max) {
- max = MH;
- maxI = i;
- System.err.println("Max = " + max);
- }
- }
- if(SX == maxI) {
- System.out.println("FIRE"); // either: FIRE (ship is firing its phase cannons) or HOLD (ship is not firing).
- } else {
- System.out.println("HOLD");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement