unsigned int fuzzMove(unsigned int rseed){ for(int counter=0; counter < 1e4; counter++){ game* state=rndState(floor(36.*rand_r(&rseed)/(float)RAND_MAX), rand_r(&rseed), rand_r(&rseed)/(float)RAND_MAX); game* backUp=cpyGame(state); moveUp(state); if(tstBookkeeping(state)!=0) printf("moveUp bookkeeping error %i\n", tstBookkeeping(state)); if(tstScore(state, backUp)!=0) printf("move Up tstScore error %i\n", tstScore(state, backUp)); delGame(state); state=cpyGame(backUp); moveDown(state); if(tstBookkeeping(state)!=0) printf("moveDown bookkeeping error %i\n", tstBookkeeping(state)); if(tstScore(state, backUp)!=0) printf("moveDown tstScore error %i\n", tstScore(state, backUp)); delGame(state); state=cpyGame(backUp); moveLeft(state); if(tstBookkeeping(state)!=0) printf("moveLeft bookkeeping error %i\n", tstBookkeeping(state)); if(tstScore(state, backUp)!=0) printf("moveLeft tstScore error %i\n", tstScore(state, backUp)); delGame(state); state=cpyGame(backUp); moveRight(state); if(tstBookkeeping(state)!=0) printf("moveRight bookkeeping error %i\n", tstBookkeeping(state)); if(tstScore(state, backUp)!=0) printf("moveRight tstScore error %i\n", tstScore(state, backUp)); if(counter% 1000 == 0)printf("Loop %i passed. \n", counter); delGame(state); delGame(backUp); } return rseed; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //code to add non buttons to toolbar gameComboBox = new QComboBox(this); gameComboBox->setMinimumContentsLength(20); QLabel* spaceLabel = new QLabel(" "); QLabel* gameLabel = new QLabel("Game "); QAction* actionAddGame = new QAction(this); actionAddGame->setObjectName(QString("actionAddGame")); QIcon addIcon; addIcon.addFile(QString::fromUtf8(":/StreamControl/icons/fugue/bonus/icons-24/plus.png"), QSize(), QIcon::Normal, QIcon::Off); actionAddGame->setIcon(addIcon); QAction* actionDelGame = new QAction(this); actionDelGame->setObjectName(QString("actionDelGame")); QIcon delIcon; delIcon.addFile(QString::fromUtf8(":/StreamControl/icons/fugue/bonus/icons-24/minus.png"), QSize(), QIcon::Normal, QIcon::Off); actionDelGame->setIcon(delIcon); ui->toolBar->addWidget(spaceLabel); ui->toolBar->addWidget(gameLabel); ui->toolBar->addWidget(gameComboBox); ui->toolBar->addAction(actionAddGame); ui->toolBar->addAction(actionDelGame); connect(ui->actionConfig,SIGNAL( triggered() ),this,SLOT( openConfig() )); connect(ui->actionSave,SIGNAL( triggered() ),this,SLOT( saveData() )); connect(ui->resetButton,SIGNAL( clicked() ),this,SLOT( resetScores() )); connect(ui->swapButton,SIGNAL( clicked() ),this,SLOT( swapNames() )); connect(actionAddGame,SIGNAL( triggered() ),this,SLOT( addGame() )); connect(actionDelGame,SIGNAL( triggered() ),this,SLOT( delGame() )); cWindow = new ConfigWindow(this); }
void freeGame(Game * g) { delGame(g); remGame(g); }
void Menu::parseCommand(string cmd) { if (cmd == "help") showHelp(); else if (cmd == "add_player") addPlayer(); else if (cmd == "del_player") delPlayer(); else if (cmd == "modify_player") modifyPlayer(); else if (cmd == "show_player") showPlayer(); else if (cmd == "show_all_players") showAllPlayers(); else if (cmd == "search_player") searchPlayer(); else if (cmd == "add_game") addGame(); else if (cmd == "del_game") delGame(); else if (cmd == "modify_game") modifyGame(); else if (cmd == "set_game_res") setGameResult(); else if (cmd == "show_game") showGame(); else if (cmd == "show_all_games") showAllGames(); else if (cmd == "sort_games_by_date") sortGamesByDate(); else if (cmd == "sort_games_by_res") sortGamesByResult(); else if (cmd == "search_game_by_date") searchGameByDate(); else if (cmd == "search_game_by_opponent") searchGameByOpponent(); else if (cmd == "add_stadium") addStadium(); else if (cmd == "del_stadium") delStadium(); else if (cmd == "modify_stadium") modifyStadium(); else if (cmd == "show_stadium") showStadium(); else if (cmd == "show_all_stadiums") showAllStadiums(); else if (cmd == "search_stadium") searchStadium(); else if (cmd == "save_db") saveDbToFile(); else if (cmd == "load_db") loadDbFromFile(); else if (cmd == "") {} else if (cmd == "exit") exit(0); else error(ERR_INVALID_CMD); }