+static int get_count_color(const game_state *state, int rowcol, int which,
+ int index, int target)
+{
+ int idx;
+ int count = count_rowcol(state, index, rowcol, which);
+
+ if ((count > target) ||
+ (count < target && !count_rowcol(state, index, rowcol, -1))) {
+ return COL_ERROR;
+ } else if (rowcol == COLUMN) {
+ idx = clue_index(state, index, which == POSITIVE ? -1 : state->h);
+ } else {
+ idx = clue_index(state, which == POSITIVE ? -1 : state->w, index);
+ }
+
+ if (state->counts_done[idx]) {
+ return COL_DONE;
+ }
+
+ return COL_TEXT;
+}