Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** [Unit2BattleRoyale.java]
- * @version 1.0
- * @Jeffew Cheung
- * @03/21/2019
- * Battle Roayle game
- */
- import java.io.PrintWriter;
- import java.io.File;
- import java.util.Scanner;
- import java.util.Random;
- class Royale{
- public static void main (String [] args)throws Exception{
- File myFile = new File ("map.txt");
- Random rand = new Random();
- Scanner input = new Scanner(myFile);
- int width = input.nextLine().length();
- String[][] map = new String[11][11];
- for (int i = 0; i<map.length;i++){
- for(int j =0;j<map.length;j++){
- map[i][j] = input.next();
- }
- }
- for (int i = 0; i< map.length; i++){
- for (int j =0; j<map.length;j++){
- System.out.print(map[i][j] +" ");
- }
- System.out.println();
- }
- for (int i = 0; i< map.length; i++){
- for (int j = 0; j< map.length; j++){
- if (map [i][j].equals("p")){
- System.out.println (i+" " +j);
- }
- if (i == map.length/2 && j == map.length/2){
- System.out.println (i+" "+j);
- }
- }
- }
- // int playerMove = move([][]map);
- input.close();
- }
- }
- public static int move(String[][]map){
- for (int i = 0; i< map.length; i++){
- for (int j = 0; j< map.length; j++){
- if (map [i][j].equals("p")){
- if (i == map.length/2 && j == map.length/2){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement