-
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.
still need to implement board generation and sink detection
- Loading branch information
1 parent
a40e8da
commit 7ec3dd0
Showing
7 changed files
with
135 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,48 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package battleship; | ||
|
||
import static battleship.BattleShipGUI.generateGrid; | ||
|
||
/** | ||
* | ||
* @author j9neave | ||
*/ | ||
public enum Team { | ||
FRIENDLY { | ||
|
||
@Override | ||
public void setTeamShipGrid(boolean[][] shipGrid) { | ||
this.shipGrid = shipGrid; | ||
this.getGrid().refresh(); | ||
} | ||
}, | ||
ENEMY; | ||
|
||
boolean[][] shipGrid; | ||
Grid grid; | ||
|
||
public void setTeamShipGrid(boolean[][] shipGrid) { | ||
this.shipGrid = shipGrid; | ||
} | ||
|
||
public boolean[][] getTeamShipGrid() { | ||
try { | ||
return this.shipGrid; | ||
} catch (Exception e) { | ||
return generateGrid(); | ||
} | ||
} | ||
|
||
public void setGrid(Grid grid) { | ||
this.grid = grid; | ||
} | ||
|
||
public Grid getGrid() { | ||
return this.grid; | ||
} | ||
|
||
} |
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