aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: ddeb3042c6c92c7c11d640ff6fc6ae4ff045de49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "board.hpp"
#include "fen.hpp"
#include "moves.hpp"
#include "uci.hpp"
#include "zobrist.hpp"
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <string>

using namespace std;

enum Mode {
  EXIT,
  REPL,
};

void setAllPiecesToEmpty(Game *b) {
  Piece EmptyPiece = {
      false,
      NONE,
      false,
  };
  for (int i = 0; i < 64; i++) {
    b->pieces[i] = EmptyPiece;
  };
};
Game initBoard(string startingFEN) {
  Game 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;
};

int main(int argc, char **argv) {
  InitZobrist();
  srand(time(0));
  if (argc < 1 || argc > 2) {
    printf("wrong arg count, use: ./chess [--repl for debugging]\n");
    return 1;
  }
  if (argc > 1 && std::string(argv[1]) == "--repl")
    return startREPL();

  Uci();
  return 0;
}