// todo: also have an acceleration phase to allow for more precise, smaller
// movements
void SpecialMoveDetectionAspect::step(GameState & gs, float deltaT) {
	// store a list of recent moves and compare them with the possible patterns uha...

	// iterate all players
	for (PlayerData & pd : gs.getPlayers()) {

		util::initMap(m_inputs, pd.Id);
		if (util::initMap(m_reports, pd.Id)) {
			// has been newly added, initialize it !
			initReport(m_reports[pd.Id]);
		}

		PlayerInput & inp = m_inputs[pd.Id];
		PlayerReport & rep = m_reports[pd.Id];

		if (inp.m_inputRecord.size() != 0)
			inp.m_inputRecord.get(0).Duration += deltaT;

		while (true) {
			InputItem newIt = extractInputItem(gs, rep, pd.Id);

			if (!newIt.isDefined())
				break;

			//logging::Info() << "Got new input pattern: " << newIt;
			inp.m_inputRecord.push(newIt);
			analyzeRingBuffer(gs, inp.m_inputRecord, pd.Id);

			inp.m_activeInputItem = newIt;
		}
	}

}
Esempio n. 2
0
int main (int argc, char* argv[])
{
    MAXSIZE = 10;
    FILE *inFile, *outFile;
    inFile = fopen("stockData.dat", "r");
    if (!inFile)
    {
        printf("Please create a file named \"stockData.dat\"");
        exit(1);
    }
    outFile = fopen("stockRpt.dat", "w");
    if (!outFile)
    {
        printf("There was an error opening or creating \"stockRpt.dat\"");
        exit(1);
    }
    report *r;
    entry en;
    r = (report *)malloc(sizeof(report));
    r->e = malloc(sizeof(entry)*MAXSIZE);

    initReport(r);


    int x;
    while (!feof(inFile))
    {
        x = fscanf(inFile, "%d %d %f %f", &en.code, &en.shares, &en.prevcps, &en.currcps);
        if (x ==4)
        {
            addEntry(en, r);
        }
    }
    exportReport(*r, outFile);
    close(inFile);
    close(outFile);
    return 0;

}
Esempio n. 3
0
/**
* @brief Konstruktor
* @param fileName Dateiname
*/
FileReport::FileReport(string& fileName){
	initReport();
	parseFile(fileName);
}
Esempio n. 4
0
/**
* @brief Konstruktor
*/
FileReport::FileReport() {
	initReport();
}