package de.nowchess.ui

import de.nowchess.api.board.Color.Black
import de.nowchess.bot.{BotDifficulty, ClassicalBot, PolyglotBook}
import de.nowchess.chess.engine.GameEngine
import de.nowchess.ui.terminal.TerminalUI
import de.nowchess.ui.gui.ChessGUILauncher

/** Application entry point - starts both GUI and Terminal UI for the chess game. Both views subscribe to the same
  * GameEngine via Observer pattern.
  */
object Main:
  def main(args: Array[String]): Unit =
    // Create the core game engine (single source of truth)
    val engine = new GameEngine()


    val book = PolyglotBook("/home/janis/Workspaces/IntelliJ/NowChess/NowChessSystems/modules/bot/codekiddy.bin")

    engine.setOpponentBot(ClassicalBot(BotDifficulty.Easy, book = Some(book)), Black);

    // Launch ScalaFX GUI in separate thread
    ChessGUILauncher.launch(engine)

    // Create and start the terminal UI (blocks on main thread)
    val tui = new TerminalUI(engine)
    tui.start()
