正文
增加 9 行删除 8 行
252 行未改动全部展开25325425525625725825926026139 行未改动30130230330430530630730830951 行未改动3613623633643653663673683692 行未改动3723733743753763773783793802 行未改动3833843853863873883893903912 行未改动39439539639739839940040140220 行未改动42342442542642742842943043143243343443543643743843944044110 行未改动252 行未改动全部展开//debug();//=== generate obstacles to add difficulty ===//=== random map pick_up ===int mp_pos_x=rnd()%20+1,mp_pos_y=rnd()%20+1;while(maze[mp_pos_x][mp_pos_y]==0){mp_pos_x=rnd()%20+1;mp_pos_y=rnd()%20+1;}maze[mp_pos_x][mp_pos_y]=666;39 行未改动Sleep(1000);cout<<"What's even worse, the pyramid will change its map completely every 20s. "<<endl;cout<<"You'd better find the treasure in 20s or you will be sent to the entrance and you have to explore again. "<<endl;Sleep(1000);cout<<"Luckily, there's a map in the pyramid. You can pick up the map and see the whole pyramid for 5s. "<<endl;Sleep(1000);cout<<"Use up/down/left/right to move. '#' stands for wall and '.' stands for land. "<<endl;cout<<"o is yourself. ! stands for treasure. "<<endl;Sleep(1000);51 行未改动if(op==1){//upif(is_valid(x-1,y) && maze[x-1][y]!=3 && maze[x-1][y]!=0){x--;cnt++;if(maze[x][y]==666){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else if(op==2){//downif(is_valid(x+1,y) && maze[x+1][y]!=3 && maze[x+1][y]!=0){x++;cnt++;if(maze[x][y]==666){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else if(op==3){//leftif(is_valid(x,y-1) && maze[x][y-1]!=3 && maze[x][y-1]!=0){y--;cnt++;if(maze[x][y]==666){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else{//rightif(is_valid(x,y+1) && maze[x][y+1]!=3 && maze[x][y+1]!=0){y++;cnt++;if(maze[x][y]==666){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}20 行未改动start=chrono::high_resolution_clock::now();}auto mp_end=chrono::high_resolution_clock::now();auto mp_duration=chrono::duration_cast<std::chrono::microseconds>(mp_end-mp_start);if(mp_duration.count()>50000000.0)have_map=false;}auto end=chrono::high_resolution_clock::now();auto duration=chrono::duration_cast<std::chrono::microseconds>(end-start);cout<<"WoW! You find the treasure! Congratulations!"<<endl;cout<<"Your time: "<<duration.count()/1000000.0<<"s"<<endl;cout<<"Your total step: "<<cnt<<endl;double mn_time=0.0;if(bonus)mn_time=(double)cnt/4.0;elsemn_time=(double)dis[edx][edy]/3.0;double pts=((mn_time/(duration.count()/1000000.0))*100.0+((double)dis[edx][edy]/2.0)/((double)cnt/2.0)*100.0)/2;if(bonus)10 行未改动252 行未改动全部展开25325425525625725825926026126239 行未改动30230330430530630730830931051 行未改动3623633643653663673683693702 行未改动3733743753763773783793803812 行未改动3843853863873883893903913922 行未改动39539639739839940040140240320 行未改动42442542642742842943043143243343443543643743843944044144210 行未改动252 行未改动全部展开//debug();//=== generate obstacles to add difficulty ===//=== random map pick_up ===int mp_pos_x=rnd()%20+1,mp_pos_y=rnd()%20+1;int surprisingly_hahaha=rnd()%2;while(maze[mp_pos_x][mp_pos_y]==0 || abs(mp_pos_x-edx)+abs(mp_pos_y-edy)<=10 || maze[mp_pos_x][mp_pos_y]==surprisingly_hahaha){mp_pos_x=rnd()%20+1;mp_pos_y=rnd()%20+1;}maze[mp_pos_x][mp_pos_y]=666;39 行未改动Sleep(1000);cout<<"What's even worse, the pyramid will change its map completely every 20s. "<<endl;cout<<"You'd better find the treasure in 20s or you will be sent to the entrance and you have to explore again. "<<endl;Sleep(1000);cout<<"Luckily, there's a map in the pyramid. You can pick up the map and see the whole pyramid for 3s. "<<endl;Sleep(1000);cout<<"Use up/down/left/right to move. '#' stands for wall and '.' stands for land. "<<endl;cout<<"o is yourself. ! stands for treasure. "<<endl;Sleep(1000);51 行未改动if(op==1){//upif(is_valid(x-1,y) && maze[x-1][y]!=3 && maze[x-1][y]!=0){x--;cnt++;if(maze[x][y]==666 && !bonus){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else if(op==2){//downif(is_valid(x+1,y) && maze[x+1][y]!=3 && maze[x+1][y]!=0){x++;cnt++;if(maze[x][y]==666 && !bonus){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else if(op==3){//leftif(is_valid(x,y-1) && maze[x][y-1]!=3 && maze[x][y-1]!=0){y--;cnt++;if(maze[x][y]==666 && !bonus){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}2 行未改动else{//rightif(is_valid(x,y+1) && maze[x][y+1]!=3 && maze[x][y+1]!=0){y++;cnt++;if(maze[x][y]==666 && !bonus){mp_start=chrono::high_resolution_clock::now();have_map=true;bonus=true;}20 行未改动start=chrono::high_resolution_clock::now();}auto mp_end=chrono::high_resolution_clock::now();auto mp_duration=chrono::duration_cast<std::chrono::microseconds>(mp_end-mp_start);if(mp_duration.count()>3000000.0)have_map=false;}auto end=chrono::high_resolution_clock::now();auto duration=chrono::duration_cast<std::chrono::microseconds>(end-start);cout<<"WoW! You find the treasure! Congratulations!"<<endl;cout<<"Your time: "<<duration.count()/1000000.0<<"s"<<endl;cout<<"Your total step: "<<cnt<<endl;double mn_time=0.0;if(bonus)mn_time=(double)dis[edx][edy]/3.5;elsemn_time=(double)dis[edx][edy]/3.0;double pts=((mn_time/(duration.count()/1000000.0))*100.0+((double)dis[edx][edy]/2.0)/((double)cnt/2.0)*100.0)/2;if(bonus)10 行未改动