Skip to content

Commit

Permalink
chore: removed unused stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
alemazzo committed Oct 14, 2023
1 parent 0f25c6b commit 4b1737d
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 45 deletions.
20 changes: 0 additions & 20 deletions src/main/scala/scatan/lib/game/Rules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,3 @@ final case class Rules[State, P, S, A, Player](
(status, action) -> step
}
}

object Rules:
def empty[State, P, S, A, Player]: Rules[State, P, S, A, Player] =
fromStateFactory((_, _) => null.asInstanceOf[State])

def fromStateFactory[State, P, S, A, Player](
initialStateFactory: (GameMap, Seq[Player]) => State
): Rules[State, P, S, A, Player] =
Rules[State, P, S, A, Player](
startingStateFactory = initialStateFactory,
startingPhase = null.asInstanceOf[P],
actions = Map.empty,
allowedPlayersSizes = Set.empty,
startingSteps = Map.empty,
phaseTurnIteratorFactories = Map.empty,
nextPhase = Map.empty,
endingSteps = Map.empty,
winnerFunction = (_: State) => None,
initialAction = Map.empty
)
2 changes: 1 addition & 1 deletion src/main/scala/scatan/model/ApplicationState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scatan.model
import scatan.lib.mvc.Model
import scatan.model.game.ScatanGame
import scatan.model.game.config.ScatanPlayer
import map.GameMap
import scatan.model.map.GameMap

final case class ApplicationState(game: Option[ScatanGame]) extends Model.State:
def createGame(gameMap: GameMap, usernames: String*): ApplicationState =
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/scatan/model/game/ScatanGame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import scatan.lib.game.ops.Effect
import scatan.lib.game.ops.GamePlayOps.{allowedActions, play}
import scatan.lib.game.ops.GameWinOps.{isOver, winner}
import scatan.lib.game.{Game, GameStatus, Turn}
import scatan.model.map.GameMap
import scatan.model.components.ResourceType.{Rock, Sheep, Wheat}
import scatan.model.components.{DevelopmentType, ResourceCard, ResourceType}
import scatan.model.game.ScatanEffects.*
import scatan.model.game.config.ScatanActions.*
import scatan.model.game.config.{ScatanActions, ScatanPhases, ScatanPlayer, ScatanSteps}
import scatan.model.game.state.ScatanState
import scatan.model.game.state.ops.RobberOps.playersOnRobber
import scatan.model.map.{Hexagon, RoadSpot, StructureSpot}
import scatan.model.map.{GameMap, Hexagon, RoadSpot, StructureSpot}

import scala.util.Random

Expand Down
1 change: 0 additions & 1 deletion src/main/scala/scatan/model/game/state/ScatanState.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scatan.model.game.state

import scatan.model.map.GameMap
import scatan.model.components.*
import scatan.model.components.UnproductiveTerrain.Desert
import scatan.model.game.DevelopmentCardsDeck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scatan.model.game.state.ops

import scatan.model.components.*
import scatan.model.components.BuildingType.Road
import scatan.model.components.DevelopmentType.Knight
import scatan.model.components.*
import scatan.model.game.config.ScatanPlayer
import scatan.model.game.state.ScatanState
import scatan.model.game.state.ops.AwardsOps.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package scatan.views.game.components

import com.raquo.laminar.api.L.*
import scatan.model.map.GameMap
import scatan.model.components.{AssignmentInfo, BuildingType, Terrain}
import scatan.model.game.config.ScatanPlayer
import scatan.model.game.state.ScatanState
import scatan.model.map.*
import scatan.views.game.components.MapComponent.{MapElement, radius, given}
import scatan.views.utils.Coordinates
import scatan.views.utils.Coordinates.*
import scatan.views.utils.TypeUtils.*
import scatan.views.game.components.MapComponent.{MapElement, radius, given}

/** A component to display the game map.
*/
Expand Down
12 changes: 5 additions & 7 deletions src/main/scala/scatan/views/game/components/MapComponent.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package scatan.views.game.components

import com.raquo.laminar.api.L.*
import scatan.model.map.GameMap
import scatan.model.components.UnproductiveTerrain
import scatan.model.map.{Hexagon, TileContent}
import scatan.views.utils.Coordinates
import scatan.views.utils.Coordinates.center
import com.raquo.laminar.nodes.ReactiveSvgElement
import org.scalajs.dom.SVGGElement
import org.scalajs.dom
import scatan.model.components.Terrain
import org.scalajs.dom.SVGGElement
import scatan.model.components.ResourceType.*
import scatan.model.components.{Terrain, UnproductiveTerrain}
import scatan.model.components.UnproductiveTerrain.*
import scatan.model.map.{GameMap, Hexagon, TileContent}
import scatan.views.utils.Coordinates
import scatan.views.utils.Coordinates.center

/** A component to display the map of hexagons.
*/
Expand Down
8 changes: 2 additions & 6 deletions src/test/scala/scatan/lib/game/RulesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ class RulesTest extends BaseTest:
Rules
}

it should "have a empty ruleset" in {
Rules.empty
}

it should "be validateble" in {
Rules.empty.valid shouldBe false
it should "be validatable" in {
emptyGameRules.valid shouldBe true
}

it should "have an initial state factory" in {
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/scatan/model/ApplicationStateTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scatan.model

import scatan.BaseTest
import scatan.lib.game.Game
import map.GameMap
import scatan.model.map.GameMap

class ApplicationStateTest extends BaseTest:

Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/scatan/model/GameTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scatan.model.game.config.ScatanActions.*
import scatan.model.game.config.{ScatanActions, ScatanPhases, ScatanPlayer, ScatanSteps}
import scatan.model.game.state.ScatanState
import scatan.model.game.state.ops.EmptySpotsOps.{emptyRoadSpots, emptyStructureSpots}
import map.GameMap
import scatan.model.map.GameMap

class GameTest extends BaseTest:

Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/scatan/model/game/ScatanRulesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package scatan.model.game
import org.scalatest.matchers.should.Matchers.shouldBe
import scatan.BaseTest
import scatan.lib.game.GameStatus
import scatan.model.map.GameMap
import scatan.model.game.config.{ScatanActions, ScatanPhases, ScatanPlayer, ScatanSteps}
import scatan.model.game.state.ScatanState
import scatan.model.map.GameMap

class ScatanRulesTest extends BaseTest:

Expand Down
3 changes: 1 addition & 2 deletions src/test/scala/scatan/model/game/ScatanStateTest.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package scatan.model.game

import scatan.model.map.GameMap
import scatan.model.components.{AssignmentInfo, Awards, DevelopmentCards, ResourceCards}
import scatan.model.game.state.ScatanState
import scatan.model.map.Spot
import scatan.model.map.{GameMap, Spot}

import scala.language.postfixOps

Expand Down

0 comments on commit 4b1737d

Please sign in to comment.