-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworking field update with HUGE Performance Enhancements
- Loading branch information
Showing
5 changed files
with
166 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
X-COMMENT: Main-Class will be added automatically by build | ||
Main-Class : Main | ||
|
||
X-COMMENT: Main-Class will be added automatically by build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package gameoflife; | ||
|
||
import java.awt.Color; | ||
|
||
enum LiveState { | ||
LIVING, DEAD | ||
} | ||
|
||
public class Cell implements Comparable<Cell> { | ||
|
||
private int row, col; | ||
private LiveState state; | ||
|
||
public Cell(int row, int col, LiveState state) { | ||
this.setState(state); | ||
this.row = row; | ||
this.col = col; | ||
|
||
} | ||
|
||
public LiveState getState() { | ||
return state; | ||
} | ||
|
||
public void setState(LiveState state) { | ||
this.state = state; | ||
} | ||
|
||
public int getRow() { | ||
return row; | ||
} | ||
|
||
public void setRow(int row) { | ||
this.row = row; | ||
} | ||
|
||
public int getCol() { | ||
return col; | ||
} | ||
|
||
public void setCol(int col) { | ||
this.col = col; | ||
} | ||
|
||
@Override | ||
public int compareTo(Cell o) { | ||
if (row == o.getRow() && col == o.getCol()) { | ||
return 0; | ||
} | ||
return -1; | ||
|
||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (!(obj instanceof Cell)) | ||
return false; | ||
|
||
Cell c = (Cell) obj; | ||
return c.getRow() == row && c.getCol() == col; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.