From a14da2fe3864712dab4e7c4cfb5c323026d668de Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Fri, 10 Jul 2026 16:01:57 +0530 Subject: moving header files to include directory & moving resources in it's own directory i know currently there is race condition, but the code is getting too messy, i will continue to this after i make a vis tool to analyse how i should split up files & stuff the code rn needs intense restructing for it to make any more progress --- include/uci/state.h | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 include/uci/state.h (limited to 'include/uci/state.h') diff --git a/include/uci/state.h b/include/uci/state.h new file mode 100644 index 0000000..a1df891 --- /dev/null +++ b/include/uci/state.h @@ -0,0 +1,122 @@ +#ifndef UCI_STATE_H +#define UCI_STATE_H + +#include +#include "../fen.h" + +typedef struct { + char* data; + int length; +} str_t; + +typedef bool check_t; +typedef int spin_t; +typedef int combo_t; +// the button isn't actually a value thing +// it's more like an event. +// so we parse a button type, we set this to true, handle it +// then set it to false again +typedef bool button_t; + +typedef struct { + char** combination; + int count; + int default_index; +} option_combo_setting_t; +typedef struct { + int min; + int max; + int default_value; +} option_spin_setting_t; +enum { OPTION_SPIN, OPTION_COMBO, OPTION_CHECK, OPTION_STRING, OPTION_BUTTON }; +typedef struct { + char option_name[32]; + int type; + union { + option_combo_setting_t combo; + option_spin_setting_t spin; + bool check_default; + const char* string_default; + } data; + union { + combo_t *combo; + spin_t *spin; + check_t *check; + str_t *string; + button_t *button; + } value; +} option_setting_t; + +option_setting_t option_setting_combo( + char* option_name, + char** combinations, + int combinations_count, + int default_index, + combo_t *combo +); +option_setting_t option_setting_spin( + const char* option_name, + int min, + int max, + int default_value, + spin_t *spin +); +option_setting_t option_setting_check( + const char* option_name, + bool default_value, + check_t *check +); +option_setting_t option_setting_string( + const char* option_name, + const char* default_value, + str_t *string +); +option_setting_t option_setting_button( + const char* option_name, + button_t *button +); + +typedef struct { + char name[32]; + char author[32]; + bool debug; + + atomic_int go; + atomic_int go_ready_receive; + atomic_int quit; + atomic_int stop; + atomic_int cleanup; + + void* go_args; // TODO: fix the information flow so i don't need to do this trick + position_t position; + struct uci_move *moves; + int moves_count; + + option_setting_t option_settings[11]; + + // options + spin_t threads; + spin_t hash; + button_t clear_hash; + // str_t nalimovpath; + // spin_t nalimovcache; + // check_t ponder; + // check_t ownbook; + // spin_t multipv; + check_t uci_showcurrline; + check_t uci_showrefutations; + check_t uci_limitstrength; + spin_t uci_elo; + check_t uci_analysemode; + str_t uci_opponent; + str_t uci_engineabout; + // str_t uci_shredderbasespath; + str_t uci_setpositionvalue; +} uci_state; + +struct uci_move { + int from; + int to; +}; + +#endif // UCI_STATE_H -- cgit v1.2.3