Skip to content

Commit 49bcd3b

Browse files
author
Daniel Barclay
committed
ColoredLines: Fixed selection-clearing bug.
1 parent 1c97fd8 commit 49bcd3b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object GameLogicSupport {
1212

1313
// (was "private[this]" before test calls:)
1414
private[game] def pickRandomBallKind()(implicit rng: Random): BallKind =
15-
BallKind.values(rng.nextInt(2 /*???BallKind.values.size*/))
15+
BallKind.values(rng.nextInt(3 /*???BallKind.values.size*/))
1616

1717
// (was "private[this]" before test calls:)
1818
@tailrec
@@ -233,13 +233,13 @@ object GameLogicSupport {
233233
val moveBallColor = boardPlus.getBallStateAt(from).get //????
234234
val postMoveBoard = boardPlus.withNoBallAt(from).withBallAt(to, moveBallColor)
235235

236-
val postHandlingResult =
237-
LineDetector.handleBallArrival(postMoveBoard, to)
238-
.copy(clearSelection = true)
239-
if (! postHandlingResult.anyRemovals )
240-
placeNextBalls(postHandlingResult.boardPlus)
241-
else
242-
postHandlingResult
236+
val postReapingResult = LineDetector.handleBallArrival(postMoveBoard, to)
237+
val postPostReadingResult =
238+
if (! postReapingResult.anyRemovals )
239+
placeNextBalls(postReapingResult.boardPlus)
240+
else
241+
postReapingResult
242+
postPostReadingResult.copy(clearSelection = true)
243243
}
244244
}
245245

0 commit comments

Comments
 (0)