Merge branch 'master' of
https://gitarero.ecam.fr/maxime.lobietti/OOP_F2_Project.git Conflicts: src/backend/Grid.java
This commit is contained in:
commit
df9cec1421
|
|
@ -8,4 +8,4 @@ public class Main {
|
||||||
mjf.setVisible(true);
|
mjf.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ import java.util.Random;
|
||||||
/**
|
/**
|
||||||
* The Grid class represents a 2D grid of integers.
|
* The Grid class represents a 2D grid of integers.
|
||||||
*/
|
*/
|
||||||
public class Grid {
|
public class Grid {
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
private final int[][] grid;
|
private final int[][] grid;
|
||||||
|
|
@ -15,7 +15,7 @@ public class Grid {
|
||||||
*
|
*
|
||||||
* @param width the width of the grid
|
* @param width the width of the grid
|
||||||
* @param height the height of the grid
|
* @param height the height of the grid
|
||||||
*/
|
*/
|
||||||
public Grid(int width, int height) {
|
public Grid(int width, int height) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
@ -63,8 +63,8 @@ public class Grid {
|
||||||
public void fillRandom(float randomness) {
|
public void fillRandom(float randomness) {
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
int rando = rand.nextInt(100);
|
int rando = rand.nextInt(100);
|
||||||
int r = (int) (randomness * 100);
|
int r = (int) (randomness * 100);
|
||||||
if (rando < r) {
|
if (rando < r) {
|
||||||
grid[y][x] = 1;
|
grid[y][x] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue