Skip to content

Commit e501269

Browse files
author
Daniel Barclay
committed
ColoredLines: Showed on-deck balls in UI.
1 parent 5454de7 commit e501269

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/main/scala/com/us/dsb/explore/algs/coloredlines/manual/game/board/BallKind.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import enumeratum.{Enum, EnumEntry}
44

55
import scala.io.AnsiColor
66

7-
private[game] sealed class BallKind(private[board] val initial: String,
7+
private[game] sealed class BallKind(private[manual] val initial: String,
88
private[this] val setFgColorSeq: String,
99
private[this] val setBgColorSeq: String
1010
) extends EnumEntry {
11-
private[board] def getColoredCharSeq(background: Boolean): String =
11+
private[manual] def getColoredCharSeq(background: Boolean): String =
1212
(if (background) this.setBgColorSeq else this.setFgColorSeq) +
1313
initial +
1414
AnsiColor.RESET

src/main/scala/com/us/dsb/explore/algs/coloredlines/manual/game/board/BoardPlus.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private[game] object BoardPlus {
99
/**
1010
* CURRENTLY: Core board state (now wrapped), not score yet, tap-UI selection state
1111
*/
12-
private[game] class BoardPlus(private[game] val boardState: BoardState,
12+
private[game] class BoardPlus(private[manual] val boardState: BoardState,
1313
private[this] val score: Int,
1414
//???? move to (low-level) tap-UI state:
1515
private[this] val selectionAddress: Option[CellAddress]

src/main/scala/com/us/dsb/explore/algs/coloredlines/manual/game/board/BoardState.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private[game] class BoardState(private[this] val cellStates: Vector[CellBallStat
3636

3737
// on-deck balls:
3838

39-
private[game] def getOnDeckBalls: Iterable[BallKind] = onDeck
39+
private[manual] def getOnDeckBalls: Iterable[BallKind] = onDeck
4040

4141
private[game] def withOnDeckBalls(newBalls: Iterable[BallKind]): BoardState =
4242
copy(onDeck = newBalls)

src/main/scala/com/us/dsb/explore/algs/coloredlines/manual/ui/GameUIState.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ private[this] case class GameUIState(gameState: UpperGameState,
6464
}
6565

6666
private[ui] def toDisplayString: String = {
67+
val onDeckList =
68+
gameState.boardPlus.boardState.getOnDeckBalls.map(_.getColoredCharSeq(false)).mkString(", ")
69+
6770
renderTableMultilineWithSelection + "\n" +
68-
s"Score: ${gameState.boardPlus.getScore} " +
69-
s"Marking cursor: <row ${cursorAddress.row} / column ${cursorAddress.column}>"
71+
s"Next: $onDeckList" +
72+
s" Score: ${gameState.boardPlus.getScore}" +
73+
s" Marking cursor: <row ${cursorAddress.row} / column ${cursorAddress.column}>"
7074
}
7175

7276
}

0 commit comments

Comments
 (0)