Skip to content

Commit

Permalink
Update LightBoard.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chloehuang16 authored Apr 30, 2024
1 parent 0c7f914 commit 0cd404c
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/main/java/LightBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ public class LightBoard
public LightBoard(int numRows, int numCols)
{
/* to be implemented in part (a) */
this.lights = new boolean[numRows][numCols];
for (int i = 0; i<this.lights.length;i++){
for (int j = 0; j<this.lights[i].length;j++){
if (Math.random<0.4){
this.lights[i][j] = true;
}
else{
this.lights[i][j] = false;
}
lights = new boolean[numRows][numCols];
for (int i = 0; i<numRows; i++){
for (int j = 0; j<numCols; j++){
double num = Math.random();
lights[i][j] = num <0.4;
}
}

Expand All @@ -36,7 +32,7 @@ public boolean evaluateLight(int row, int col)
if(lights[row][col] == true){
for (int i = 0; i<lights.length;i++){
if (lights[i][col] == true){
numOn;
numOn++;
}
}
if (numOn % 2 == 0){
Expand Down

0 comments on commit 0cd404c

Please sign in to comment.