Esempio n. 1
0
int main()
{
    srand(time(NULL));
    Stat stat;
    char name[50];
    Snake snake;
    Pos food;
    ToGiveTread toGiveThread = {RIGHT, false, false};
    showLeaderboard();
    initStat(&stat);
    strcpy(name, stat.nickname);
    HANDLE hReadThread = CreateThread(NULL, 0, ReadThread, &toGiveThread, 0, NULL);
    strcpy(stat.nickname, name);
    initField();
    initSnake(&snake);
    initFood(&snake, &food, &stat);
    updateAds(&stat);
    do{
        Sleep(sleepTime(stat.level));
    }while(!updateSnake(&snake, &food, &toGiveThread, &stat));
    toGiveThread.toStopThread = true;
    clearScr();
    updateScore(&stat);
    CloseHandle(hReadThread);
    showLeaderboard();
    return 0;
}
Esempio n. 2
0
int initAllGameInfo(AllGameInfo *agi){
    /* 初始化游戏数据 */
    initClientId(agi->clientId);
    initCurPokerString(agi->playerCurPokerString);
    initPuttedPokerString(agi->playerPuttedPokerString);
    initScore(agi->playerScore);
    initPuttingPokerName(agi->playerPuttingPokerName);
    initStat(agi->playerStat);
    initErrorStr(agi->errorStr);
    return 0;
}