int crook(d00d *master) { d00d *copy; b8 *mc, *cc; b8 pos, val=0, dummy; if(!(copy=(d00d *)malloc(sizeof(d00d)))) { fputs("crook: RAM denied, 0", stderr); exit(0); } if(first(master, &pos)) { mc=&master->i_v[pos]; cc=©->i_v[pos]; } else return 0; while(trial(mc, &val)) { *copy=*master; *cc=(((b8)val)|open|may_b[val]); if(squash(copy)){ rm(mc,val); /* should i check? :\ */ if(idea(master, &pos, &dummy)&&(dummy>val)) { free(copy); return 1; } } else val++; } free(copy); return 0; }
bool table_veiw::setData(const QModelIndex & index, const QVariant & value, int role) { if (!index.isValid() || role != Qt::EditRole) return false; int ideaIndex = index.row(); std::vector<idea> ideas = this->_ctrl->getIdeas(); if (ideaIndex == ideas.size()) { this->beginInsertRows(QModelIndex{}, ideaIndex, ideaIndex); QString quotes = ""; switch (index.column()) { case 0: this->_ctrl->addIdea(idea{value.toString().toStdString(), quotes.toStdString(), quotes.toStdString(), quotes.toInt() }); break; case 1: this->_ctrl->addIdea(idea( quotes.toStdString(), value.toString().toStdString(), quotes.toStdString(),quotes.toInt())); break; case 2: this->_ctrl->addIdea(idea{ quotes.toStdString(), quotes.toStdString(), value.toString().toStdString(), quotes.toInt()}); break; case 3: this->_ctrl->addIdea(idea{ quotes.toStdString(), quotes.toStdString(), quotes.toStdString(), value.toInt()}); break; } this->endInsertRows(); return true; } idea& currentidea = ideas[ideaIndex]; switch (index.column()) { case 0: currentidea.setDesc(value.toString().toStdString()); break; case 1: currentidea.setStatus(value.toString().toStdString()); break; case 2: currentidea.setCreator(value.toString().toStdString()); break; case 3: currentidea.setAct(value.toInt()); } emit dataChanged(index, index); return true; }
int hook(d00d *puzl) { b8 x; b8 *eye; b8 pos, val; while(idea(puzl, &pos, &val)) { for(x=0, eye=&clr[pos*7]; x<7; x++, eye++) { if(rm(&(puzl->i_v[*eye]), val)) { return -1; } } puzl->i_v[pos]&=(~open); if (!(--(puzl->left))) { STR(out,puzl); fputs(out ,stdout); } } return 1; }