11   self->input_board_file = NULL;
 
   12   self->output_board_file = NULL;
 
   13   self->set_name = NULL;
 
   14   self->board_gen_width = 0;
 
   15   self->board_gen_height = 0;
 
   21   fprintf(stderr, 
"Usage:\n");
 
   22   fprintf(stderr, 
"%s help\n", prog_name);
 
   23   fprintf(stderr, 
"%s version\n", prog_name);
 
   24 #ifdef AUTONOMOUS_MODE 
   25   fprintf(stderr, 
"%s phase=placement penguins=N inputboard.txt outpuboard.txt\n", prog_name);
 
   26   fprintf(stderr, 
"%s phase=movement board.txt board.txt\n", prog_name);
 
   27   fprintf(stderr, 
"%s generate <island|random> <WIDTH> <HEIGHT> board.txt\n", prog_name);
 
   28   fprintf(stderr, 
"%s view board.txt\n", prog_name);
 
   29   fprintf(stderr, 
"%s name\n", prog_name);
 
   31 #ifdef INTERACTIVE_MODE 
   32   fprintf(stderr, 
"%s interactive\n", prog_name);
 
   41   for (
int i = 1; i < argc; i++) {
 
   42     const char* arg = argv[i];
 
   43     const char* arg_value = arg;
 
   44     bool is_placement_or_movement =
 
   49       if (strcmp(arg_value, 
"placement") == 0) {
 
   51       } 
else if (strcmp(arg_value, 
"movement") == 0) {
 
   54         fprintf(stderr, 
"Invalid value for the 'phase' option: '%s'\n", arg_value);
 
   57     } 
else if ((arg_value = 
strip_prefix(arg, 
"penguins="))) {
 
   61         fprintf(stderr, 
"Invalid value for the 'penguins' option: '%s'\n", arg_value);
 
   64     } 
else if (strcmp(arg, 
"version") == 0) {
 
   66     } 
else if (strcmp(arg, 
"help") == 0) {
 
   68     } 
else if (strcmp(arg, 
"name") == 0) {
 
   70     } 
else if (strcmp(arg, 
"interactive") == 0) {
 
   72     } 
else if (strcmp(arg, 
"generate") == 0) {
 
   74     } 
else if (strcmp(arg, 
"view") == 0) {
 
   77       if (*arg_value != 
'\0') {
 
   81         fprintf(stderr, 
"Invalid value for the 'name' option: '%s'\n", arg_value);
 
   83     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-placement="))) {
 
   84       if (strcmp(arg_value, 
"smart") == 0) {
 
   86       } 
else if (strcmp(arg_value, 
"random") == 0) {
 
   88       } 
else if (strcmp(arg_value, 
"first") == 0) {
 
   90       } 
else if (strcmp(arg_value, 
"fish") == 0) {
 
   94         fprintf(stderr, 
"Invalid value for the 'bot-placement' option: '%s'\n", arg_value);
 
   96     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-placement-scan-area="))) {
 
  101           stderr, 
"Invalid value for the 'bot-placement-scan-area' option: '%s'\n", arg_value
 
  105     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-movement="))) {
 
  106       if (strcmp(arg_value, 
"smart") == 0) {
 
  108       } 
else if (strcmp(arg_value, 
"random") == 0) {
 
  110       } 
else if (strcmp(arg_value, 
"first") == 0) {
 
  114         fprintf(stderr, 
"Invalid value for the 'bot-movement' option: '%s'\n", arg_value);
 
  116     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-max-move-steps="))) {
 
  120         fprintf(stderr, 
"Invalid value for the 'bot-max-move-steps' option: '%s'\n", arg_value);
 
  123     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-recursion="))) {
 
  127         fprintf(stderr, 
"Invalid value for the 'bot-recursion' option: '%s'\n", arg_value);
 
  130     } 
else if ((arg_value = 
strip_prefix(arg, 
"bot-junction-check-recursion="))) {
 
  135           stderr, 
"Invalid value for the 'bot-junction-check-recursion' option: '%s'\n", arg_value
 
  139     } 
else if (is_board_gen && file_arg == 0) {
 
  140       if (strcmp(arg, 
"island") == 0) {
 
  142       } 
else if (strcmp(arg, 
"random") == 0) {
 
  145         fprintf(stderr, 
"Invalid value for the 'board_gen_type' option: '%s'\n", arg);
 
  149     } 
else if (is_board_gen && file_arg == 1) {
 
  153         fprintf(stderr, 
"Invalid value for the 'WIDTH' option: '%s'\n", arg);
 
  157     } 
else if (is_board_gen && file_arg == 2) {
 
  161         fprintf(stderr, 
"Invalid value for the 'HEIGHT' option: '%s'\n", arg);
 
  165     } 
else if (is_board_gen && file_arg == 3) {
 
  171     } 
else if (is_placement_or_movement && file_arg == 0) {
 
  174     } 
else if (is_placement_or_movement && file_arg == 1) {
 
  178       fprintf(stderr, 
"Unexpected argument: '%s'\n", arg);
 
  185       fprintf(stderr, 
"Expected a value for the required argument 'input_board_file'\n");
 
  189       fprintf(stderr, 
"Expected a value for the required argument 'output_board_file'\n");
 
  196       fprintf(stderr, 
"Expected a value for the 'penguins' option\n");
 
  203       fprintf(stderr, 
"Expected a value for the required argument 'board_gen_type'\n");
 
  207       fprintf(stderr, 
"Expected a value for the required argument 'WIDTH'\n");
 
  211       fprintf(stderr, 
"Expected a value for the required argument 'HEIGHT'\n");
 
  215       fprintf(stderr, 
"Expected a value for the required argument 'output_board_file'\n");
 
  222       fprintf(stderr, 
"Expected a value for the required argument 'input_board_file'\n");
 
bool parse_arguments(Arguments *result, int argc, char *argv[])
 
void print_usage(const char *prog_name)
 
void init_arguments(Arguments *self)
 
The command-line argument parser.
 
@ ACTION_ARG_PRINT_VERSION
 
@ BOT_PLACEMENT_MOST_FISH
Pick the tiles with the most fish in the vicinity.
 
@ BOT_PLACEMENT_SMART
The standard "smart" algorithm, see bot_compute_placement for its description.
 
@ BOT_PLACEMENT_RANDOM
Pick a random tile for placement.
 
@ BOT_PLACEMENT_FIRST_POSSIBLE
Pick the first possible tile (first tile in the first row).
 
@ BOT_MOVEMENT_SMART
The standard "smart" algorithm, see bot_compute_move for its description.
 
@ BOT_MOVEMENT_RANDOM
Pick a random move.
 
@ BOT_MOVEMENT_FIRST_POSSIBLE
Pick the first possible move (also known as the "dumb" algorithm).
 
const char * input_board_file
 
const char * output_board_file
 
GenerateArg board_gen_type
 
BotPlacementStrategy placement_strategy
BOT_PLACEMENT_SMART by default.
 
int max_move_length
The maximum number of tiles allowed for bot's moves, must be positive.
 
int recursion_limit
The maximum recursion depth, must be positive. Zero means no recursion.
 
void init_bot_parameters(BotParameters *self)
Initializes all fields of the given BotParameters to default values.
 
BotMovementStrategy movement_strategy
BOT_MOVEMENT_SMART by default.
 
int junction_check_recursion_limit
The maximum recursion depth at which junction checks are performed.
 
int placement_scan_area
An area surrounding the placement tile which bot_rate_placement considers.
 
bool parse_number(const char *str, long *result)
Converts a string into a number, returns false if the string was invalid.
 
const char * strip_prefix(const char *str, const char *prefix)
Returns a substring with the prefix removed if the given string starts with the prefix,...