int main() { setupBoard(); titleScreen(); mainRunLoop(); gameOverScreen(); }
int main(int argc, char* argv[]) #endif // BOT_ACTIVE { // test fillDistance pAI = CMyAI::getInstance(); #ifdef OPENCV setupImage(); #endif // OPENCV int seed = (int)time(NULL); std::srand(seed); TBlock board[BOARD_SIZE]; clock_t tStart = clock(); vector<TPos> points = { CC(5, 0), CC(5, 1), CC(5, 2), CC(6, 3), CC(6, 4), CC(7, 5), CC(6, 6), CC(7, 6), CC(7, 7), CC(8, 7), CC(9, 0), CC(9, 2), CC(9, 8), CC(9, 9), CC(10, 10), }; for (int i = 0; i < 10000; i++){ TPos p1(CC(6, 0)), p2(120); setupBoard(board, NULL, p1, p2); // testConnectedComponents(board, p1); // cout << CHeuristicBase::getEstimatedLengthOfTheLongestPath(board, p1); testFindPath(board, p1); // testRateBoard(board, p1, p2); // testEstimateLongestLength(board, p1); // testSearchEngine(board, p1, p2); // testGetArticulationPoints(board, p1, p2); } cout << "lowwer_extract " << lowwer_extract << endl; printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC); system("pause"); return 0; }
Window::Window(const int width, const int height, const int cellSize) { if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { printError(); } // Board needs to be setup before the window because I need the size of the board setupBoard(width, height, cellSize); window = SDL_CreateWindow("Game of life", 0, 0, boardBackground.w + 14, boardBackground.h + 57, SDL_WINDOW_SHOWN); if (window == NULL) { printError(); } renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (renderer == NULL) { printError(); } // Load UI image textures[UI] = IMG_LoadTexture(renderer, "../../../../../../../../dev/CPP/Life/StaticUI.png"); dstRects[UI] = {(boardBackground.w / 2) - (463 / 2), boardBackground.y + boardBackground.h + 10, 463, 26}; // Setup UI clip rects for (int i = 0; i < 4; i++) { UIClipRects.push_back(SDL_Rect()); UIClipRects[i].x = dstRects[UI].x + i * 118; UIClipRects[i].y = dstRects[UI].y; UIClipRects[i].w = 110; UIClipRects[i].h = 26; } }
int main(int argc, char** argv){ setupVideoWriting(); int width = image_width; int height = image_height; setupBoard(width, height, argc, argv); setupScreen(width, height); initShaders(); loadTexture(); setupTexture(); setupBuffers(); glutDisplayFunc(&drawScene); glutIdleFunc(&replay); glutMainLoop(); cvReleaseVideoWriter(&writer); return 0; }
void announceWinner() { //announces the winner if( turn == 1){ textout_ex( screen, font, "X Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); }else { textout_ex( screen, font, "Y Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); } void checkWin() { //checks for a winner } void drawXO() { //draws in the X and O } void moveBox() { //takes input } int main() { //now we actually build it allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); xSprite = load_bitmap("x.bmp", NULL); oSprite = load_bitmap("o.bmp", NULL); setupBoard(); while(!key[KEY_ESC]){ moveBox(); } destroy_bitmap(xSprite); destroy_bitmap(oSprite); return 0; }
int main(int argc, char** argv) { char b[BS]; int r, c; Communicator comm(argc, argv); int validHMoves[BS]; int validCMoves[BS]; int scoreHMoves[BS]; validCMoves[0] = 0; char buf[100]; ofstream outputFile; if (comm.rank == 0) { sprintf(buf,"\n\nP = %d", comm.nprocs); logIt(buf); int hMove = 0; int depth = atoi(argv[1]); srand((int) time(NULL)); setupBoard(b); do { validMoves(b,H,validHMoves,scoreHMoves); displayBoard(b); if (validHMoves[0]) { hMove = moveHuman(b,validHMoves); // to get a manually entered move if (hMove == 0) { break; } cout << "After your move the board is:\n"; displayBoard(b,C); } else { cout << "You Don't have any valid moves.\n"; } cout << "Computer is plotting your demise.\n"; int best = findBestMove(comm, b, C, depth); if (best != 0) { squareScore(b,best,C,true); aiToBs(best, r, c); cout << "Computer moves to [" << r << "," << c << "]\n"; } else { cout << "Computer does not have a valid move\n"; } } while ((validCMoves[0] || validHMoves[0]) && (hMove != 0)); WorkRequest* wReq = new WorkRequest(); wReq->b[0] = 'T'; for(int i = 1; i < comm.nprocs; i++) comm.send(i, (char *) wReq, 1, TAG_DO_THIS_WORK); cout << "\n\nGame over\n\n"; } else { // not comm.rank 0 worker(comm); } comm.finalize(); return (EXIT_SUCCESS); }
void Board::resetBoard(QSize dim) { clearBoard(); setupBoard(dim); }
Board::Board(QWidget *parent) : QWidget(parent) { setupBoard(QSize(2,2)); //default size }
TicTac::TicTac() :board(0) { setGameMode(); setupBoard(); }