Exemple #1
0
int main(int argc, char* argv[])
{
int argi;
char* dumpFile = NULL;
unsigned flags = 0;
char* database, *accPrefix;
struct gbIndex* index;
struct stepInfo runInfo;

gbVerbInit(0);
optionInit(&argc, argv, optionSpecs);
if (argc < 2)
    usage();
if (optionExists("processed"))
    flags |= DO_PROCESSED;
if (optionExists("aligned"))
    flags |= DO_PROCESSED|DO_ALIGNED;
if (optionExists("mrna"))
    flags |= DO_MRNA;
if (optionExists("est"))
    flags |= DO_EST;

dumpFile = optionVal("dump", NULL);
database = optionVal("db", NULL);
accPrefix = optionVal("accPrefix", NULL);

if ((flags & DO_ALIGNED) && (database == NULL))
    errAbort("must specify -db with -aligned");
if (!(flags & (DO_MRNA|DO_EST)))
    errAbort("must specify at least one of -mrna or -est");
if (!(flags & (DO_ALIGNED|DO_PROCESSED)))
    errAbort("must specify at least one of -processed or -aligned");
            
index = gbIndexNew(database, NULL);
runInfo = beginStep(index, NULL, "loading index files");

for (argi = 1; argi < argc; argi++)
    testRelLoad(index, gbIndexMustFindRelease(index, argv[argi]),
                database, flags, accPrefix);

if (dumpFile != NULL)
    {
    FILE* dumpOut = mustOpen(dumpFile, "w");
    gbIndexDump(index, dumpOut);
    if (fclose(dumpOut) != 0)
        errnoAbort("close of dumpfile");
    }
endStep(index, &runInfo);
gbIndexFree(&index);
return 0;
}
Exemple #2
0
static void testLoad(struct gbSelect* select, unsigned flags)
/* do load testing of part of a release */
{
char desc[512];
struct stepInfo info;
select->type = (flags & DO_MRNA) ? GB_MRNA : GB_EST;
safef(desc, sizeof(desc), "%s %s",
      ((flags & DO_PROCESSED) ? "processed" : "aligned"),
      gbSelectDesc(select));
info = beginStep(select->release->index, select->release, desc);
if (flags & DO_PROCESSED)
    gbReleaseLoadProcessed(select);
else
    {
    select->orgCats = GB_NATIVE|GB_XENO;
    gbReleaseLoadAligned(select);
    }
endStep(select->release->index, &info);
select->type = 0;
}
Exemple #3
0
GameManager::GameManager(
        Language *language,
        int width,
        int height,
        int playersNumber,
        QString level,
        QObject *parent) :
    width(width),
    height(height),
    QObject(parent),
    playersNumber(playersNumber),
    bot{language, width, height, this}
{
    board.initBoard(width, height);

    wc.connectToDictionary(&dict);
    wc.connectToBoard(&board);
    dict.setUpConnection(&wc);
    board.setUpConnection(&wc);

    firstWord = dict.getFirstWord(width);

    if (playersNumber == 2) {
        player1.connectToBoard(&board);
        player1.connectToManager(this);
        player2.connectToBoard(&board);
        player2.connectToManager(this);
    }
    else {
        player1.connectToBoard(&board);
        player1.connectToManager(this);
        dict.connectToBot(&bot);
        if (level == "EASY") {
            bot.setLevel(EASY);
        } else if (level == "MEDIUM") {
            bot.setLevel(MEDIUM);
        } else if (level == "HARD") {
            bot.setLevel(HARD);
        } else if (level == "HARDEST") {
            bot.setLevel(HARDEST);
        }
        bot.connectToBoard(&board);
        bot.connectToManager(this);
        bot.connectToDictionary(&dict);
    }


    currentPlayer = &player1;
    currentID = FIRST_PLAYER;
    numberOfSpareCells = width*(height - 1);
    if (playersNumber == 2) {
        board.connectToPlayers(&player1, &player2);
        board.setFirstPlayer(FIRST_PLAYER);
    } else {
        board.connectToPlayers(&player1, &bot);
        board.setFirstPlayer(FIRST_PLAYER);
    }
    connect(this, SIGNAL(askForCells()), &board, SLOT(getNumberOfCells()));
    connect(this, SIGNAL(startMoveFirst()), &player1, SLOT(beginStep()));
    if (playersNumber == 2) {
        connect(this, SIGNAL(startMoveSecond()), &player2, SLOT(beginStep()));
    } else {
        connect(this, SIGNAL(startMoveSecond()), &bot, SLOT(beginStep()));
    }
    board.setFirstWord(firstWord);
    //connect(this, SIGNAL(showBoard()), &board, SLOT(showBoardToManager()));
}