diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-27 20:14:54 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-27 20:14:54 +0200 |
| commit | 51d27e1ab9058c9e0fafb399e22edf7b38470510 (patch) | |
| tree | f0528298123fcb33eb426a5aa099afd2a8d00a90 /src/main.cpp | |
| parent | f1ded0290393709d437c6e149861ceb91d241c64 (diff) | |
adding uci
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 31 |
1 files changed, 8 insertions, 23 deletions
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 <cstdio> #include <cstdlib> #include <ctime> @@ -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; } |
