-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add undo button for last move (resolves #1)
- Loading branch information
Showing
6 changed files
with
116 additions
and
27 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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/me/nikl/gamebox/games/twoofoureight/GameState.java
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,33 @@ | ||
package me.nikl.gamebox.games.twoofoureight; | ||
|
||
/** | ||
* @author Niklas Eicker | ||
*/ | ||
public class GameState { | ||
private Integer[][] grid; | ||
private int score; | ||
private int gridSize; | ||
|
||
public GameState(int gridSize) { | ||
this.score = 0; | ||
this.gridSize = gridSize; | ||
} | ||
|
||
public void set(int score, Integer[][] grid) { | ||
this.score = score; | ||
this.grid = new Integer[gridSize][gridSize]; | ||
for (int y = 0; y < grid.length; y++) { | ||
for (int x = 0; x < grid.length; x++) { | ||
this.grid[x][y] = new Integer(grid[x][y]); | ||
} | ||
} | ||
} | ||
|
||
public int getScore() { | ||
return this.score; | ||
} | ||
|
||
public Integer[][] 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