aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp16
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;
}