Commit b29a247a authored by morkolai's avatar morkolai
Browse files

finishing touches on zigzag algorithm

parent 5d2df832
......@@ -36,7 +36,7 @@ public class GameController {
}
// TODO: Check if the piece is owned by this player
activePiece = this.view.getPiece(cubeCoordinates);
System.out.print(this.model.getGameState().getGameMode().getPossibleMoves(cubeCoordinates,1,1));
System.out.print(this.model.getGameState().getGameMode().getPossibleMoves(cubeCoordinates));
activePiece.setRotateHead(true);
previousCoordinateClicked = cubeCoordinates;
} else { // Field does NOT have piece
......
......@@ -7,7 +7,7 @@ import com.badlogic.gdx.math.Vector3
class Game(gameState: GameState) {
var gameState: GameState
private var gameState: GameState
init {
this.gameState = gameState
......@@ -43,4 +43,8 @@ class Game(gameState: GameState) {
}
return true
}
fun getGameState(): GameState? {
return this.gameState
}
}
\ No newline at end of file
......@@ -117,9 +117,9 @@ class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) {
}
}
fun getPossibleMoves(position: Vector3, moveRange: Int, jumpRange: Int): ArrayList<Vector3> {
fun getPossibleMoves(position: Vector3): ArrayList<Vector3> {
var possibleMoves: ArrayList<Vector3> = arrayListOf()
zigzagAlgorithm(position, possibleMoves, moveRange, jumpRange)
zigzagAlgorithm(position, possibleMoves, this.rules?.moveRange ?: 1, this.rules?.jumpRange ?: 1)
return possibleMoves
}
}
......
......@@ -7,7 +7,7 @@ Holds the state of the game and all data related to this.
*/
class GameState(gameMode: GameMode? = null) {
var gameMode: GameMode?
private var gameMode: GameMode?
private var boardState:AbstractBoard?
private var rules:AbstractRules?
private var isStarted: Boolean
......@@ -40,6 +40,10 @@ class GameState(gameMode: GameMode? = null) {
return rules
}
fun getGameMode(): GameMode? {
return this.gameMode
}
fun isStarted(): Boolean {
return isStarted
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment