Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lazy val root = (project in file("."))
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.20" % Test,
libraryDependencies += "org.scalatestplus" %% "mockito-5-10" % "3.2.18.0" % Test,
libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % "3.0.0",
libraryDependencies += "org.jline" % "jline" % "4.3.1",
libraryDependencies += "org.jline" % "jline" % "4.4.2",

Test / parallelExecution := false,

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/controller/GameController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class GameController[P <: Playable[P]](
case Action.ObservePlayer(i) => ViewAction(s"obs_player_$i", s"Peek at your card in position ${i + 1}")
case Action.ReturnToField(i) => ViewAction(s"return_$i", s"Return card to your field in position ${i + 1}")
case Action.Swap(pIdx, oIdx) =>
ViewAction(s"swap_${pIdx}_$oIdx", s"Swap your card in position $pIdx with opponent's card in position $oIdx")
ViewAction(s"swap_${pIdx}_$oIdx", s"Swap your card in position ${pIdx+1} with opponent's card in position ${oIdx+1}")

def getWinner: Option[Player] =
val scores = game.playerScore
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/view/CLIMenu.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.pps.functus
package view

import view.utils.{MenuItem, SelectableMenuItem, ShowCaseOption, TargetScoreOption, Utils}
import view.utils.Utils.{viewBuilder, separator}
import view.utils.Utils.{SEPARATOR_CHAR, separator, terminalWidth, viewBuilder}

class CLIMenu:

Expand All @@ -23,6 +23,7 @@ class CLIMenu:
* the index of the mode currently highlighted by the user
*/
def renderMainMenu(selectedModeIndex: Int): Unit =
given separator: String = SEPARATOR_CHAR * terminalWidth
printMenu(selectedModeIndex, MAIN_MENU_TITLE, menuItem, true)

/** Renders the target score selection menu for match mode.
Expand All @@ -34,6 +35,7 @@ class CLIMenu:
* the index of the target score option currently highlighted
*/
def renderTargetScoreMenu(selectedScoreIndex: Int): Unit =
given separator: String = SEPARATOR_CHAR * terminalWidth
printMenu(selectedScoreIndex, MATCH_SCORE_MENU_TITLE, scoreOption)

/** Renders the showcase selection menu for testing card interactions.
Expand All @@ -44,6 +46,7 @@ class CLIMenu:
* the index of the showcase option currently highlighted
*/
def renderShowCaseMenu(selectedIndex: Int): Unit =
given separator: String = SEPARATOR_CHAR * terminalWidth
printMenu(selectedIndex, SHOWCASE_MENU_TITLE, showCaseOption)

/** Renders the game rules page with instructions and controls.
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/view/CLIViewTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@ class CLIViewTest extends AnyFlatSpec with Matchers with BeforeAndAfterEach:
output should include("FINAL SCORES (Target: 50):")
output should include("Player 1: 55 pts | Player 2: 55 pts")
output should include("[ Press ENTER or Q to return to Main Menu ]")
Utils.clearScreen()
}
Loading