Example #1
0
int main(int argc, char const *argv[]) {

  int nField = 1;

  for (;;) {

    scanf("%d %d", &n, &m);
    ((m==0 && n==0) ? exit(0) : 0); // stopping conditionnal statement

    // initialization loop
    for (size_t i = 0; i < n; i++) {
      scanf("%s", field[i]);
    }

    clearField(); // replacing all the '.' by '0'

    // processing loop
    for (size_t i = 0; i < n; i++) {
      for (size_t j = 0; j < m; j++) {
        (field[i][j] == '*' ? setMine(i,j) : 0);
      }
    }

    // display the result
    displayField(nField);

    nField++;

  }

  return 0;
}
Example #2
0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
void Field::setFraction(QString text)
{
    int res;
	double prev_fraction = fraction;
	fraction = text.toDouble();
	if (fraction != prev_fraction) {
        displayField(hour,&res);
	}
}
Example #3
0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
void Field::setPlane(QAbstractButton *button)
{
    int res;
    LOG_MSG("setPlane");
    QString text = button->text();
	int prev_axis = axis;
    if (text.compare("X-Y") == 0)
        axis = Z_AXIS;
    else if (text.compare("Y-Z") == 0)
        axis = X_AXIS;
    else if (text.compare("X-Z") == 0)
        axis = Y_AXIS;
	if (axis != prev_axis) {
        slice_changed = true;
        LOG_MSG("setPlane");
        displayField(hour,&res);
	}
}
Example #4
0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
void Field::setFieldConstituent(QAbstractButton *button)
{
    int res;
//    LOG_MSG("setFieldConstituent");
    int prev_constituent = field_constituent;
    QString text = button->text();
    for (int ivar=0; ivar<Global::nfieldvars_used; ivar++) {
        if (text == Global::var_string[ivar+1]) {
            field_constituent = ivar+1;
        }
    }

    if (field_constituent != prev_constituent) {
//        LOG_MSG("setFieldConstituent");
        slice_changed = true;
        displayField(hour,&res);
    }
}
Example #5
0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
void Field::setCellConstituent(QAbstractButton *button)
{
    int res;
    LOG_MSG("setCellConstituent");
    int prev_constituent = cell_constituent;
    QString text = button->text();
    for (int ivar=0; ivar<Global::nvars_used; ivar++) {
        if (text == Global::var_string[ivar]) {
            cell_constituent = ivar;
        }
    }

    if (cell_constituent != prev_constituent) {
        LOG_MSG("setCellConstituent -> displayField");
        slice_changed = true;
        displayField(hour,&res);
        LOG_MSG("did displayField");
    }
}
Example #6
0
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
void Field::setConstituent(QAbstractButton *button)
{
    int res;
//    QMessageBox msgBox;
//    msgBox.setText("setConstituent");
//    msgBox.exec();
    LOG_MSG("setConstituent");
	int prev_constituent = constituent;
    QString text = button->text();
//    constituentText = text;
    if (text.compare("Oxygen") == 0)
        constituent = OXYGEN;
    else if (text.compare("Glucose") == 0)
        constituent = GLUCOSE;
    else if (text.compare("Growth rate") == 0)
        constituent = GROWTH_RATE;
    if (constituent != prev_constituent) {
		constituent_changed = true;
        LOG_MSG("setConstituent");
        displayField(hour,&res);
	}
}