void fetch(int N,int current_queen, place *p) { //printf("Hi %d\n",current_queen); int i, j; if(current_queen==N)//that means we have been successful in forming a clash free array till the end. { ++top; for(i=0;i<N;i++) { get[i].x=p[i].row; get[i].y=p[i].col; } return; } //it it sure that the 0th queen will be placed in the 0th column, however its row number may vary for(i=0;i<N;i++)//i here indicates the row number { p[current_queen].row=i; p[current_queen].col=current_queen; int flag=0; for(j=0;j<current_queen;j++) if(clash(p,current_queen,j)) flag=1; if(flag==1) continue; else fetch(N, current_queen+1,p); } }
void right() //블럭을 오른쪽으로.. { x_b++; if(!clash()) { x_b--; } }
void left() //블럭을 왼쪽으로.. { x_b--; if(!clash()) { x_b++; } }
int main() { cout << endl; cout << "*****************" << endl; cout << "* BATTLE ROYALE *" << endl; cout << "*****************" << endl; char replay; do { queue<Creature*> team1; queue<Creature*> team2; int team_size = setTeamSize(); chooseTeam(team1, team_size, 1); chooseTeam(team2, team_size, 2); stack<Creature*> vanquished; while (!team1.empty() && !team2.empty()) { Creature *temp; int winner = clash(team1.front(), team2.front()); if (winner == 1) { temp = team1.front(); team1.pop(); team1.push(temp); temp = team2.front(); team2.pop(); vanquished.push(temp); } else { temp = team2.front(); team2.pop(); team2.push(temp); temp = team1.front(); team1.pop(); vanquished.push(temp); } } if (team1.empty()) { results(team2, vanquished); } else { results(team1, vanquished); } do { cout << "Play again? (y/n) "; cin >> replay; } while (replay != 'Y' && replay != 'y' && replay != 'N' && replay != 'n'); } while (replay != 'N' && replay != 'n'); return 0; }
void NameSema::insert(const Decl* decl) { assert(!decl->symbol().empty() && "symbol is empty"); auto symbol = decl->symbol(); if (!symbol.is_anonymous()) { if (auto other = clash(symbol)) { error(decl, "symbol '{}' already defined", symbol); error(other, "previous location here"); return; } assert(clash(symbol) == nullptr && "must not be found"); auto i = symbol2decl_.find(symbol); decl->shadows_ = i != symbol2decl_.end() ? i->second : nullptr; decl->depth_ = depth(); decl_stack_.push_back(decl); symbol2decl_[symbol] = decl; } }
void down() //블럭을 밑으로.. { int x,y; y_b++; if(!clash()) { y_b--; for(x=0; x<5; x++) { for(y=0; y<5; y++) { if(c_block[x][y]==1) { box[x_b+x][y_b+y]=1; } } } c_block_n=8; } }
void main() { int a; int x,y; in_box(); c_block_n=8; randomize(); num=random(7); while(1) { del_line(); if(c_block_n==8) { c_block_n=num; num=random(7); for(x=0; x<5; x++) { for(y=0; y<5; y++) { c_block[x][y]=block[c_block_n][x][y]; } } x_b=6/2; y_b=0; if(!clash()) { gotoxy(27,10); printf("GAME OVER"); gotoxy(23,11); printf("press ESC to exit"); gotoxy(22,12); printf("press 1 to new game"); while(1) { a=getch(); if(a==49) { system("cls"); gotoxy(25,10); printf("NEW GAME LOADING"); gotoxy(23,12); printf("press KEY to new game"); getch(); system("cls"); in_box(); break; } else if(a==27) { exit(1); } else { continue; } } } } Time++; out_box(); if(Time>=stage[score/50]) { down(); Time=0; continue; } if(kbhit()) { key(); } } }???耀?呻??耀b??潤???耀x??????耀????耀??祝???耀????耀????耀??????耀???f耀????耀???耀???耀????向??耀????耀?吝?