char char_ans[MAX_PUZZLE_SIZE][MAX_PUZZLE_SIZE];
int cur_row;
int cur_col;
+ enum ORIENTATION current_movement;
} MainPlayerData;
/* compute the hash of a password */
printf ("\x1B[0m");
}
+/* check if the prev row has a block or not */
+bool prev_row_block (Puzzle *p, int r, int c)
+{
+ if (r == 0)
+ return true;
+ if (p->chars[r-1][c] == '#')
+ return true;
+ return false;
+}
+
+/* check if the next row has a block or not */
+bool next_row_block (Puzzle *p, int r, int c)
+{
+ if (r == p->grid_size-1)
+ return true;
+ if (p->chars[r+1][c] == '#')
+ return true;
+ return false;
+}
+
+/* check if the prev col has a block or not */
+bool prev_col_block (Puzzle *p, int r, int c)
+{
+ if (c == 0)
+ return true;
+ if (p->chars[r][c-1] == '#')
+ return true;
+ return false;
+}
+
+/* check if the next col has a block or not */
+bool next_col_block (Puzzle *p, int r, int c)
+{
+ if (c == p->grid_size - 1)
+ return true;
+ if (p->chars[r][c+1] == '#')
+ return true;
+ return false;
+}
+
/* check if previous row is blank or not */
bool prev_row_blank (Puzzle *p, int r, int c)
{
return false;
}
+/* set the current row/col to the beginning of word index (across or down) */
+void set_selection_to_word_start (MainPlayerData *app_data,
+ enum ORIENTATION orient, int word_index)
+{
+ for (int i = 0; i < app_data->puzzle.grid_size; i ++)
+ {
+ for (int j = 0; j < app_data->puzzle.grid_size; j ++)
+ {
+ if (orient == ACROSS &&
+ app_data->puzzle.start_across_word[i][j] == word_index)
+ {
+ app_data->current_movement = ACROSS;
+ app_data->cur_row = i;
+ app_data->cur_col = j;
+ break;
+ }
+ else if (orient == DOWN &&
+ app_data->puzzle.start_down_word[i][j] == word_index)
+ {
+ app_data->current_movement = DOWN;
+ app_data->cur_row = i;
+ app_data->cur_col = j;
+ break;
+ }
+ }
+ }
+}
+
/* unfreeze the grid - make editing possible to change words */
void unfreeze_puzzle (Puzzle *p)
{