- return 0 > diff_x ? "s" : "d";
-}
-
-
-
-static char * eye_to_cell(struct yx_uint8 * yx_eye, struct yx_uint8 * yx_cell,
- uint8_t right)
-{
- int16_t diff_y = yx_cell->y - yx_eye->y;
- int16_t diff_x = yx_cell->x - yx_eye->x;
- uint8_t indent = yx_eye->y % 2;
- char * dir = dir_from_delta(indent, diff_y, diff_x);
- char * dirs = NULL;
- if (1 == strlen(dir))
- {
- return strdup(dir);
- }
- else if (!strcmp(dir, "dc"))
- {
- dirs = eye_to_cell_dir_ratio(dir, indent, diff_y, diff_x, 0,0,right);
- }
- else if (!strcmp(dir, "xs"))
- {
- dirs = eye_to_cell_dir_ratio(dir, !indent, diff_y, -diff_x, 0,1,right);
- }
- else if (!strcmp(dir, "cx"))
- {
- dirs = eye_to_cell_dir_ratio(dir, indent, diff_y, diff_x, 1,0,right);
- }
- else if (!strcmp(dir, "sw"))
- {
- dirs = eye_to_cell_dir_ratio(dir, !indent, -diff_y, -diff_x, 0,0,right);
- }
- else if (!strcmp(dir, "ed"))
- {
- dirs = eye_to_cell_dir_ratio(dir, indent, -diff_y, diff_x, 0,1,right);
- }
- else if (!strcmp(dir, "we"))
- {
- dirs = eye_to_cell_dir_ratio(dir, indent, -diff_y, diff_x, 1,1,right);
- }
- return dirs;
-}
-
-
-
-static uint8_t is_top_left_shaded(uint16_t pos_a, uint16_t pos_b,
- int16_t a_y_on_left)
-{
- uint16_t start_last_row = world.map.length * (world.map.length - 1);
- uint8_t a_on_left_or_bottom = 0 <= a_y_on_left
- || (pos_a >= start_last_row);
- uint8_t b_on_top_or_right = pos_b < world.map.length
- || pos_b % world.map.length==world.map.length-1;
- return pos_a != pos_b && b_on_top_or_right && a_on_left_or_bottom;