// -------------------------------------------------------- // does nothing on blank squares. Otherwise, it checks that the square's mark is in its possibility set and throws a fatal error if not. Finally, it updates the possibility sets in all the clusters to which it belongs by calling its delegate Cluster::shoop(). void BSquare:: shoop() const { if ( !isBlank() ) { if ( !isPossible(getMark()) ) throw Fatal("Mark %d not possible in square (%d, %d)", getMark(), row, column); else { // update possibleSet in the cluster for (std::vector<Cluster*>::const_iterator it = clu.begin(); it < clu.end(); it++) (*it)->shoop(this); } } }
void getMarks(int* ipcPtr, int* iosPtr, int* uliPtr, int* apcPtr, int* eacPtr){ int ipc; printf("Enter IPC mark: "); ipc = getMark(); *ipcPtr = ipc; printf("Enter IOS mark: "); *iosPtr = getMark(); printf("Enter ULI mark: "); *uliPtr = getMark(); printf("Enter APC mark: "); *apcPtr = getMark(); printf("Enter EAC mark: "); *eacPtr = getMark(); }
static bool fillSubject(QStringList splittedStudent, int studentId, int groupId, int offset, QString subject) { bool ok = true; if (!splittedStudent.at(offset).simplified().isEmpty()) { // fill first attestation int evaluationId = getEvaluationId(subject, "Аттестация", QString(), groupId, QString()); ok = fillMark(evaluationId, studentId, getMark(splittedStudent.at(offset).simplified(), splittedStudent.at(0) + "FA"), 0, QString()); } if (ok && !splittedStudent.at(offset + 1).simplified().isEmpty()) { // fill second attestation // custom date to differ it from first attestation int evaluationId = getEvaluationId(subject, "Аттестация", QString(), groupId, "02.01.1970"); ok = fillMark(evaluationId, studentId, getMark(splittedStudent.at(offset + 1).simplified(), splittedStudent.at(0) + "SA"), 0, QString()); } if (ok && !splittedStudent.at(offset + 2).simplified().isEmpty()) { // fill exam // or main attestation int evaluationId = getEvaluationId(subject, "Экзамен", splittedStudent.at(offset + 3), groupId, splittedStudent.at(offset + 4)); ok = fillMark(evaluationId, studentId, getMark(splittedStudent.at(offset + 2).simplified(), splittedStudent.at(0) + "MA"), 0, QString()); } if (ok && (splittedStudent.at(offset + 5).simplified() == "True" || splittedStudent.at(offset + 5).simplified() == "1") && !splittedStudent.at(offset + 2).simplified().isEmpty()) { // fill exam retaking int evaluationId = getEvaluationId(subject, "Экзамен", splittedStudent.at(offset + 7), groupId, splittedStudent.at(offset + 6)); ok = fillMark(evaluationId, studentId, getMark(splittedStudent.at(offset + 2).simplified(), splittedStudent.at(0) + "ER"), 0, QString()); } return ok; }
bool Player::hasSkill(const QString &skill_name, bool include_lose) const{ if (!include_lose) { if (!hasEquipSkill(skill_name)) { const Skill *skill = Sanguosha->getSkill(skill_name); if (phase == Player::NotActive) { const Player *current = NULL; foreach (const Player *p, getAliveSiblings()) { if (p->getPhase() != Player::NotActive) { current = p; break; } } if (current && current->hasSkill("huoshui") && hp >= (max_hp + 1) / 2 && (!skill || !skill->isAttachedLordSkill())) return false; if (current && current->hasSkill("neo2013huoshui") && current->getEquips().length() >= getEquips().length() && (!skill || !skill->isAttachedLordSkill())) return false; } if (getMark("Qingcheng" + skill_name) > 0) return false; if (skill_name != "chanyuan" && hasSkill("chanyuan") && hp == 1 && (!skill || !skill->isAttachedLordSkill())) return false; } } return head_skills.value(skill_name, false) || deputy_skills.value(skill_name, false) || acquired_skills.contains(skill_name); }
int Player::getAttackRange(bool include_weapon) const { if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) return 1000; include_weapon = include_weapon && weapon != NULL; int fixeddis = Sanguosha->correctAttackRange(this, include_weapon, true); if (fixeddis > 0) return fixeddis; int original_range = 1, weapon_range = 0; if (include_weapon) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } int real_range = qMax(original_range, weapon_range) + Sanguosha->correctAttackRange(this, include_weapon, false); if (real_range < 0) real_range = 0; return real_range; }
int getWord(myStrArray *args, char *word) { int last = args->strNum - 1; int i = 0; if (NULL == mark) { mark[0] = getMark(args); mark[1] = '\0'; } word[0] = '\0'; while(i <= last) { char *next = args->strArray[i]; if (0 == strcmp(mark, next)) { i++; continue; } strcat(word, next); strcat(word, " "); i++; } word[strlen(word)-1] = '\0';/*remove blank tail*/ debug("Get word [%s]", word); return strlen(word); }
void OutgoingDataQueue::putData(uint32 stamp, const unsigned char *data, size_t datalen) { if ( !data || !datalen ) return; size_t step = 0, offset = 0; while ( offset < datalen ) { // remainder and step take care of segmentation // according to getMaxSendSegmentSize() size_t remainder = datalen - offset; step = ( remainder > getMaxSendSegmentSize() ) ? getMaxSendSegmentSize() : remainder; CryptoContext* pcc = getOutQueueCryptoContext(getLocalSSRC()); if (pcc == NULL) { pcc = getOutQueueCryptoContext(0); if (pcc != NULL) { pcc = pcc->newCryptoContextForSSRC(getLocalSSRC(), 0, 0L); if (pcc != NULL) { pcc->deriveSrtpKeys(0); setOutQueueCryptoContext(pcc); } } } OutgoingRTPPkt* packet; if ( sendInfo.sendCC ) packet = new OutgoingRTPPkt(sendInfo.sendSources,15,data + offset,step, sendInfo.paddinglen, pcc); else packet = new OutgoingRTPPkt(data + offset,step,sendInfo.paddinglen, pcc); packet->setPayloadType(getCurrentPayloadType()); packet->setSeqNum(sendInfo.sendSeq++); packet->setTimestamp(stamp + getInitialTimestamp()); packet->setSSRCNetwork(getLocalSSRCNetwork()); if ( (0 == offset) && getMark() ) { packet->setMarker(true); setMark(false); } else { packet->setMarker(false); } if (pcc != NULL) { packet->protect(getLocalSSRC(), pcc); } // insert the packet into the "tail" of the sending queue sendLock.writeLock(); OutgoingRTPPktLink *link = new OutgoingRTPPktLink(packet,sendLast,NULL); if (sendLast) sendLast->setNext(link); else sendFirst = link; sendLast = link; sendLock.unlock(); offset += step; } }
public: void markCell(Cell* cell){ if(!isBorder(cell)) return; cell->setMark(getMark()); for(int axis=0; axis<3; axis++){ for(int dir=0; dir<2; dir++){ if(axis == td->getSwAxis() && dir == 1 - td->getSwDirection()) continue; cell->getSide(axis, dir)->setMark(getMark()); } for(int irib=0; irib<4; irib++){ Rib* rib = cell->getRib(axis, irib); if(axis == td->getSwAxis()){ rib->setMark(getMark()); } else if(axis == (td->getSwAxis() + 1)%3){ if(td->getSwDirection() == Cell::FORWARD_SIDE){ if(irib == Cell::ur || irib == Cell::dr) rib->setMark(getMark()); } else if(td->getSwDirection() == Cell::BACKWARD_SIDE){ if(irib == Cell::ul || irib == Cell::dl) rib->setMark(getMark()); } } else if(axis == (td->getSwAxis() + 2)%3){ if(td->getSwDirection() == Cell::FORWARD_SIDE){ if(irib == Cell::ur || irib == Cell::ul) rib->setMark(getMark()); } else if(td->getSwDirection() == Cell::BACKWARD_SIDE){ if(irib == Cell::dr || irib == Cell::dl) rib->setMark(getMark()); } } } } }
bool Player::hasSkill(const QString &skill_name, bool include_lose) const{ if (!include_lose) { if (!hasEquipSkill(skill_name) && ((hasFlag("huoshui") && getHp() >= (getMaxHp() + 1) / 2) || getMark("Qingcheng" + skill_name) > 0)) return false; } return skills.contains(skill_name) || acquired_skills.contains(skill_name); }
void getMark(int x, int label){ mark[x] = label; vis[x] = 1; for(int i = 0; i < int(treeEdge[x].size()); ++i) if(!vis[treeEdge[x][i]]){ depth[treeEdge[x][i]] = depth[x] + 1; fa[treeEdge[x][i]] = x; getMark(treeEdge[x][i], label); } }
void markEliminatedEdgesAndReset(Vertex *v) { for(Edge *vw :v->getOutEdges()) { Vertex *w=vw->getEndVertex(); if(getMark(w)==ELIMINATED) { edgeToReduce[vw]=true; //edgeToReduce.put(vw, true); } setMark(w,VACANT); } }
inline void getMark(){ memset(vis, 0, sizeof(vis)); vis[1] = 1; depth[1] = 0; for(int i = 0; i < int(treeEdge[1].size()); ++i){ depth[treeEdge[1][i]] = 1; fa[treeEdge[1][i]] = 1; getMark(treeEdge[1][i], treeEdge[1][i]); } }
int Player::getAttackRange() const{ int original_range = 1; if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity int weapon_range = 0; if (weapon != NULL) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } return qMax(original_range, weapon_range); }
void removeTransitiveEdges(Vertex *v,int maxLen) { v->sortEdges(); for(Edge *vw:v->getOutEdges()) { Vertex *w=vw->getEndVertex(); w->sortEdges(); if(getMark(w)!=INPLAY) { continue; } for(Edge *wx:w->getOutEdges()) { if(vw->length()+wx->length()>maxLen) { break; } Vertex *x=wx->getEndVertex(); if(getMark(x)==INPLAY) { count1++; setMark(x,ELIMINATED); } } } }
int Player::getAttackRange() const{ int original_range = 1; if (hasSkill("zhengfeng") && !weapon && hp > 1) original_range = hp; // @todo_P: new way to remove coupling or just put it into TargetModSkill if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity int weapon_range = 0; if (weapon != NULL) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } return qMax(original_range, weapon_range); }
bool Player::hasSkill(const QString &skill_name, bool include_lose) const{ if (!include_lose) { const Skill *skill = Sanguosha->getSkill(skill_name); if (!skill) { return false; } if ((!skill->inherits("WeaponSkill") && !skill->inherits("ArmorSkill")) && ((hasFlag("huoshui") && getHp() >= (getMaxHp() + 1) / 2) || getMark("Qingcheng" + skill_name) > 0)) return false; } return skills.contains(skill_name) || acquired_skills.contains(skill_name); }
Meta* Meta::clone() { Meta* ret = new Meta(); MetInf* retMetInf = new MetInf(getFormat(), getType(), getMark(), getSize(), getAnchor(), getVersion(), getNextNonce(), getMaxMsgSize(), getMaxObjSize(), getEMI(), getMem()); ret->setMetInf(retMetInf); if (retMetInf) { delete retMetInf; retMetInf = NULL; } return ret; }
void UseOrnamentDialog::accept() { QSettings settings; settings.beginGroup( NotationViewConfigGroup ); settings.setValue("useornamentmark", strtoqstr(getMark())); settings.setValue("useornamenttiming", strtoqstr(getTimeAdjust())); settings.setValue("useornamentretune", m_retune->isChecked()); settings.setValue("useornamentlastornament", m_ornament->currentIndex()); settings.endGroup(); QDialog::accept(); }
public: void markCell(Cell* cell){ if(!isBorder(cell)) return; cell->setMark(getMark()); for(int axis=0; axis<3; axis++){ for(int dir=0; dir<2; dir++){ Side* side = cell->getSide(axis, dir); if(isBorder(side->getBCell()) && isBorder(side->getFCell())) side->setMark(getMark()); } for(int irib=0; irib<4; irib++){ Rib* rib = cell->getRib(axis, irib); /* if((rib->getCell(Cell::ur) == NULL || isBorder(rib->getCell(Cell::ur))) && (rib->getCell(Cell::ul) == NULL || isBorder(rib->getCell(Cell::ul))) && (rib->getCell(Cell::dl) == NULL || isBorder(rib->getCell(Cell::dl))) && (rib->getCell(Cell::dr) == NULL || isBorder(rib->getCell(Cell::dr))) ) */ rib->setMark(getMark()); } } }
int Player::getAttackRange(bool include_weapon) const{ int original_range = 1; if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity int weapon_range = 0; if (include_weapon && weapon != NULL) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } bool six_swords_effect = false; foreach(const Player *p, getAliveSiblings()) { if (p->hasWeapon("SixSwords") && isFriendWith(p)) six_swords_effect = true; } return qMax(original_range, weapon_range) + (six_swords_effect ? 1 : 0); }
int Player::getAttackRange() const{ if(hasFlag("tianyi_success") || hasFlag("jiangchi_invoke")) return 1000; if(weapon){ if(weapon->objectName() == "luofeng_bow") return hp; else if(weapon->objectName() == "tianlangh") return qMax(getMark("@tianlang"), 1); else return weapon->getRange(); } else if(hasSkill("zhengfeng")) return hp; else if(hasSkill("CBZhangBa")) return 3; else return 1; }
void SeqPlot::showMW ( wxDC &dc , int b , int tx , int ty , int lx ) { int ch = can->charheight / 2 ; int cw = can->charwidth ; int bottom = ty + lines * can->charheight ; int u ; for ( u = 1 ; u < d1.GetCount() ; u++ ) { int tz = ty + (u-1) * ch + 1 ; int tw = ( tx + cw ) - lx ; if ( getMark ( b+1 ) > 0 ) { dc.SetPen ( *wxGREY_PEN ) ; myRect ( dc , lx , tz , tw , ch*can->charheight - 2 ) ; } } showPlot ( dc , b , tx , ty , lx , bottom - ty - ch ) ; }
void OutgoingDataQueue::sendImmediate(uint32 stamp, const unsigned char *data, size_t datalen) { if ( !data || !datalen ) return; size_t step = 0, offset = 0; while ( offset < datalen ) { // remainder and step take care of segmentation // according to getMaxSendSegmentSize() size_t remainder = datalen - offset; step = ( remainder > getMaxSendSegmentSize() ) ? getMaxSendSegmentSize() : remainder; CryptoContext* pcc = getOutQueueCryptoContext(getLocalSSRC()); OutgoingRTPPkt* packet; if ( sendInfo.sendCC ) packet = new OutgoingRTPPkt(sendInfo.sendSources,15,data + offset,step,sendInfo.paddinglen, pcc); else packet = new OutgoingRTPPkt(data + offset,step,sendInfo.paddinglen, pcc); packet->setPayloadType(getCurrentPayloadType()); packet->setSeqNum(sendInfo.sendSeq++); packet->setTimestamp(stamp + getInitialTimestamp()); packet->setSSRCNetwork(getLocalSSRCNetwork()); if ( (0 == offset) && getMark() ) { packet->setMarker(true); setMark(false); } else { packet->setMarker(false); } if (pcc != NULL) { packet->protect(getLocalSSRC(), pcc); } dispatchImmediate(packet); delete packet; offset += step; } }
string Assessment::toString(int n) { stringstream outString; for (int i = 0; i < n; i++) { outString << "---"; } outString << name << " : " << getPercentage() << "% : " << getMark() << "/" << getTotal() << " : " << getWeightedMark() << "/" << getWeight() << endl; for (iter = opps.begin(); iter != opps.end(); iter++) { outString << (*iter)->toString(n + 1); } //for (int i = 0; i < n; i++) //{ // outString << "---"; //} //outString << "_______________________________\n"; return outString.str(); }
void L6470::Dump(void) { #ifndef NDEBUG uint8_t reg; printf("Registers:\n"); printf("01:ABS_POS - Current position: %ld\n", getPos()); printf("02:EL_POS - Electrical position: %ld\n", getParam(L6470_PARAM_EL_POS)); printf("03:MARK - Mark position: %ld\n", getMark()); printf("04:SPEED - Current speed: %ld (raw)\n", getParam(L6470_PARAM_SPEED)); printf("05:ACC - Acceleration: %.2f steps/s2\n", getAcc()); printf("06:DEC - Deceleration: %.2f steps/s2\n", getDec()); printf("07:MAX_SPEED - Maximum speed: %.2f steps/s\n", getMaxSpeed()); printf("08:MIN_SPEED - Minimum speed: %.2f steps/s\n", getMinSpeed()); printf("09:KVAL_HOLD - Holding KVAL: %d\n", (int) getHoldKVAL()); printf("0A:KVAL_RUN - Constant speed KVAL: %d\n", (int) getRunKVAL()); printf("0B:KVAL_ACC - Acceleration starting KVAL: %d\n", (int) getAccKVAL()); printf("0C:KVAL_Dec - Deceleration starting KVAL: %d\n", (int) getDecKVAL()); printf("0D:INT_SPEED - Intersect speed: 0x%.4X (raw)\n", (unsigned int) getParam(L6470_PARAM_INT_SPD)); reg = getParam(L6470_PARAM_ST_SLP); printf("0E:ST_SLP - Start slope: %.3f\%% s/step (0x%.2X)\n", (float) 100 * SlpCalcValueReg(reg), reg); reg = getParam(L6470_PARAM_FN_SLP_ACC); printf("0F:FN_SLP_ACC - Acceleration final slope: %.3f\%% s/step (0x%.2X)\n", (float) 100 * SlpCalcValueReg(reg), reg); reg = getParam(L6470_PARAM_FN_SLP_DEC); printf("10:FN_SLP_DEC - Deceleration final slope: %.3f\%% s/step (0x%.2X)\n", (float) 100 * SlpCalcValueReg(reg), reg); reg = getParam(L6470_PARAM_K_THERM); printf("11:K_THERM - Thermal compensation factor: %.3f (0x%.2X)\n", KThermCalcValueReg(reg), reg); reg = getParam(L6470_PARAM_ADC_OUT); printf("12:ADC_OUT - ADC output: 0x%.2X\n", reg & 0x1F); reg = getOCThreshold(); printf("13:OCD_TH - OCD threshold: %d mA (0x%.2X)\n", OcdThCalcValueReg(reg), reg); reg = getParam(L6470_PARAM_STALL_TH); printf("14:STALL_TH - STALL threshold: %d mA (0x%.2X)\n", StallThCalcValueReg(reg & 0x7F), reg); printf("15:FS_SPD - Full-step speed: %.2f steps/s\n", getFullSpeed()); printf("16:STEP_MODE - Step mode: %d microsteps\n", 1 << getStepMode()); printf("17:ALARM_EN - Alarm enable: 0x%.2X\n", (unsigned int) getParam(L6470_PARAM_ALARM_EN)); printf("18:CONFIG - IC configuration: 0x%.4X\n", (unsigned int) getParam(L6470_PARAM_CONFIG)); #endif }
void MergeTreeReader::Stream::seekToMark(size_t index) { MarkInCompressedFile mark = getMark(index); try { if (cached_buffer) cached_buffer->seek(mark.offset_in_compressed_file, mark.offset_in_decompressed_block); if (non_cached_buffer) non_cached_buffer->seek(mark.offset_in_compressed_file, mark.offset_in_decompressed_block); } catch (Exception & e) { /// Better diagnostics. if (e.code() == ErrorCodes::ARGUMENT_OUT_OF_BOUND) e.addMessage("(while seeking to mark " + toString(index) + " of column " + path_prefix + "; offsets are: " + toString(mark.offset_in_compressed_file) + " " + toString(mark.offset_in_decompressed_block) + ")"); throw; } }
void removeShortEdges(Vertex *v) { for(Edge *vw :v->getOutEdges()) { Vertex *w=vw->getEndVertex(); int numIter=0; for(Edge *wx : w->getOutEdges()) { Vertex *x=wx->getEndVertex(); numIter++; if(getMark(x)!=INPLAY) { continue; } if(numIter==1) { count2++; setMark(x,ELIMINATED); } else if(wx->length()<FUZZ) { count2++; setMark(x,ELIMINATED); } else if (wx->length()>=FUZZ) { break; } } } }
int main(){ scanf("%d", &N); S = 0, T = 2 * N + 1; for(int i = 1; i < N; ++i){ int x, y; scanf("%d%d", &x, &y); treeEdge[x].push_back(y); treeEdge[y].push_back(x); } getMark(); for(int i = N; i > 1; --i){ addedge(i, fa[i], T); } std::vector<std::pair<int, std::pair<int, int> > > rems; for(int i = 1; i <= N; ++i){ int x, y; scanf("%d%d", &x, &y); if(depth[x] > depth[y]) std::swap(x, y); if(x == 1 || mark[x] == mark[y]){ preQ[y].push(std::make_pair(depth[x], i)); } else{ addedge(S, N + i, 1); addedge(N + i, x, 1); addedge(N + i, y, 1); rems.push_back(std::make_pair(i, std::make_pair(x, y))); } } memset(vis, 0, sizeof(vis)); if(!getPreDecide(1) || preQ[1].size()){ printf("No\n"); return 0; } for(int i = 1; i <= N; ++i){ if(!decided[i]){ addedge(i, T, 1); } } maxflow = 0; while(modlabel()){ maxflow += aug(S, T); } if(maxflow != N - preDecide){ printf("No\n"); return 0; } for(int i = 1; i <= N; ++i){ for(edge *ii = V[N + i]; ii; ii = ii -> nxt){ if(ii -> u == 0 && ii -> t > 0 && ii -> t <= N){ toDecide[ii -> t].push_back(i); } } } memset(vis, 0, sizeof(vis)); getAnswer(1); printf("Yes\n"); for(int i = 1; i <= N; ++i){ printf("%d%c", ans[i], i == N ? '\n' : ' '); } return 0; }
public: int getBorderMark(Cell* cell){ if(!isBorder(cell)) return NULL; return getMark(); };
bool Player::hasArmorEffect(const QString &armor_name) const{ return armor && getMark("qinggang") == 0 && armor->objectName() == armor_name; }