Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. package javaapplication45;
  2.  
  3. import java.util.Random;
  4.  
  5. class Characteristics {
  6.     String[] direction = {"South", "West", "East"};
  7. }
  8.  
  9. class Parameters {
  10.     String[] speed = {"5", "1", "1"};
  11. }
  12.  
  13. public class JavaApplication45 {
  14.     public static void main(String[] args) {
  15.         Characteristics characteristics = new Characteristics();
  16.         Parameters parameters = new Parameters();
  17.         Random random = new Random();
  18.        
  19.         int sec = 15;
  20.         int overall = 0;
  21.         int[] dir = new int[sec];
  22.         int[] dir2 = new int[sec];
  23.        
  24.         for (int i = 0; i < sec; i++) {
  25.             dir[i] = random.nextInt(characteristics.direction.length);
  26.             dir2[i] = random.nextInt(characteristics.direction.length);
  27.         }
  28.        
  29.         String pos[][] = new String[sec][sec];
  30.         int x = 5;
  31.         int y = 10;
  32.         for (int i = 0; i < dir.length; i++) {
  33.             for (int j = 0; j < dir.length; j++) {
  34.                 pos[i][j] = "\u00B7";
  35.             }
  36.         }
  37.         for (int i = 0; i < dir.length; i++) {
  38.             if (dir[i] == 1) {
  39.                 pos[i][x] = "/";
  40.                 x--;
  41.             } else if (dir[i] == 2) {
  42.                 pos[i][x] = "\\";
  43.                 x++;
  44.             } else if (dir[i] == 0) {
  45.                 pos[i][x] = "|";
  46.             }
  47.         }
  48.        
  49.         for (int i = 0; i < dir.length; i++) {
  50.             if (dir2[i] == 1) {
  51.                 pos[i][y] = "/";
  52.                 y--;
  53.             } else if (dir2[i] == 2) {
  54.                 pos[i][y] = "\\";
  55.                 y++;
  56.             } else if (dir2[i] == 0) {
  57.                 pos[i][y] = "|";
  58.             }
  59.            
  60.         }
  61.         for (int i = 0; i < sec; i++) {
  62.             for (int j = 0; j < sec; j++) {
  63.                 System.out.printf("%s ", pos[i][j]);
  64.             }
  65.             System.out.println();
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement