Game::Game() : screen( sdl::set_video( SCREEN_WIDTH , SCREEN_HEIGHT , SCREEN_BPP , SDL_HWSURFACE | SDL_DOUBLEBUF ) ) , player( PADDLE_X_DISP ) , computer( SCREEN_WIDTH - PADDLE_X_DISP - PADDLE_WIDTH ), player_score( 0 ) , ai_score( 0 ) { SDL_WM_SetCaption( "The Pong Project" , NULL ); SDL_ShowCursor( 0 ); sdl::open_audio(); background.load( "background.png" ); text.load( "vera.ttf" , 24 ); text.set_color( sdl::Color( 0 , 255 , 0 ) ); blip_sound = sound_man.load_sound( "sounds/blip.wav" ); // the sound made when the paddle touches the ball lose_sound = sound_man.load_sound( "sounds/lose_point.wav" ); // the sound made when the ball goes out of the play area player.load(); computer.load(); ball.load(); welcome_screen(); play(); }
int main() { fb_info fb_inf; pid_t pid; pid_t mp3_id; if (init_frambuffer(&fb_inf) < 0){ fprintf(stderr, "Error initial framebuffer\n"); return 1; } filename_list(); //jpeg file txt pid = fork(); if (pid == 0) start_mp3(fb_inf); mp3_id = pid; disp_background("../jpeg/welcome/background.jpg", fb_inf); disp_constellation("../jpeg/welcome/constellation.jpg", fb_inf); welcome_screen(fb_inf); if (mouse_operate(fb_inf, &mp3_id)) { kill(mp3_id, SIGKILL); wait(NULL); } exit_screen(fb_inf); munmap(fb_inf.fbmem, fb_inf.w * fb_inf.h * fb_inf.bpp / 8); return 0; }
int main(int argc, char **argv) { setlocale(LC_ALL,""); /* what to do if we get a control-c */ signal(SIGINT,quit); programInits(&properties); props_defaults_options(&properties,1); props_defaults_futures(&future_properties,1); #if defined(HAVE_GETOPT_H) && defined(HAVE_GETTIMEOFDAY) process_arguments(argc, argv, &properties.data.debug); #endif initscr(); keypad(stdscr,TRUE); welcome_screen(); for(;;) { /* get initial user inputs */ if( get_user_inputs(&properties,&future_properties) == -1 ) continue; curses_process(&properties,&future_properties); } /* for(;;) */ }
/* MAIN FUNCTION */ int main(){ initialize_game(); load_images(); play_menu_sound(); set_initial_values(); welcome_screen(); return 0; }END_OF_MAIN()
int main(int argc, char *argv[]) { init_shell(); // Initalizes the shell welcome_screen(); // Displays the welcome screen setenv("shell", getcwd(currentDirectory, 1024), 1); command_parser(); return (0); }
void Rsh::run() { PipeMgt mgt = PipeMgt(); welcome_screen(); shell_prompt(); do{ TOKEN token = scanner.lex(); Action action = actionTable[token]; (this->*action)(); }while(true); }
int main() { welcome_screen(); kwrite(COLOR_WHITE, " ", 0); printk(COLOR_WHITE, "\n$> "); register_listen_rpcs(); for (;;); return (0); }
void Rsh::run() { if(!finish) { pthread_t* thread; pthread_create(thread, NULL, prun, (void*)this); welcome_screen(); shell_prompt(); char buf[64]; sprintf(buf, "Userid:%d --- Username:%s from:%s entered\n", shareinfo->get_id(), shareinfo->get_name(), shareinfo->get_ip()); std::string message = buf; //broadcast(message.c_str(), message.size()); do{ TOKEN token = scanner->lex(); switch(token) { case NEWLINE: onNewline(); break; case SLASH: onSlash(); break; case TRANIN: onTranIn(); break; case TRANOUT: onTranOut(); break; case WORD: onWord(); break; case PIPI: onPipe(); break; case ERROR: finish = true; break; } }while(!finish); sprintf(buf, "*** Userid:%d --- Username:%s leaved ***\n", shareinfo->get_id(), shareinfo->get_name()); message = buf; //sem_wait(sem_exit); // broadcast(message.c_str(), message.size()); //sem_post(sem_exit); } }
/*-----------------------------------------------------------------*/ int main () { int i=0; clrscr(); do { welcome_screen(); i++; if(i==10) { clrscr(); error(-1); } } while(i<10); getch(); return 0; }
void Dodger::update() { switch (game_state) { case welcome: welcome_screen(); break; case playing: play(); break; case password: password_screen(); break; case dying: dead(); break; case game_over: game_over_screen(); break; case well_done: well_done_screen(); break; } }
int main(int argc, char * argv[]) { // Controllo sul passaggio effettivo del numero di navicelle richieste if (argc < 2) { printf("Fornire come primo parametro il numero M di navicelle nemiche.\n"); exit(1); } std_args shared; // Informazioni convidise dai thread shared.fiends_no = atoi(argv[1]); // Controlla se il parametro fornito non è maggiore del numero di navicelle massimo per una visualizzazione ottimale if (shared.fiends_no > MAX_FIENDS) shared.fiends_no = MAX_FIENDS; // Riempimento dell'array statico contenente i disegni degli oggetti strcpy(pics[player_p], PLAYER_PIC); strcpy(pics[rocket_r_p], ROCKET_RIGHT_PIC); strcpy(pics[rocket_l_p], ROCKET_LEFT_PIC); strcpy(pics[rocket_s_p], ROCKET_SIDE_PIC); strcpy(pics[bomb_p], BOMB_PIC); strcpy(pics[fiend1_p], FIEND1_PIC); strcpy(pics[fiend2_p], FIEND2_PIC); strcpy(pics[fiend3_p], FIEND3_PIC); initscr(); // Inizializza schermo noecho(); // Previene la stampa dei caratteri premuti curs_set(0); // Nasconde cursore welcome_screen(); // Schermata di avvio srand(time(NULL)); // Nella schermata di gioco, stampa in alto a sinistra il nome del gioco mvprintw(0, 0, "CALCULUS INVADERS"); int i, j, y; shared.buffer_size = BUFFER_SIZE; // Si usa di un buffer di puntatori ad oggetti object * buffer[shared.buffer_size]; shared.buffer = buffer; // Semafori e loro allocazione sem_t available, present, mutex; sem_init (&present, 0, 0); sem_init (&available, 0, shared.buffer_size); sem_init (&mutex, 0, 1); shared.available = &available; shared.present = &present; shared.mutex = &mutex; // Flag per game over sig_atomic_t game_over = false; shared.game_over = &game_over; // Flag per attesa thread in esecuzione a fine gioco sig_atomic_t running_threads = 0; shared.running_threads = &running_threads; int in = 0; shared.in = ∈ pthread_t tmp; int game_points = 0; // Punti _Bool win; // Creazione thread giocatore pthread_create(&tmp, NULL, &player_task, &shared); // Genera fiends_no thread per ogni navicella nemica iniziale for (i = 0; i < shared.fiends_no; i++) { fiend_args * orders = malloc(sizeof(fiend_args)); if (!orders) { endwin(); perror("Couldn't malloc"); exit(1); } orders->shared = &shared; orders->fiend_id = i; orders->y = ((i / MAX_FIENDS_PER_ROW) * (TALLEST + VSPACE_BETWEEN_FIENDS)); orders->level = lv1; pthread_create(&tmp, NULL, &fiend_task, orders); } // Lancia il gestore di disegno e di collisioni win = manager(&shared, MAXY - GAME_STATUS_ROWS, MAXX, &game_points); game_over_screen(game_points, win); // Schermata fine gioco // Attesa (senza spinlock) della terminazione di tutti gli altri thread while (running_threads > 0) usleep(50000); // Deallocazione semafori sem_destroy(&present); sem_destroy(&available); sem_destroy(&mutex); endwin(); // Ripristina schermo return 0; }
int main (void) { int game = 0, money = 1000; system("Color 24");//Color: Background: Green, Text: Red welcome_screen(); do{//while player1 has money /* initialize suit array */ const char *suit[4] = {"Hearts", "Diamonds", "Clubs", "Spades"}; const char *suits[4] = {"\3", "\4", "\5", "\6"}; /* initialize face array */ const char *face[13] = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; char faces[13] = {"A234567890JQK"}; char raise = '\0' , ten = ' '; Card hand1[5]; Card hand2[5]; /* initalize deck array */ int deck[4][13] = {0}; int is_pair = 0, is_two_pair = 0, is_three = 0, is_four = 0, is_full = 0, is_flush = 0, is_straight = 0, score1 = 0, score2 = 0, x = 0, y = 0, i = 0, j = 0, count = 10, count1 = 0, count2 = 0, bet = 0, bet2 = 0; srand ((unsigned) time (NULL)); /* see random-number generator */ hand1[0].is_active = 1; hand1[1].is_active = 1; hand1[2].is_active = 1; hand1[3].is_active = 1; hand1[4].is_active = 1; hand2[0].is_active = 1; hand2[1].is_active = 1; hand2[2].is_active = 1; hand2[3].is_active = 1; hand2[4].is_active = 1; //0 = Black 8 = Gray //1 = Blue 9 = Light Blue //2 = Green a = Light Green //3 = Aqua b = Light Aqua //4 = Red c = Light Red //5 = Purple d = Light Purple //6 = Yellow e = Light Yellow //7 = White f = Bright White do{//Places blind bet printf("Money: $%d\n", money); printf("Place your blind: \n"); scanf("%d", &bet); if(bet > money) { printf("You don't have that much money!\n"); system("Pause"); system("cls"); } }while(bet > money); shuffle (deck); deal(deck, face, faces, suit, suits, hand1, hand2, count, count1, count2); //Initial Deal printf("\nMoney: $%d", money - bet); bet = raise_bet(money, bet);//First round of betting - Raise before 'draw' count = select_cards(hand1, count);//how many cards to redeal count1 = count - 10; //deal(deck, face, suit, hand1, hand2, count); //Simulates Dealer, decides which cards the dealer keeps sort_hand(hand2); is_pair = pair(hand2, face, 0); is_two_pair = two_pair(hand2, face, 0); is_three = three_of_a_kind(hand2, face, 0); is_four = four_of_a_kind(hand2, face, 0); is_full = full_house(hand2, face, 0); is_flush = flush(hand2, face, 0); is_straight = straight(hand2, face, 0); for(i = 0; i < 5; i++)//Counts how many cards to redeal to dealer { if(hand2[i].is_active == 1) { count++; count2++; } } //printf("\n%d %d %d %d %d\n", hand1[0].is_active, hand1[1].is_active, hand1[2].is_active, hand1[3].is_active, hand1[4].is_active); //printf("\n%d %d %d %d %d\n", hand2[0].is_active, hand2[1].is_active, hand2[2].is_active, hand2[3].is_active, hand2[4].is_active); system("Pause"); system("cls"); printf("Money: $%d\n", money - bet); printf("Pot: $%d", 2*bet); deal(deck, face, faces, suit, suits, hand1, hand2, count, count1, count2); //Draw and Redeal sort_hand(hand1); sort_hand(hand2); printf("\nHand#1\n"); for(y = 0; y < 5; y++)//Prints hand1 { if(hand1[y].face == 9)//Prints '10' instead of just '0' { ten = '1'; } if(hand1[y].face != 9) { ten = ' '; } printf("Card#%d %5s of %-8s %c%c%s\n", y + 1, face[hand1[y].face], suit[hand1[y].suit], ten, faces[hand1[y].face], suits[hand1[y].suit]); } //money = money - bet; bet = raise_bet(money, bet);//Second round of betting - before 'showdown' money = money - bet; printf("Money: $%d\n", money); /*SHOWDOWN!!!*/ printf("Pot: $%d\n", 2*bet); system("Pause"); system("cls"); printf("\nHand#1\n"); for(y = 0; y < 5; y++) { if(hand1[y].face == 9) { ten = '1'; } if(hand1[y].face != 9) { ten = ' '; } printf("Card#%d %5s of %-8s %c%c%s\n", y + 1, face[hand1[y].face], suit[hand1[y].suit], ten, faces[hand1[y].face], suits[hand1[y].suit]); } printf("\nHand#2\n"); for(j = 0; j < 5; j++) { if(hand2[j].face == 9) { ten = '1'; } if(hand2[j].face != 9) { ten = ' '; } printf("Card#%d %5s of %-8s %c%c%s\n", j + 1, face[hand2[j].face], suit[hand2[j].suit], ten, faces[hand2[j].face], suits[hand2[j].suit]); } hand1[0].high_card = hand1[4].face;//Starts by assuming 'high card' is hand[4] hand2[0].high_card = hand2[4].face;//'high card' is changed if there is a pair, two pair, etc. printf("\nPlayer #1\t"); //Evaluates Player1's hand is_pair = pair(hand1, face, 1); is_two_pair = two_pair(hand1, face, 1); is_three = three_of_a_kind(hand1, face, 1); is_four = four_of_a_kind(hand1, face, 1); is_full = full_house(hand1, face, 1); is_flush = flush(hand1, face, 1); is_straight = straight(hand1, face, 1); //printf("\nHand #1:\nPair: %d\t\tTwo Pair: %d\tThree: %d\tFour: %d\t\tFlush: %d\tStraight: %d\n", is_pair, is_two_pair, is_three, is_four, is_flush, is_straight); score1 = calc_score(is_pair, is_two_pair, is_three, is_four, is_flush, is_straight, face, hand1); printf("\nPlayer#2\t");//Evaluates Dealer's hand is_pair = pair(hand2, face, 1); is_two_pair = two_pair(hand2, face, 1); is_three = three_of_a_kind(hand2, face, 1); is_four = four_of_a_kind(hand2, face, 1); is_full = full_house(hand2, face, 1); is_flush = flush(hand2, face, 1); is_straight = straight(hand2, face, 1); //printf("\nHand #2:\nPair: %d\t\tTwo Pair: %d\tThree: %d\tFour: %d\t\tFlush: %d\tStraight: %d\n", is_pair, is_two_pair, is_three, is_four, is_flush, is_straight); score2 = calc_score(is_pair, is_two_pair, is_three, is_four, is_flush, is_straight, face, hand2); if(score1 == score2)//If both hands have pair, two pair, etc. { score1 = hand1[0].high_card;//Note: If a hand has a pair, the highcard is the face value of the pair score2 = hand2[0].high_card; } x = 4; do{ if(score1 == score2)//If both hands have the same high card { score1 = hand1[x].face; score2 = hand2[x].face; if(score1 != score2) { printf("\nPlayer #1 New High Card: %5s\n", face[hand1[x].face]); printf("Player #2 New High Card: %5s\n", face[hand2[x].face]); } } x--; }while((x >= 0)&&(score1 == score2)); //printf("\n\nPlayer1 Score: %d\tPlayer2 Score: %d", score1, score2); if(score1 > score2) { printf("\n\nPlayer1 Wins: $%d\n", 2*bet); money = money + 2*bet; } if(score1 < score2) { printf("\nPlayer2 Wins: $%d\n", 2*bet); //money = money - 2*bet; } //printf("Money: $%d\n", money); system("Pause"); system("cls"); }while(money > 0); if(money <= 0) { printf("Game Over. . .\n"); } return 0; }
/*===================================== * main *===================================*/ int main(void){ reset_data_structs(); clearscr(); welcome_screen(); show_menu(); int check=0; if(G_current_game.game_mode==pvp){ //pvp mode if(G_current_game.player_first==1){ // who first start game, first move cmp.current_player_move=G_players[0]; cmp.previous_player_move=G_players[1]; } else{ cmp.current_player_move=G_players[1]; cmp.previous_player_move=G_players[0]; } // while(1){ // in while add finish_game... while( !finish_game_wrapper(pos) ){ //system("cls"); clearscr(); board_print_raw(); do{ // printf("%s your move! (all your moves: %d)\n",cmp.current_player_move.name,cmp.current_player_move.moves); read_move(&pos); check = function_validate_move(pos); }while(check != 0); cmp.current_player_move.moves+=1; cmp.tmp=cmp.current_player_move; //swap current player cmp.current_player_move=cmp.previous_player_move; // cmp.previous_player_move=cmp.tmp; // }//end while(1) cmp.tmp=cmp.current_player_move; //swap current player cmp.current_player_move=cmp.previous_player_move; // cmp.previous_player_move=cmp.tmp; board_print_raw(); printf("%s wins! (In %d moves!)\n",cmp.current_player_move.name,cmp.current_player_move.moves); }// end pvp mode if(G_current_game.game_mode==pvc){ //pvc mode if(G_current_game.player_first==1){ // who first start game, first move cmp.current_player_move=G_players[0]; cmp.previous_player_move=G_players[1];// G_players[1] is cpu player } else{ cmp.current_player_move=G_players[1]; cmp.previous_player_move=G_players[0]; } while(1){ //system("cls"); clearscr(); board_print_raw(); do{ printf("%s your move! (all your moves: %d)\n",cmp.current_player_move.name,cmp.current_player_move.moves); read_move(&pos); check = function_validate_move(pos); }while(check != 0); cmp.current_player_move.moves+=1; cmp.tmp=cmp.current_player_move; //swap current player cmp.current_player_move=cmp.previous_player_move; // cmp.previous_player_move=cmp.tmp; // }//end while(1) }// end pvc return 0; }
int main(int argc, char const *argv[]) { welcome_screen(); start_menu(); return 0; }
void main() { int total_seats = 84 , total_seats_to_be_booked , display_time , total_seats_booked = 0; //int gd = DETECT , gm; //initgraph(&gd,&gm,"c:\\turboc3\\bgi"); clrscr(); welcome_screen(); closegraph(); clrscr(); int gd = DETECT , gm; initgraph(&gd,&gm,"c:\\turboc3\\bgi"); setbkcolor(GREEN); for(A=0;A<=79;A++) cout<<g; cout << "\n\t\t\tTotal number of seats available is " << total_seats << endl; for(A=0;A<=79;A++) cout<<g; cout<<endl; cout << "\nEnter number of seats you want to book " << endl; cin>>total_seats_to_be_booked; exit_program(total_seats_to_be_booked); //cout << "\nEnter total number of display time " << endl; //cin >> display_time; total_seats_booked += total_seats_to_be_booked; //display_time = display_time * 1000; //cin >> total_seats_to_be_booked; //delay(3000); getch(); closegraph(); clrscr(); int graphics_driver = DETECT , graphics_mode; initgraph(&graphics_driver,&graphics_mode,"c:\\turboc3\\bgi"); setcolor(BLUE); setbkcolor(RED); setfillstyle(SOLID_FILL,BLUE); /*Draw seats of a theatre as square boxes */ char buff[1]; double c = 0; for(int j = 10 ; j < getmaxy()-50 ; j+=60) { for(int i = 10 ; i < getmaxx()-50 ; i+=50) { c++; gcvt(c ,3 , buff); // memset(buff , c , 0); setfillstyle(SOLID_FILL, BLUE); //textbackground(RED); bar(i , j , i + 35 , j + 35); rectangle(i , j , i + 35 , j + 35); setcolor(15); moveto( i+16 , j+16 ); // cout << c; outtext(buff); // print_seat_number(c , i , j); } } //delay(display_time); getch(); closegraph(); clrscr(); int seat_number; int seats[84]; memset(seats , 0 , 85); //gd = DETECT , gm; initgraph(&gd,&gm,"c:\\turboc3\\bgi"); setbkcolor(BLUE); cout << "Enter seat numbers you want to book " << endl; for(int i = 0 ; i < total_seats_to_be_booked ; i++) { cout << "Seat number " << i + 1 << endl; cin >> seat_number; seats[seat_number] = 1; } getch(); clrscr(); gd = DETECT; initgraph(&gd , &gm , "c:\\turboc3\\bgi"); int k = 0; setcolor(BLUE); setbkcolor(RED); for(int p = 10 ; p <= getmaxy()-50 ; p+=60) { for(int i = 10 ; i <= getmaxx()-50 ; i+=50) { k++; gcvt(k ,3 , buff); if(seats[k] == 1) { setfillstyle(SOLID_FILL,GREEN); } else { setfillstyle(SOLID_FILL, BLUE); } bar(i , p , i + 35 , p + 35); rectangle(i , p , i + 35 , p + 35); setcolor(15); moveto( i+16 , p+16 ); outtext(buff); } } //delay(display_time); getch(); closegraph(); }
int main (int argc, char **argv) { // this increases the size on windows dox boxes setup_console (); const time_t proc_start = time (NULL); // hashcat main context hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) malloc (sizeof (hashcat_ctx_t)); const int rc_hashcat_init = hashcat_init (hashcat_ctx, event); if (rc_hashcat_init == -1) return -1; // install and shared folder need to be set to recognize "make install" use char *install_folder = NULL; char *shared_folder = NULL; #if defined (INSTALL_FOLDER) install_folder = INSTALL_FOLDER; #endif #if defined (SHARED_FOLDER) shared_folder = SHARED_FOLDER; #endif // initialize the user options with some defaults (you can override them later) const int rc_options_init = user_options_init (hashcat_ctx); if (rc_options_init == -1) return -1; // parse commandline parameters and check them const int rc_options_getopt = user_options_getopt (hashcat_ctx, argc, argv); if (rc_options_getopt == -1) return -1; const int rc_options_sanity = user_options_sanity (hashcat_ctx); if (rc_options_sanity == -1) return -1; // some early exits user_options_t *user_options = hashcat_ctx->user_options; if (user_options->version == true) { printf ("%s\n", VERSION_TAG); return 0; } if (user_options->usage == true) { usage_big_print (PROGNAME); return 0; } // init a hashcat session; this initializes opencl devices, hwmon, etc welcome_screen (hashcat_ctx, VERSION_TAG); const int rc_session_init = hashcat_session_init (hashcat_ctx, install_folder, shared_folder, argc, argv, COMPTIME); int rc_final = -1; if (rc_session_init == 0) { if (user_options->opencl_info == true) { // if this is just opencl_info, no need to execute some real cracking session opencl_info (hashcat_ctx); rc_final = 0; } else { // now execute hashcat opencl_info_compact (hashcat_ctx); rc_final = hashcat_session_execute (hashcat_ctx); } } // finish the hashcat session, this shuts down opencl devices, hwmon, etc hashcat_session_destroy (hashcat_ctx); // finished with hashcat, clean up const time_t proc_stop = time (NULL); goodbye_screen (hashcat_ctx, proc_start, proc_stop); hashcat_destroy (hashcat_ctx); free (hashcat_ctx); return rc_final; }
int main (void) { mInit(); mBusInit(); mUSBInit(); mWhiteOFF; mRedOFF; mGreenON; for (uint8_t i = 0; i < COMMAND_SIZE + 1; i++) command_buffer[i] = '\0'; // initialize command buffer bool sd_initialized = false; reconnect: while (bDeviceState != CONFIGURED); sd_initialized = m_sd_init(); mWaitms (1000); welcome_screen(); if (!sd_initialized) printf ("ERROR: Could not initialize microSD card\r\n"); printf ("> "); for (;;) { if (bDeviceState != CONFIGURED) { goto reconnect; } const int rchar = getchar(); if (rchar < 0) continue; const char c = (char)rchar; if (c == '\n' || c == '\r') { // received 'enter' printf ("\r\n"); if (sd_initialized) { process_command(); if (fatal_error) sd_initialized = false; } else { if (m_sd_init()) { fatal_error = false; sd_initialized = true; process_command(); if (fatal_error) sd_initialized = false; } else { printf ("ERROR: Could not initialize microSD card: error code %d\r\n", m_sd_error_code); } } command_ptr = command_buffer; // reset the current command length to 0 printf ("> "); } else if (c == 8 || c == 127) { // received backspace (or delete) if (command_ptr > command_buffer) { command_ptr--; putchar (27); // escape printf ("[1D"); // move the cursor back 1 character putchar (27); printf ("[K"); // erase from the cursor position to the end of the line } } else if (c >= 32 && c < 127) { // received a printable character or escape if (command_ptr < command_buffer + COMMAND_SIZE) { *command_ptr = c; command_ptr++; putchar (c); } else { // out of command space: send bell putchar (7); } } } return 0; }