Skip to content
Snippets Groups Projects
Commit b7d24ba3 authored by morkolai's avatar morkolai
Browse files

WIP: started work on functionality for retrieving all possible moves

parent 3417e1a5
No related branches found
No related tags found
1 merge request!14WIP: Default game
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
package com.mygdx.game.model package com.mygdx.game.model
import java.lang.Exception import java.lang.Exception
import kotlin.system.measureTimeMillis
class Field { class Field {
...@@ -24,6 +25,13 @@ class Field { ...@@ -24,6 +25,13 @@ class Field {
return this.piece return this.piece
} }
fun hasPiece(): Boolean {
if (this.piece == null) {
return false
}
return true
}
fun removePiece() { fun removePiece() {
this.piece = null this.piece = null
} }
......
package com.mygdx.game.model//Holds a ruleset and a board package com.mygdx.game.model
import com.badlogic.gdx.math.Vector3
//Holds a ruleset and a board
class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) { class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) {
...@@ -25,4 +29,35 @@ class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) { ...@@ -25,4 +29,35 @@ class GameMode(rules:AbstractRules? = null, board:AbstractBoard? = null) {
fun getRules(): AbstractRules? { fun getRules(): AbstractRules? {
return this.rules return this.rules
} }
fun possibleMoves(position: Vector3): ArrayList<Vector3> {
var frontier: ArrayList<Vector3> = arrayListOf()
if (this.board?.fields?.get(position)?.hasPiece() == true) {
// algoritme
return frontier
}
return frontier
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment