void LanguageModel::EvaluateInIsolation(MemPool &pool, const System &system, const Phrase<Moses2::Word> &source, const TargetPhraseImpl &targetPhrase, Scores &scores, SCORE &estimatedScore) const { if (targetPhrase.GetSize() == 0) { return; } SCORE score = 0; SCORE nonFullScore = 0; vector<const Factor*> context; // context.push_back(m_bos); context.reserve(m_order); for (size_t i = 0; i < targetPhrase.GetSize(); ++i) { const Factor *factor = targetPhrase[i][m_factorType]; ShiftOrPush(context, factor); if (context.size() == m_order) { std::pair<SCORE, void*> fromScoring = Score(context); score += fromScoring.first; } else { std::pair<SCORE, void*> fromScoring = Score(context); nonFullScore += fromScoring.first; } } scores.PlusEquals(system, *this, score); SCORE weightedScore = Scores::CalcWeightedScore(system, *this, nonFullScore); estimatedScore += weightedScore; }
/** * @brief FacialModule::onScoreRequest * On charge le modèle contenue dans le filename * On enregistre l'image de la personne dans une Mat * On tente la reconnaissance * @param p */ void FacialModule::onScoreRequest(Packet *p) { ScoreResultPacket pReturn(p); ScoringVector *score = new ScoringVector(); FacialUtils::loadFaceRecognizer(_faceRecognizer, FACERECO); vector<uint8> img(p->getData(), p->getData() + p->getBodySize()); Mat m = imdecode(img, CV_LOAD_IMAGE_GRAYSCALE); //On recupère la prediction; double confidence = 0.0; int predictedLabel = -1; try { _faceRecognizer->predict(m, predictedLabel, confidence); } catch(Exception) { *this << WARNING << "Impossible de prédire un score" << endl; score->push_back(Score("Inconnu", confidence)); } map<int, string> names = FacialUtils::reloadFromCSVFile(FICHIER); if(predictedLabel != -1) { score->push_back(Score(names[predictedLabel], confidence)); //*this << INFO << names[predictedLabel] << confidence << endl; } pReturn.setScoringVector(score)->doSend(); }
//destroys the asteroid, spawning new ones if necessary void AsteroidHit(LIST * a, int fromplayershot) { if(a) { PlaySoundIndex(SND_EXP_ASTEROID); SpawnExplosion(NewListNode(&g_explosion_list, sizeof(EXPLOSION)), &(((ASTEROID *)a->d)->pos), (int)(((ASTEROID *)a->d)->scale) * 8); if(((ASTEROID *)a->d)->scale > 1.0f) { if(fromplayershot) Score(((ASTEROID *)a->d)->scale > 2.0f ? 20 : 50, &(((ASTEROID *)a->d)->pos)); SpawnAsteroid(NewListNode(&g_asteroid_list, sizeof(ASTEROID)), &(((ASTEROID *)a->d)->pos), ((ASTEROID *)a->d)->scale * 0.5f); SpawnAsteroid(NewListNode(&g_asteroid_list, sizeof(ASTEROID)), &(((ASTEROID *)a->d)->pos), ((ASTEROID *)a->d)->scale * 0.5f); } else if(fromplayershot) Score(100, &(((ASTEROID *)a->d)->pos)); RemoveNode(a, &g_asteroid_list); if(!g_asteroid_list && g_ships) g_time_to_reset = RESET_TIME; } }
Score LexicalReorderingTableTree::auxFindScoreForContext(const Candidates& cands, const Phrase& context){ if(m_FactorsC.empty()){ assert(cands.size() <= 1); return (1 == cands.size())?(cands[0].GetScore(0)):(Score()); } else { std::vector<std::string> cvec; for(size_t i = 0; i < context.GetSize(); ++i){ /* old code std::string s = context.GetWord(i).ToString(m_FactorsC); cvec.push_back(s.substr(0,s.size()-1)); */ cvec.push_back(context.GetWord(i).GetString(m_FactorsC, false)); } IPhrase c = m_Table.ConvertPhrase(cvec,TargetVocId); IPhrase sub_c; IPhrase::iterator start = c.begin(); for(size_t j = 0; j <= context.GetSize(); ++j, ++start){ sub_c.assign(start, c.end()); for(size_t cand = 0; cand < cands.size(); ++cand){ IPhrase p = cands[cand].GetPhrase(0); if(cands[cand].GetPhrase(0) == sub_c){ return cands[cand].GetScore(0); } } } return Score(); } }
bool GameMaster::CollisionCheck() { if (m_ball.GetPosition().TopLeft().x + 1 <= m_player1.GetPaddle().BottomRight().x && m_ball.GetPosition().BottomRight().y + 1 >= m_player1.GetPaddle().TopLeft().y && m_ball.GetPosition().TopLeft().y + 1 <= m_player1.GetPaddle().BottomRight().y) m_ball.ChangeSpeedX(); if (m_ball.GetPosition().BottomRight().x + 1 >= m_player2.GetPaddle().TopLeft().x && m_ball.GetPosition().BottomRight().y + 1 >= m_player2.GetPaddle().TopLeft().y && m_ball.GetPosition().TopLeft().y + 1 <= m_player2.GetPaddle().BottomRight().y) m_ball.ChangeSpeedX(); if (m_ball.GetPosition().TopLeft().y <= m_WInfo.top + 15 || m_ball.GetPosition().BottomRight().y >= m_WInfo.bottom) m_ball.ChangeSpeedY(); if (m_ball.GetPosition().TopLeft().x <= m_player1.GetPaddle().BottomRight().x - 5) { return Score(2); } if (m_ball.GetPosition().BottomRight().x >= m_player2.GetPaddle().TopLeft().x + 5) { return Score(1); } return false; }
float MulticlassPA::TrainOneExample(const vector<float>& inputs, int target) { //CHECK_GE(target, 0); //CHECK_LT(target, num_classes_); float target_class_score = Score(inputs, parameters_[target]); // VLOG(1) << "target class " << target << " score " << target_class_score; int other_class = PickAClassExcept(target); float other_class_score = Score(inputs, parameters_[other_class]); // VLOG(1) << "other class " << other_class << " score " << other_class_score; float loss = 1.0 - target_class_score + other_class_score; if (loss > 0.0) { // Compute the learning rate according to PA-I. float twice_norm_square = L2NormSquare(inputs) * 2.0; if (twice_norm_square == 0.0) { twice_norm_square = kEpsilon; } float rate = loss / twice_norm_square; if (rate > aggressiveness_) { rate = aggressiveness_; } // VLOG(1) << "loss = " << loss << " rate = " << rate; // Modify the parameter vectors of the correct and wrong classes for (int i = 0; i < static_cast<int>(inputs.size()); ++i) { // First modify the parameter value of the correct class parameters_[target][i] += rate * inputs[i]; // Then modify the parameter value of the wrong class parameters_[other_class][i] -= rate * inputs[i]; } return loss; } return 0.0; }
// Compare SAMAlignment objects by qName, score and // target positions. bool byQNameScoreTStart(const SAMAlignment & a, const SAMAlignment & b) { if (a.qName == b.qName) { if (a.score == b.score) return a.pos < b.pos; return Score(a.score, scoreSign).WorseThan(Score(b.score, scoreSign)); } return (a.qName < b.qName); }
bool HitPolicy::compareByScoreTStart(const PacBio::BAM::BamRecord & a, const PacBio::BAM::BamRecord & b) const { assert(a.Impl().HasTag(AS) and b.Impl().HasTag(AS)); assert(a.FullName() == b.FullName()); const int aScore = a.Impl().TagValue(AS).ToInt32(); const int bScore = b.Impl().TagValue(AS).ToInt32(); if (aScore == bScore) return a.ReferenceStart() < b.ReferenceEnd(); return Score(aScore, _sign).WorseThan(Score(bScore, _sign)); }
void GameWidget::loadDefaultScores() { m_scores.append(Score("Jean-Luc Picard", 10000000));//1 m_scores.append(Score("William T. Riker", 5000000));//2 m_scores.append(Score("Data", 1000000));//3 m_scores.append(Score("Deanna Troi", 500000));//4 m_scores.append(Score("Geordi La Forge", 100000));//5 m_scores.append(Score("Worf", 50000));//6 m_scores.append(Score("Beverly Crusher", 10000));//7 m_scores.append(Score("Tasha Yar", 5000));//8 m_scores.append(Score("Reginald Barclay", 1000));//9 m_scores.append(Score("Wesley Crusher", 500));//10 }
void LanguageModel::EvaluateWhenApplied(const ManagerBase &mgr, const Hypothesis &hypo, const FFState &prevState, Scores &scores, FFState &state) const { const LMState &prevLMState = static_cast<const LMState &>(prevState); size_t numWords = prevLMState.numWords; // context is held backwards vector<const Factor*> context(numWords); for (size_t i = 0; i < numWords; ++i) { context[i] = prevLMState.lastWords[i]; } //DebugContext(context); SCORE score = 0; std::pair<SCORE, void*> fromScoring; const TargetPhrase<Moses2::Word> &tp = hypo.GetTargetPhrase(); for (size_t i = 0; i < tp.GetSize(); ++i) { const Word &word = tp[i]; const Factor *factor = word[m_factorType]; ShiftOrPush(context, factor); fromScoring = Score(context); score += fromScoring.first; } const Bitmap &bm = hypo.GetBitmap(); if (bm.IsComplete()) { // everything translated ShiftOrPush(context, m_eos); fromScoring = Score(context); score += fromScoring.first; fromScoring.second = NULL; context.clear(); } else { assert(context.size()); if (context.size() == m_order) { context.resize(context.size() - 1); } } scores.PlusEquals(mgr.system, *this, score); // return state //DebugContext(context); LMState &stateCast = static_cast<LMState&>(state); MemPool &pool = mgr.GetPool(); stateCast.Set(pool, fromScoring.second, context); }
std::pair<unsigned int, uint8_t> Find_single_byte_xor_key(const std::vector<uint8_t>& buffer1) { auto best_score = 0u; uint8_t best_key = 0; uint8_t key = 0; for(auto ix = 0; ix < 256; ++ix) { const std::vector<uint8_t> key_vector(&key, &key + 1); const auto xor_sum = Xor_sum_vectors(buffer1, key_vector); auto score = Score(xor_sum); PortableRuntime::dprintf("Key: %d, score: %u\n", ix, score); if(score > best_score) { best_score = score; best_key = key; } ++key; } PortableRuntime::dprintf("Best key: %u\nBest score: %u\n", static_cast<unsigned int>(best_key), best_score); // TODO: why are types necessary here? return std::pair<unsigned int, uint8_t>(best_score, best_key); //return std::pair(best_score, best_key); }
std::vector<float> LexicalReorderingTableMemory::GetScore(const Phrase& f, const Phrase& e, const Phrase& c) { //rather complicated because of const can't use []... as [] might enter new things into std::map //also can't have to be careful with words range if c is empty can't use c.GetSize()-1 will underflow and be large TableType::const_iterator r; std::string key; if(0 == c.GetSize()){ key = MakeKey(f,e,c); r = m_Table.find(key); if(m_Table.end() != r){ return r->second; } } else { //right try from large to smaller context for(size_t i = 0; i <= c.GetSize(); ++i){ Phrase sub_c(c.GetSubString(WordsRange(i,c.GetSize()-1))); key = MakeKey(f,e,sub_c); r = m_Table.find(key); if(m_Table.end() != r){ return r->second; } } } return Score(); }
//initializes or resets the state of the game void NextLevel(void) { int i; PlaySoundIndex(SND_NEWLEVEL); g_level++; InitStarfield(&g_starfield); DeleteEntireList(&g_asteroid_list); DeleteEntireList(&g_alien_list); DeleteEntireList(&g_shot_list); DeleteEntireList(&g_explosion_list); DeleteEntireList(&g_burst_list); DeleteEntireList(&g_powerup_list); i = g_player.powerups; ResetPlayer(&g_player); g_player.powerups = i; for(i = 0; i < (int)(log((double)g_level) + 2.5); i++) SpawnAsteroid(NewListNode(&g_asteroid_list, sizeof(ASTEROID)), NULL, 4.0f); Score((g_level > 100 ? 999 : (g_level - 1) * 10), NULL); //completion bonus g_frame = 0; g_time_to_reset = 0; }
std::pair<SCORE, void*> LanguageModel::Score( const std::vector<const Factor*> &context) const { //cerr << "context="; //DebugContext(context); std::pair<SCORE, void*> ret; typedef Node<const Factor*, LMScores> LMNode; const LMNode *node = m_root.getNode(context); if (node) { ret.first = node->getValue().prob; ret.second = (void*) node; } else { SCORE backoff = 0; std::vector<const Factor*> backOffContext(context.begin() + 1, context.end()); node = m_root.getNode(backOffContext); if (node) { backoff = node->getValue().backoff; } std::vector<const Factor*> newContext(context.begin(), context.end() - 1); std::pair<SCORE, void*> newRet = Score(newContext); ret.first = backoff + newRet.first; ret.second = newRet.second; } //cerr << "score=" << ret.first << endl; return ret; }
int main(){ char collectString[LEN_MAX+1]; gets(collectString); for(int i=0;i<strlen(collectString);i++) collect[collectString[i]-'a']++; while(true){ gets(dictionary[wordNum]); if(dictionary[wordNum][0]=='.') break; if(Legal(dictionary[wordNum])){ score[wordNum]=Score(dictionary[wordNum]); if(scoreMax<score[wordNum]) scoreMax=score[wordNum]; for(int i=0;i<wordNum;i++){ char temp[2*LEN_MAX+1]; strcpy(temp,dictionary[i]); strcat(temp,dictionary[wordNum]); if(Legal(temp) && scoreMax<score[i]+score[wordNum]) scoreMax=score[i]+score[wordNum]; } wordNum++; } } printf("%d\n",scoreMax); return 0; }
SparsePoa::ReadKey SparsePoa::AddRead(const std::string& readSequence, const PoaAlignmentOptions& /* alnOptions */, float minScoreToAdd) { AlignConfig config = DefaultPoaConfig(AlignMode::LOCAL); Path outputPath; ReadKey key = -1; if (graph_->NumReads() == 0) { graph_->AddFirstRead(readSequence, &outputPath); readPaths_.push_back(outputPath); reverseComplemented_.push_back(false); key = graph_->NumReads() - 1; } else { auto c = graph_->TryAddRead(readSequence, config, rangeFinder_); if (c->Score() >= minScoreToAdd) { graph_->CommitAdd(c, &outputPath); readPaths_.push_back(outputPath); reverseComplemented_.push_back(false); key = graph_->NumReads() - 1; } delete c; } return key; }
//--------------------------- Render ------------------------------------- // //------------------------------------------------------------------------ void Raven_Bot::Render() { //when a bot is hit by a projectile this value is set to a constant user //defined value which dictates how long the bot should have a thick red //circle drawn around it (to indicate it's been hit) The circle is drawn //as long as this value is positive. (see Render) m_iNumUpdatesHitPersistant--; if (isDead() || isSpawning()) return; gdi->BluePen(); m_vecBotVBTrans = WorldTransform(m_vecBotVB, Pos(), Facing(), Facing().Perp(), Scale()); gdi->ClosedShape(m_vecBotVBTrans); //draw the head (gdi->*(m_pTeam->GetPen()))(); gdi->Circle(Pos(), 6.0 * Scale().x); //render the bot's weapon m_pWeaponSys->RenderCurrentWeapon(); //render a thick red circle if the bot gets hit by a weapon if (m_bHit) { gdi->ThickRedPen(); gdi->HollowBrush(); gdi->Circle(m_vPosition, BRadius()+1); if (m_iNumUpdatesHitPersistant <= 0) { m_bHit = false; } } gdi->TransparentText(); gdi->TextColor(0,255,0); if (UserOptions->m_bShowBotIDs) { gdi->TextAtPos(Pos().x -10, Pos().y-20, ttos(ID())); } if (UserOptions->m_bShowBotHealth) { gdi->TextAtPos(Pos().x-40, Pos().y-5, "H:"+ ttos(Health())); } if (UserOptions->m_bShowScore) { gdi->TextAtPos(Pos().x-40, Pos().y+10, "Scr:"+ ttos(Score())); } }
std::string MatchStateSystem::GetScoreList() { std::vector<Score> scoreList; std::string scoreString = "["; for(auto pair : g_networkEntityMap) { if(pair.first.ActionID != Network::ReservedActionID::CONNECT || pair.first.SequenceID != RootForce::Network::SEQUENCE_PLAYER_ENTITY || !pair.second) continue; PlayerComponent* playerComponent = g_world->GetEntityManager()->GetComponent<PlayerComponent>(pair.second); scoreList.push_back(Score(playerComponent->TeamID, playerComponent->Name, playerComponent->Score, playerComponent->Deaths)); } std::sort(scoreList.begin(), scoreList.end(), &CompareScores); bool first = true; for(auto score : scoreList) { if(first) first = !first; else scoreString += ","; scoreString += "["+std::to_string(score.Team)+",'" + RootEngine::GUISystem::PreventHTMLInjections(score.Name) + "',"+std::to_string(score.Kills)+","+std::to_string(score.Deaths)+"]"; } scoreString += "]"; return scoreString; }
std::vector<PacBio::BAM::BamRecord> HitPolicy::Apply( const std::vector<PacBio::BAM::BamRecord>& records, const bool& createRand, const int& passedRand) const { if (records.empty() or IsAll()) return records; int rint = createRand ? rand() : passedRand; //std::cout << "FilterCriteria " << ", " << records[0].FullName() << ", " << rint << std::endl; if (IsRandom()) { return std::vector<PacBio::BAM::BamRecord>({records[rint % records.size()]}); } std::vector<PacBio::BAM::BamRecord> ret = records; // Sort bam records according to score and target start position. ScoreSign sign = this->Sign(); std::sort(ret.begin(), ret.end(), [&sign](const PacBio::BAM::BamRecord& a, const PacBio::BAM::BamRecord& b) -> bool { assert(a.Impl().HasTag(AS) and b.Impl().HasTag(AS)); assert(a.FullName() == b.FullName()); const int aScore = a.Impl().TagValue(AS).ToInt32(); const int bScore = b.Impl().TagValue(AS).ToInt32(); if (aScore == bScore) return a.ReferenceStart() < b.ReferenceEnd(); else return Score(aScore, sign).WorseThan(Score(bScore, sign)); }); // Get the best alignments whose alignment scores are the best. // Assume that input alignments share the same query name and // are sorted by score and tPos asscendingly: worst, ...., best int bestScore = ret[0].Impl().TagValue(AS).ToInt32(); ret.erase(std::remove_if(ret.begin(), ret.end(), [&bestScore](const PacBio::BAM::BamRecord& x) -> bool { return x.Impl().TagValue(AS).ToInt32() != bestScore; }), ret.end()); if (IsAllbest()) { return ret; } else if (IsRandombest()) { return std::vector<PacBio::BAM::BamRecord>({ret[rint % ret.size()]}); } else if (IsLeftmost()) { return std::vector<PacBio::BAM::BamRecord>({ret[0]}); } else { BLASR_THROW("Unsupported hit policy"); } }
void StateGameOver::Reset(GameManager &Mgr) { Mgr.player = Player(); Mgr.enemies.clear(); Mgr.lasers.clear(); Mgr.score = Score((int)Mgr.player.hp); Mgr.spawner = Spawner(); }
void Pipeline::Execute(Data *data, const char *path) { static unsigned int id = 0; vector<PipeNode*> queue; vector<Data*> data_queue; vector<unsigned int> id_queue; queue.push_back((*nodes)[0]); data_queue.push_back(data); id_queue.push_back(++id); for (int i = 0; i < queue.size(); i++) { id++; if (NULL == queue[i]->proc) { fprintf(stderr, "NULL proccessor occured!\n"); return; } else { //fprintf(stdout, "Executing: %s...\n", queue[i]->label.c_str()); clock_t start = clock(); Data *temp_data = queue[i]->proc(data_queue[i]); clock_t duration = clock() - start; if (NULL == data) { fprintf(stderr, "Null Data found after: %s, abort\n", queue[i]->label.c_str()); return; } vector<PipeNode*> *temp_succs = queue[i]->succs; char filename[32]; char strid[32]; strcpy(filename, path); strcat(filename, "/"); sprintf(strid, "%x", id); strcat(filename, strid); temp_data->Record(filename); //write to log fprintf(log, "%x %s %x %ld\n", id_queue[i], queue[i]->label.c_str(), id, duration); //srcid, proc, dstid, duration for (int j = 0; j < temp_succs->size(); j++) { queue.push_back((*temp_succs)[j]); data_queue.push_back(temp_data); id_queue.push_back(id); } if (0 == temp_succs->size()) //last node in a path { //fprintf(stdout, "Scoring after: %s...\n", queue[i]->label.c_str()); Score(queue[i], temp_data, ans); //printf("Scoring done\n"); //fflush(stdout); } } } }
void MoveShar () { int x = 100, y = 100; int x1 = 1000, y1 = 700; int x2 = 500, y2 = 400; int x3 = 800, y3 = 400; int vx = 3, vy = 0; int vx1 = -3, vy1 = 0; int vx2 = 0, vy2 = 3; int vx3 = 0, vy3 = -3; int Xpr = 600, Ypr = 400; int Xpr1 = 400, Ypr1 = 600; int Xpr2 = 1200, Ypr2 = 450; int Xpr3 = 100, Ypr3 = 600; int Xpr4 = 300, Ypr4 = 300; double dt = 1; double v = 3, v1 = 3, v2 = 3, v3 = 3; double Diametr = 20; while (!GetAsyncKeyState(VK_ESCAPE)) { if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); } dt = dt + 0.001; Score (dt, 750, 50); txSetColor (TX_LIGHTRED); txSetFillColor (TX_LIGHTRED); txCircle (x, y, Diametr); txSetColor (TX_LIGHTGREEN); txSetFillColor (TX_LIGHTGREEN); txCircle (x1, y1, Diametr); txSetColor (TX_LIGHTBLUE); txSetFillColor (TX_LIGHTBLUE); txCircle (x2, y2, Diametr); txSetColor (TX_LIGHTMAGENTA); txSetFillColor (TX_LIGHTMAGENTA); txCircle (x3, y3, Diametr); Prepyatstvie (Xpr, Ypr); Prepyatstvie (Xpr1, Ypr1); Prepyatstvie (Xpr2, Ypr2); Prepyatstvie (Xpr3, Ypr3); Prepyatstvie (Xpr4, Ypr4); Sharik (&x, &y, &vx, &vy, &v, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik1 (&x1, &y1, &vx1, &vy1, &v1, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik2 (&x2, &y2, &vx2, &vy2, &v2, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik3 (&x3, &y3, &vx3, &vy3, &v3, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); //Chit (&v1); txSleep (3); } }
int CRegionEvaluator::Evaluate(ChessType* board, ChessType col, int empties, bool end) { if(end || !empties){ return FinalScore(board, col); } int emptiesNum=CGameScript::CountChess(board, (ChessType)EMPTY); return Score(board, col, emptiesNum); }
Score LexicalReorderingTableTree::GetScore(const Phrase& f, const Phrase& e, const Phrase& c) { if( (!m_FactorsF.empty() && 0 == f.GetSize()) || (!m_FactorsE.empty() && 0 == e.GetSize())){ //NOTE: no check for c as c might be empty, e.g. start of sentence //not a proper key // phi: commented out, since e may be empty (drop-unknown) //std::cerr << "Not a proper key!\n"; return Score(); } CacheType::iterator i;; if(m_UseCache){ std::pair<CacheType::iterator, bool> r = m_Cache.insert(std::make_pair(MakeCacheKey(f,e),Candidates())); if(!r.second){ return auxFindScoreForContext((r.first)->second, c); } i = r.first; } else if(!m_Cache.empty()) { //although we might not be caching now, cache might be none empty! i = m_Cache.find(MakeCacheKey(f,e)); if(i != m_Cache.end()){ return auxFindScoreForContext(i->second, c); } } //not in cache go to file... Score score; Candidates cands; m_Table.GetCandidates(MakeTableKey(f,e), &cands); if(cands.empty()){ return Score(); } if(m_FactorsC.empty()){ assert(1 == cands.size()); return cands[0].GetScore(0); } else { score = auxFindScoreForContext(cands, c); } //cache for future use if(m_UseCache){ i->second = cands; } return score; };
void Game::score() { sf::Font textFont; textFont.loadFromFile("Fonts/BankGothic.ttf"); //int score1,score; //Game::player1score =score1; sf::Text Score("0 0", textFont, 50); Score.setColor(sf::Color(100,100,100)); Score.setPosition(sf::Vector2f(SCREEN_LENGTH / 2 - 68, 20)) ; }
double MerlinMatrix::Calculate(Tree & tree, const char * label) { // Clear probability vector probabilities.Clear(); matrices.Clear(); // Calculate IBDs as well as the overall likelihood double likelihood = Score(tree, 0, tree.bit_count - 1, mantra.two_f); Output(label, likelihood); return likelihood * pow(2.0, -mantra.bit_count); }
int MulticlassPA::GetClass(const vector<float>& inputs) { int best_class = -1; float best_score = -10000.0; // float best_score = -MathLimits<float>::kMax; for (int i = 0; i < num_classes_; ++i) { float score_i = Score(inputs, parameters_[i]); if (score_i > best_score) { best_score = score_i; best_class = i; } } return best_class; }
int Player::Hit(BYTE card) { if (m_nCardIdx >= (PLYR_MAX_CARDS - 1)) { return BJ_ERR_PROGRAM_ERR; } if (card <= 0) { return BJ_ERR_PROGRAM_ERR; } m_Cards[m_nCardIdx++] = card; m_Cards[m_nCardIdx] = PLYR_CARD_TERM; return Score(); }
//destroys the alien ship void AlienHit(LIST * a, int fromplayershot) { if(a) { PlaySoundIndex(SND_EXP_OTHER); SpawnExplosion(NewListNode(&g_explosion_list, sizeof(EXPLOSION)), &(((ALIEN *)a->d)->pos), (((ALIEN *)a->d)->scale == 2.0f ? NUM_EXPLOSION_PARTICLES / 2 : NUM_EXPLOSION_PARTICLES)); if(fromplayershot) Score((((ALIEN *)a->d)->scale == 2.0f ? 500 : 200), &(((ALIEN *)a->d)->pos)); RemoveNode(a, &g_alien_list); } }
//destroys the powerup without getting it void PowerupHit(LIST * p, int fromplayershot) { if(p) { PlaySoundIndex(SND_EXP_OTHER); SpawnExplosion(NewListNode(&g_explosion_list, sizeof(EXPLOSION)), &(((POWERUP *)p->d)->pos), NUM_EXPLOSION_PARTICLES / 2); if(fromplayershot) Score(666, &(((POWERUP *)p->d)->pos)); RemoveNode(p, &g_powerup_list); } }