diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-25 14:45:04 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-25 14:45:04 +0200 |
| commit | 3760828b8fab504e2fbfe9a8eb1d39a821b3982a (patch) | |
| tree | 261ad932389c771fefe40daf2e1d98559441cc11 /src | |
| parent | 502506a969ca396309d3f6ff9819277e5c667331 (diff) | |
adding fen as optinal argument
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index f958d11..fa4b3a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,6 @@ +#include <cstdio> #include <cstdlib> +#include <string> #include "board.hpp" @@ -8,7 +10,17 @@ Piece NonePiece = { false, }; -int main() { +int main(int argc, char **argv) { + printf("arg count: %d", argc); + 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]"); + return 1; + } + if (argc == 2) { + startingFen = argv[1]; + } board b; b.turn = true; b.castle = ""; @@ -17,7 +29,7 @@ int main() { for (int i = 0; i < 64; i++) { b.pieces[i] = NonePiece; }; - setBoardFen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", &b); + setBoardFen(startingFen, &b); printBoard(&b); return EXIT_SUCCESS; } |
