Skip to content

Commit

Permalink
test: add rules for spot assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
manuandru committed Oct 10, 2023
1 parent 59e7dca commit b9708f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/scala/scatan/model/game/ops/BuildingOpsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,15 @@ class BuildingOpsTest extends BaseScatanStateTest:
.flatMap(_.assignBuilding(roadSpot2, BuildingType.Road, threePlayers.head))
stateAssigned should not be (None)
}

it should "not allow to assign a building if another is near" in {
val state = ScatanState(threePlayers)
val spot = spotToBuildStructure(state)
val anotherSpot = (state.gameMap.neighboursOf(spot) & state.emptyStructureSpot.toSet).head
val stateAssigned =
state
.assignBuilding(anotherSpot, BuildingType.Settlement, threePlayers.head)
.flatMap(_.assignBuilding(spot, BuildingType.Settlement, threePlayers.head))
println(stateAssigned.map(_.assignedBuildings))
stateAssigned should be(None)
}

0 comments on commit b9708f3

Please sign in to comment.