feat: Introduce Participant trait and update GameEngine to support bot participants

This commit is contained in:
2026-04-13 22:11:54 +02:00
parent c88159ecec
commit d6758ed8ec
25 changed files with 2526369 additions and 1672 deletions
@@ -1,10 +1,7 @@
package de.nowchess.ui
import de.nowchess.api.board.Color.{Black, White}
import de.nowchess.bot.util.PolyglotBook
import de.nowchess.bot.BotDifficulty
import de.nowchess.bot.bots.{ClassicalBot, HybridBot, NNUEBot}
import de.nowchess.chess.engine.GameEngine
import de.nowchess.ui.terminal.TerminalUI
import de.nowchess.ui.gui.ChessGUILauncher
@@ -13,12 +10,21 @@ import de.nowchess.ui.gui.ChessGUILauncher
*/
object Main:
def main(args: Array[String]): Unit =
// Create the core game engine (single source of truth)
val engine = new GameEngine()
val book = PolyglotBook("../../modules/bot/codekiddy.bin")
engine.setOpponentBot(HybridBot(BotDifficulty.Easy, book = Some(book)), White);
// Create the core game engine (single source of truth)
val engine = new de.nowchess.chess.engine.GameEngine(
participants = Map(
de.nowchess.api.board.Color.White -> de.nowchess.chess.engine.BotParticipant(
de.nowchess.bot.bots.HybridBot(BotDifficulty.Easy, book = Some(book)),
),
de.nowchess.api.board.Color.Black -> de.nowchess.chess.engine.BotParticipant(
de.nowchess.bot.bots.HybridBot(BotDifficulty.Easy, book = Some(book)),
),
),
)
engine.startGame()
// Launch ScalaFX GUI in separate thread
ChessGUILauncher.launch(engine)