int possible_count(int x, int y, boardtype *board) { int i; /* counter */ int cnt; /* number of open squares */ bool possible[DIMENSION+1]; /* what is possible for the square */ possible_values(x,y,board,possible); cnt = 0; for (i=0; i<=DIMENSION; i++) if (possible[i] == TRUE) cnt++; return(cnt); }
QStringList BatteryBusinessLogic::PSMThresholdValues () { MGConfItem possible_values (psm_values_key); QStringList retval; retval = possible_values.value ().toStringList (); if (retval.size() == 0) { SYS_WARNING ("The GConf key %s is not set. Falling back to default.", SYS_STR(psm_values_key)); retval << "10" << "20" << "30" << "40" << "50"; } return retval; }
construct_candidates(int a[], int k, boardtype *board, int c[], int *ncandidates) { int x,y; /* position of next move */ int i; /* counter */ bool possible[DIMENSION+1]; /* what is possible for the square */ next_square(&x,&y,board); /* which square should we fill next? */ board->move[k].x = x; /* store our choice of next position */ board->move[k].y = y; *ncandidates = 0; if ((x<0) && (y<0)) return; /* error condition, no moves possible */ possible_values(x,y,board,possible); for (i=1; i<=DIMENSION; i++) if (possible[i] == TRUE) { c[*ncandidates] = i; *ncandidates = *ncandidates + 1; } }