From 51d27e1ab9058c9e0fafb399e22edf7b38470510 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 27 Jul 2026 20:14:54 +0200 Subject: adding uci --- src/main.cpp | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 555e728..7b7e6fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ #include "board.hpp" #include "fen.hpp" #include "moves.hpp" -#include "repl.hpp" +#include "uci.hpp" #include #include #include @@ -14,7 +14,7 @@ enum Mode { REPL, }; -void setAllPiecesToEmpty(Board *b) { +void setAllPiecesToEmpty(Game *b) { Piece EmptyPiece = { false, NONE, @@ -24,8 +24,8 @@ void setAllPiecesToEmpty(Board *b) { b->pieces[i] = EmptyPiece; }; }; -Board initBoard(string startingFEN) { - Board b; +Game initBoard(string startingFEN) { + Game b; b.enPassant = IndexToPosition(0); // default value b.canEnpassant = false; b.state = TURN; @@ -36,31 +36,16 @@ Board initBoard(string startingFEN) { setBoardFen(startingFEN, &b); return b; }; -#define askMode = false int main(int argc, char **argv) { srand(time(0)); - std::string startingFen = - "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; if (argc < 1 || argc > 2) { - printf("wrong arg count, use: ./chess [optinal starting fen]\n"); + printf("wrong arg count, use: ./chess [--repl for debugging]\n"); return 1; } - printf("arg count: %d\n", argc); - if (argc == 2) { - startingFen = argv[1]; - } - - Mode mode = REPL; - // ADD support for other modes here + if (argc > 1 && std::string(argv[1]) == "--repl") + return startREPL(); - Board b = initBoard(startingFen); - if (mode == REPL) { - int replExitCode = startREPL(&b); - return replExitCode; - } - if (mode == EXIT) { - return 0; - } + UciInit(); return 0; } -- cgit v1.2.3