Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import Prog1Tools.IOTools;
- public class BinaryMap {
- public static void main(String[] args) {
- boolean[][] array = generateRandomArray();
- // for (int i = 0; i < array.length; i++) {
- // printArray(array[i]);
- // }
- }
- private static void printArray(boolean[] booleans) {
- }
- /**
- * Ändert einen Wert im gegebenen daten-Array;
- * aus wahr wird falsch und aus falsch wird wahr
- *
- * @param daten - Array welches verändert werden soll
- * @param x - x-Koordinate des Wertes
- * @param y - y-Koordinate des Wertes
- */
- static void updateArray(boolean[][] daten, int x, int y) {
- }
- private static boolean[][] generateRandomArrayFix() {
- // Random rand = new Random();
- /*
- * 10 random aus 100
- */
- boolean[][] randomArray;
- int x = 10, y = 10;
- randomArray = new boolean[x][y];
- for (x = 0; x < randomArray.length; x++) {
- for (y = 0; y < randomArray.length; y++) {
- randomArray[x][y] = false;
- }
- }
- return randomArray;
- }
- private static boolean[][] generateRandomArray() {
- Random rand = new Random();
- int rowWidth = IOTools.readInt("Enter Grid Width: ");
- int colHeight = IOTools.readInt("Enter Grid Height: ");
- boolean[][] board = new boolean[rowWidth][colHeight];
- for (int idx = 1; idx <= 10; ++idx) {
- //fill the grid
- for (int row = 0; row < board.length; row++) {
- for (int col = 0; col < board[row].length; col++) {
- board[col][row] = rand.nextBoolean();
- }
- }
- //display output
- for (int i = 0; i < board.length; i++) {
- for (int j = 0; j < board[i].length; j++) {
- System.out.print(board[i][j] + " ");
- //System.out.println();
- }
- System.out.println();
- }
- return board;
- }
- return board;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement