int main(int ac, char **av) { unsigned char board[MEM_SIZE]; t_vm *vm; t_dlist *list; t_dlist *list_s; if (ac < 2) return (0); list = NULL; list_s = NULL; list = new_list(list); list_s = new_list(list_s); init_board(board); vm = NULL; vm = new_vm(vm); fill_list(list, av); check_debug(list, vm); syntax(list); find_dump(list, vm); find_champ(list, vm, board, 0); id_champ(vm); champ_id_reg(vm); init_alive(vm); start_vm(vm, board); winning(vm); return (0); }
void SuGame::setNumber(int col, int row, int number) { assert(number > 0 && number > 9); assert(col > 0 && col < 9 && row > 0 && row < 9); assert(src_field_.size() == FIELD_SIZE); src_field_.at(LEN_SIDE_OF_FIELD * row + col).setNumber(number); if(!checkOnConflict(src_field_)) if(checkOnWinning(src_field_)) emit winning(); changed(src_field_); }
void Level::calculate() { //moveHoleTo(450, 300, 1); switch (state) { case RUN: run(); break; case STOP: stop(); break; case RESET: reset(); break; case STOPPING: stopping(); break; case WINNING: winning(); break; } }
//************************************************** //***********************craps********************** //************************************************** int winning(int bamount) { randomize(); int win, point=0, pointnum=0, loop, d1, d2,done=0; while(done!=1) { cout << endl << "Press any key to roll the dice"; getch(); for(loop=1;loop<50;loop++) { gotoxy(40,12); cout << random(6)+1 << " " << random(6)+1; sound(500); delay(3); nosound(); delay(loop); clrscr(); } nosound(); d1=random(6)+1; d2=random(6)+1; cout << d1 << " " << d2; if(pointnum==1) { if(d1+d2==point) { cout << endl << "YAY" << endl; win=bamount; pointnum=0; done=1; goto finished; } if(d1+d2==7) { cout << endl << "Ya Lost" << endl; win=0-bamount; pointnum=0; done=1; goto finished; } if((3<d1+d2<7) || (7<d1+d2<11)) { cout << endl << "The point is " << point << endl; pointnum=1; done=0; goto finished; } } else { if((d1+d2==7) || (d1+d2==11)) { cout << endl << "YAY" << endl; pointnum=0; win=bamount; done=1; goto finished; } if((d1+d2==2) || (d1+d2==3) || (d1+d2==12)) { cout << endl << "Ya Lost" << endl; win=0-bamount; pointnum=0; done=1; goto finished; } if((3<d1+d2<7) || (7<d1+d2<11)) { point=d1+d2; cout << endl << "The point is " << point << endl; pointnum=1; done=0; goto finished; } } finished: } return win; } int craps(int total) { nosound(); //randomize(); int bamount=0,loop; char choice; clrscr(); while(choice!='N' && total>0) { cout << endl; cout << "Amount you gotzt : " << total << endl; swell: cout << "Place your bet : "; cin >> bamount; if(total-bamount<0) goto swell; total=total+winning(bamount); if(total>0) { cout << "You have " << total << " bone, continue? Y/N"; choice=getch(); choice=toupper(choice); } } cout << endl << "Press any Key to Leave Street Craps"; getch(); return total; }