Skip to content

Commit

Permalink
Update LightBoard.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chyeung1 authored Apr 30, 2024
1 parent bfca9f4 commit 6fb4136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/LightBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class LightBoard
public LightBoard(int numRows, int numCols)
{
/* to be implemented in part (a) */
lights = new boolean[numRows][numCols];
int index = 0;
for(int i = 0; i < numRows; i++){
while(i < numCols){
Expand All @@ -34,9 +35,9 @@ public boolean evaluateLight(int row, int col)
for(int i = 0; i < col; i++)
if(lights[row][i]) count++;
if(lights[row][col]){
return (count % 2 != 0);
if(count % 2 == 0) return false;
} else if(!lights[row][col])
return count % 3 == 0;
if(count % 3 == 0) return true;
return lights[row][col];


Expand Down

0 comments on commit 6fb4136

Please sign in to comment.