-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.java
47 lines (41 loc) · 1.67 KB
/
Main.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
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Main {
// Welcome to Battlesnake!
// This is a Java Battlesnake server that implements a simple input/output
// system described below
public static void main(String[] args) throws IOException {
char grid[][] = new char[11][11]; // The battlesnake grid will be 11x11
// use this Buffered Reader to read input
BufferedReader br = new BufferedReader(new FileReader("input.txt"));
/**
* First, read the 11x11 char array as the Battlesnake board
* (an example of the input can be found in sample_input.txt)
*
* "H" represents your snake's head
* "B" represents a segment of your snake's body
* "T" represents your snake's tail
*
* "h" represents an enemy snake's head
* "b" represents a segment of an enemy snake's body
* "t" represents a an enemy snake's tail
*
* "." represents empty space
* "f" represents a food pellet
*/
for (int i = 0; i < 11; i++) {
String line = br.readLine().trim();
grid[i] = line.toCharArray();
}
/**
* This is the remaining health of your snake (a number from 1 to 100)
*/
int health_remaining = Integer.parseInt(br.readLine());
/**
* TODO: calculate the move that you want YOUR Battlesnake to make (either "up",
* "down", "left", or "right") and output it using System.out.println()
*/
System.out.println("up"); // just an example. replace this with the move of your choice
}
}