Skip to content

Commit

Permalink
Merge pull request #617 from lenguyenthanh/update-scalafmt-3.8.6
Browse files Browse the repository at this point in the history
Update scalafmt 3.8.6
  • Loading branch information
lenguyenthanh authored Jan 25, 2025
2 parents 8f210af + e38ca68 commit 0bc6571
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ e27af773ebaeae2ccabdc2eea15afe60107f2c99

# Scala Steward: Reformat with scalafmt 3.8.2
bfb4e29c0fe449fb539105fd58a34aa8fb81deae

# Scala Steward: Reformat with scalafmt 3.8.6
68aafee3746adc5edd5e16bc34e71cee0201f1b5
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.8.6"
runner.dialect = scala3

align.preset = more
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/Clock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ case class Clock(
)
case Some(t) =>
val elapsed = toNow(t)
val lag = ~metrics.reportedLag(elapsed) nonNeg
val lag = (~metrics.reportedLag(elapsed)).nonNeg

val player = players(color)
val (lagComp, lagTrack) = player.lag.onMove(lag)

val moveTime = (elapsed - lagComp) nonNeg
val moveTime = (elapsed - lagComp).nonNeg

val clockActive = gameActive && moveTime < player.remaining
val inc = clockActive.so(player.increment)
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/format/BinaryFen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ object BinaryFen:
.withHistory(situation.history.setHalfMoveClock(HalfMoveClock.initial))
.withVariant(situation.variant match
case Standard | Chess960 | FromPosition => Standard
case other => other
),
case other => other),
FullMoveNumber.initial
)
)
Expand Down
24 changes: 12 additions & 12 deletions core/src/main/scala/variant/Horde.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ case object Horde
val frontPawns = List(Square.B5, Square.C5, Square.F5, Square.G5).map { _ -> White.pawn }
val blackPawns = File.all.map { Square(_, Rank.Seventh) -> Black.pawn }
val blackPieces = File.all.map { x => Square(x, Rank.Eighth) -> (Black - backRank(x.value)) }
whitePawnsHorde ++ frontPawns ++ blackPawns ++ blackPieces toMap
(whitePawnsHorde ++ frontPawns ++ blackPawns ++ blackPieces).toMap

override val castles = Castles.black

Expand Down Expand Up @@ -226,17 +226,17 @@ case object Horde
|| pieces.pawn >= 2)
// hordeNum == 3
else
// A king in the corner is mated by two knights and a bishop or three
// knights or the bishop pair and a knight/bishop.
if (horde.knight == 2 && horde.bishop == 1)
|| horde.knight == 3
|| board.hasBishopPair(White)
then false
// White has two same color bishops and a knight.
// A king on A1 is mated by a bishop on B2, a bishop on C1 and a
// knight on C3, as long as there is another black piece to waste
// a tempo.
else piecesNum == 1
// A king in the corner is mated by two knights and a bishop or three
// knights or the bishop pair and a knight/bishop.
if (horde.knight == 2 && horde.bishop == 1)
|| horde.knight == 3
|| board.hasBishopPair(White)
then false
// White has two same color bishops and a knight.
// A king on A1 is mated by a bishop on B2, a bishop on C1 and a
// knight on C3, as long as there is another black piece to waste
// a tempo.
else piecesNum == 1

enum SquareColor:
case Light
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/variant/Variant.scala
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ object Variant:
def exists(id: Id): Boolean = list.byId.contains(id)

private[variant] def symmetricRank(rank: IndexedSeq[Role]): Map[Square, Piece] =
File.all.zip(rank).map((x, role) => Square(x, Rank.First) -> (White - role)) ++
(File.all.zip(rank).map((x, role) => Square(x, Rank.First) -> (White - role)) ++
File.all.map(Square(_, Rank.Second) -> White.pawn) ++
File.all.map(Square(_, Rank.Seventh) -> Black.pawn) ++
File.all.zip(rank).map((x, role) => Square(x, Rank.Eighth) -> (Black - role)) toMap
File.all.zip(rank).map((x, role) => Square(x, Rank.Eighth) -> (Black - role))).toMap

def isValidInitialFen(variant: Variant, fen: Option[Fen.Full], strict: Boolean = false) =
if variant.chess960
Expand Down
2 changes: 1 addition & 1 deletion test-kit/src/test/scala/Chess960Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import variant.Chess960
class Chess960Test extends ChessTest:

test("recognize position numbers"):
import Chess960.{ positionNumber as pn }
import Chess960.positionNumber as pn
assertEquals(pn(FullFen("k7/ppP5/brp5/8/8/8/8/8 b - -")), None)

assertEquals(pn(FullFen("rnqbbknr/pppppppp/8/8/8/8/PPPPPPPP/RNQBBKNR w KQkq - 0 1")), Some(521))
Expand Down
2 changes: 1 addition & 1 deletion test-kit/src/test/scala/ClockTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ClockLagCompTest extends ChessTest:
def clockStep(clock: Clock, wait: Int, lags: Int*) =
(lags
.foldLeft(clock) { (clk, lag) =>
advance(clk.step().value, wait + lag).step(durOf(lag)) value
advance(clk.step().value, wait + lag).step(durOf(lag)).value
}
.remainingTime(Black))
.centis
Expand Down
8 changes: 4 additions & 4 deletions test-kit/src/test/scala/format/Visual.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ object Visual:
(c, x) <- l.zipWithIndex
role <- Role.forsyth(c.toLower)
yield Square.at(x, 7 - y).map { square =>
square -> (Color.fromWhite(c isUpper) - role)
}) flatten,
square -> (Color.fromWhite(c.isUpper) - role)
}).flatten,
variant = chess.variant.Variant.default
)
b.withHistory(History(unmovedRooks = UnmovedRooks.from(b)))
Expand All @@ -44,8 +44,8 @@ object Visual:
for (y <- Rank.allReversed) yield {
for (x <- File.all) yield
val square = Square(x, y)
markedPoss.get(square).getOrElse(board(square).fold(' ')(_ forsyth))
} mkString
markedPoss.get(square).getOrElse(board(square).fold(' ')(_.forsyth))
}.mkString
}.map { """\s*$""".r.replaceFirstIn(_, "") }.mkString("\n")

def addNewLines(str: String) = "\n" + str + "\n"
Expand Down

0 comments on commit 0bc6571

Please sign in to comment.