Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication45;
- import java.util.Random;
- class Characteristics {
- String[] direction = {"South", "West", "East"};
- }
- class Parameters {
- String[] speed = {"5", "1", "1"};
- }
- public class JavaApplication45 {
- public static void main(String[] args) {
- Characteristics characteristics = new Characteristics();
- Parameters parameters = new Parameters();
- Random random = new Random();
- int sec = 15;
- int overall = 0;
- int[] dir = new int[sec];
- int[] dir2 = new int[sec];
- for (int i = 0; i < sec; i++) {
- dir[i] = random.nextInt(characteristics.direction.length);
- dir2[i] = random.nextInt(characteristics.direction.length);
- }
- String pos[][] = new String[sec][sec];
- int x = 5;
- int y = 10;
- for (int i = 0; i < dir.length; i++) {
- for (int j = 0; j < dir.length; j++) {
- pos[i][j] = "\u00B7";
- }
- }
- for (int i = 0; i < dir.length; i++) {
- if (dir[i] == 1) {
- pos[i][x] = "/";
- x--;
- } else if (dir[i] == 2) {
- pos[i][x] = "\\";
- x++;
- } else if (dir[i] == 0) {
- pos[i][x] = "|";
- }
- }
- for (int i = 0; i < dir.length; i++) {
- if (dir2[i] == 1) {
- pos[i][y] = "/";
- y--;
- } else if (dir2[i] == 2) {
- pos[i][y] = "\\";
- y++;
- } else if (dir2[i] == 0) {
- pos[i][y] = "|";
- }
- }
- for (int i = 0; i < sec; i++) {
- for (int j = 0; j < sec; j++) {
- System.out.printf("%s ", pos[i][j]);
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement