Advertisement
Guest User

HAlp

a guest
Mar 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. /** [Unit2BattleRoyale.java]
  2. * @version 1.0
  3. * @Jeffew Cheung
  4. * @03/21/2019
  5. * Battle Roayle game
  6. */
  7.  
  8. import java.io.PrintWriter;
  9. import java.io.File;
  10. import java.util.Scanner;
  11. import java.util.Random;
  12.  
  13. class Royale{
  14. public static void main (String [] args)throws Exception{
  15. File myFile = new File ("map.txt");
  16. Random rand = new Random();
  17. Scanner input = new Scanner(myFile);
  18.  
  19. int width = input.nextLine().length();
  20. String[][] map = new String[11][11];
  21.  
  22. for (int i = 0; i<map.length;i++){
  23. for(int j =0;j<map.length;j++){
  24. map[i][j] = input.next();
  25. }
  26. }
  27. for (int i = 0; i< map.length; i++){
  28. for (int j =0; j<map.length;j++){
  29. System.out.print(map[i][j] +" ");
  30. }
  31. System.out.println();
  32. }
  33.  
  34. for (int i = 0; i< map.length; i++){
  35. for (int j = 0; j< map.length; j++){
  36. if (map [i][j].equals("p")){
  37. System.out.println (i+" " +j);
  38. }
  39. if (i == map.length/2 && j == map.length/2){
  40. System.out.println (i+" "+j);
  41. }
  42. }
  43. }
  44. // int playerMove = move([][]map);
  45. input.close();
  46. }
  47. }
  48.  
  49. public static int move(String[][]map){
  50. for (int i = 0; i< map.length; i++){
  51. for (int j = 0; j< map.length; j++){
  52. if (map [i][j].equals("p")){
  53. if (i == map.length/2 && j == map.length/2){
  54.  
  55.  
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement