#include "board.hpp" #include "fen.hpp" #include "moves.hpp" #include "repl.hpp" #include #include using namespace std; enum Mode { EXIT, REPL, }; void setAllPiecesToEmpty(Board *b) { Piece EmptyPiece = { false, NONE, false, }; for (int i = 0; i < 64; i++) { b->pieces[i] = EmptyPiece; }; }; Board initBoard(string startingFEN) { Board b; b.enPassant = IndexToPosition(0); // default value b.canEnpassant = false; b.state = TURN; b.turn = true; b.castle = ""; b.halfMoveClock = 0; b.MoveClock = 0; setBoardFen(startingFEN, &b); return b; }; #define askMode = false int main(int argc, char **argv) { 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"); return 1; } printf("arg count: %d\n", argc); if (argc == 2) { startingFen = argv[1]; } Mode mode = REPL; // ADD support for other modes here Board b = initBoard(startingFen); if (mode == REPL) { int replExitCode = startREPL(&b); return replExitCode; } if (mode == EXIT) { return 0; } return 0; }