void OPFScore::predict(Data *data) { Subgraph *g = data2Subgraph(data); int cntSamples, nSamples; destroyScores(); scoreSize = data->getNSamples(); scoresNumClasses = subgraph->nlabels; scores = new float*[scoreSize]; for (int i = 0; i < scoreSize; i++) scores[i] = new float[scoresNumClasses]; opf_OPFClassifyingScore(subgraph, g, scores); for(cntSamples = 0, nSamples = data->getNSamples(); cntSamples < nSamples; ++cntSamples){ data->setClassificationLabel(cntSamples, g->node[cntSamples].label); } DestroySubgraph(&g); //this->predictedData = data->clone(); }
OPFScore::~OPFScore() { destroyScores(); }
void drawGameScreen() { clear(); //draw exterior of game drawBox(10, 3, 44, 34, 0); //draw path walls drawBox(10, 7, 11, 3, 0); drawBox(18, 7, 4, 14, 0); drawBox(18, 18, 16, 3, 0); drawBox(31, 7, 4, 14, 0); drawBox(31, 7, 18, 3, 0); drawBox(46, 7, 4, 24, 0); drawBox(19, 28, 30, 3, 0); drawBox(19, 28, 4, 9, 0); //fix up the corners clearPath(); fixCorners(); //add beginning and ending chars mvaddch(8, 8, '>'); mvaddch(37, 21, ACS_DARROW); //draw and fill the purchase portion of the screen attron(COLOR_PAIR(0)); drawPurchaseArea(); basicSetupScreen(1); updateScore(0); attroff(COLOR_PAIR(0)); drawTowerExplain(); //load arrays for drawing TowerArray* theTowerList = getTowerArray("assets/towersLevel1.txt"); Path* thePath = getPathArray("assets/path.txt"); UnitListHeader * unitList = malloc(sizeof(UnitListHeader)); int moneyAmount = STARTINGMONEY; initializeList(unitList); drawUnitTypes(unitList); int theScore = 0; drawTowers(theTowerList); //go to entering unit purchases (gives control back to user) selectUnitsInterface(thePath,unitList,&moneyAmount,theTowerList,&theScore); //get lowest score of highscores ScoreHead scores; scores.size = 0; scores.first = NULL; ScoreNode * currScore = NULL; readScores(&scores); currScore = scores.first; int numScores = 1; int highestScore = 0; while ((currScore->next != NULL) && (numScores < 9)) { numScores += 1; currScore = currScore->next; } highestScore = -1; if (numScores > 8 && currScore != NULL) { highestScore = currScore->score; } char * enterName; if (theScore > highestScore) { enterName = drawScore(theScore,1); if (enterName != NULL) { addScore(&scores, enterName, theScore); writeScores(&scores); } } else { drawScore(theScore,0); } if (scores.size > 0) destroyScores(&scores); }