move all uci to uci.c, eval variables to eval-defs.c

This commit is contained in:
2024-07-22 21:07:46 +02:00
parent 448057bd27
commit 99658316fb
10 changed files with 47 additions and 1195 deletions

View File

@@ -1,6 +1,6 @@
/* brchess.c - main loop.
/* uci.c - uci protocol
*
* Copyright (C) 2021-2024 Bruno Raoult ("br")
* Copyright (C) 2024 Bruno Raoult ("br")
* Licensed under the GNU General Public License v3.0 or later.
* Some rights reserved. See COPYING.
*
@@ -22,13 +22,12 @@
#include "chessdefs.h"
#include "position.h"
#include "brchess.h"
#include "hash.h"
#include "fen.h"
#include "search.h"
#include "uci.h"
#include "hist.h"
#include "fen.h"
#include "move-gen.h"
#include "move-do.h"
#include "search.h"
struct command {
char *name; /* User printable name */
@@ -80,7 +79,7 @@ struct command commands[] = {
static int done = 0;
int brchess(pos_t *pos)
int uci(pos_t *pos)
{
char *str = NULL, *saveptr, *token, *args;
int len;
@@ -491,50 +490,3 @@ int string_trim(char *str)
*to = 0;
return to - str;
}
/**
* usage - brchess usage function.
*
*/
static int usage(char *prg)
{
fprintf(stderr, "Usage: %s [-ilw] [file...]\n", prg);
return 1;
}
int main(int ac, char **av)
{
pos_t *pos;
int opt;
init_all();
pos = pos_new();
hist_link(pos);
printf("\nWelcome to brchess " VERSION "\nEngine ready.\n");
// size_t len = 0;
// char *str = NULL;
//while (getline(&str, &len, stdin) >= 0) {
// printf("[%s] -> ", str);
// int newlen = string_trim(str);
// printf("%d [%s]\n", newlen, str);
//}
//exit(0);
while ((opt = getopt(ac, av, "d:f:")) != -1) {
switch (opt) {
case 'd':
//debug_level_set(atoi(optarg));
break;
case 'f':
fen2pos(pos, optarg);
break;
default:
return usage(*av);
}
}
if (optind < ac)
return usage(*av);
return brchess(pos);
}