Skip to content

Instantly share code, notes, and snippets.

@vchatela
Last active February 2, 2016 21:43
Show Gist options
  • Save vchatela/ca8aacb23eb433bebb41 to your computer and use it in GitHub Desktop.
Save vchatela/ca8aacb23eb433bebb41 to your computer and use it in GitHub Desktop.
Codingame : The Descent Solution
import java.util.*;
import java.io.*;
import java.math.*;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
class Player {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int heightest;
int maxHeight;
// game loop
while (true) {
heightest = 0;
maxHeight = 0;
int SX = in.nextInt();
int SY = in.nextInt();
in.nextLine();
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.
in.nextLine();
if(maxHeight < MH) {
maxHeight = MH;
heightest = i;
}
}
if(SX == heightest)
System.out.println("FIRE");
else
System.out.println("HOLD");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment