Skip to content

Commit

Permalink
Remove controller from State parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
patzly committed Jan 25, 2024
1 parent e6ac8f7 commit e4c9c6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/de/htwg/se/set/controller/IController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ trait ISnapshot:
def toXml: Elem
def toJson: JsValue

trait IState(controller: IController):
trait IState:

def print(): Unit
def message: String
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/de/htwg/se/set/controller/controller/State.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import play.api.libs.json.{JsValue, Json}

import scala.xml.Elem

private class State(controller: IController) extends IState(controller):
private class State extends IState:

def print(): Unit = ()

Expand All @@ -26,7 +26,7 @@ private class State(controller: IController) extends IState(controller):

override def toJson: JsValue = Json.toJson(getClass.getSimpleName)

case class SettingsState(controller: IController) extends State(controller):
case class SettingsState(controller: IController) extends State:

override def print(): Unit =
println(PrintUtil.bold("1") + " Start game")
Expand All @@ -40,7 +40,7 @@ case class SettingsState(controller: IController) extends State(controller):
case NumberInput(3) => SwitchEasyAction()
case other => super.handleInput(other)

case class ChangePlayerCountState(controller: IController) extends State(controller):
case class ChangePlayerCountState(controller: IController) extends State:

override def print(): Unit = println("Enter number of players:")

Expand All @@ -49,7 +49,7 @@ case class ChangePlayerCountState(controller: IController) extends State(control
case NumberInput(number) => ChangePlayerCountAction(number)
case other => super.handleInput(other)

case class SelectPlayerState(controller: IController) extends State(controller):
case class SelectPlayerState(controller: IController) extends State:

override def print(): Unit =
if !controller.settings.singlePlayer then
Expand All @@ -68,7 +68,7 @@ case class SelectPlayerState(controller: IController) extends State(controller):
case ExitInput => ExitAction()
case other => super.handleInput(other)

case class GameState(controller: IController) extends State(controller):
case class GameState(controller: IController) extends State:

private def player =
controller.game.selectedPlayer match
Expand All @@ -93,7 +93,7 @@ case class GameState(controller: IController) extends State(controller):
case ExitInput => ExitAction()
case other => super.handleInput(other)

case class GameEndState(controller: IController) extends State(controller):
case class GameEndState(controller: IController) extends State:

override def print(): Unit =
println("\n" + PrintUtil.yellow(PrintUtil.bold("All SETs found!")))
Expand Down

0 comments on commit e4c9c6c

Please sign in to comment.