Question

i need c++ code for game dodge em as soon as possible

i need c++ code for game dodge em as soon as possible

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <time.h> 
#include <termios.h>
int _______________________dodge(){srand(time((time_t*)0x0000000));char b[7][9]=
{"        ",  //
 "        ",  //               _____      ___   ___ 
 "        ",  //             / __\ \    / /_\ / __|
 "*      ^",  //             \__ \\ \/\/ / _ \ (_ |
 "        ",  //             |___/ \_/\_/_/ \_\___|
 "        ",  //
 "        "}; //
termios o, n;tcgetattr(0, &o);n = o;n.c_lflag&=0xfffffeff;tcsetattr(0,0,&n);int
a=0;while(1){printf("\033[2J\033[H"

                              "DODGE THE ROCKS!\n"
                           "PRESS A AND D TO MOVE!\n==="

"===========\n");if(rand()%100>85)b[rand()%7][0]='*';int f=0;for(int j=0;j<8;j++
){for(int i=0;i<7;i++){if(b[i][j]=='^'){printf("^");f=1;if(a=='d'&&i+1<7){b[i][j
]=' ';b[i+1][j]='b';}else if(a=='a'&&i-1>=0){b[i][j]=' ';b[i-1][j]='b';}}else if
(b[i][j]=='*'){printf("* ");b[i][j]=' ';if(j+1<8){b[i][j+1]='a';}}else if(b[i][j
]=='a'){b[i][j]='*';printf("  ");}else if(b[i][j]=='b'){b[i][j]='^';printf("  ")
;f=1;}else{printf("  ");}}printf("\n");}printf("==============\n");if(!f){printf
("GAME OVER!\n");break;}timeval t;fd_set s;t.tv_sec=0;t.tv_usec=100000;FD_ZERO(&
s);FD_SET(0,&s);select(1,&s,NULL,NULL,&t);if(FD_ISSET(0,&s))a=getchar();else a=0
;}tcsetattr(0,0,&o);return 0;}const int __dodgee=_______________________dodge();
Add a comment
Know the answer?
Add Answer to:
i need c++ code for game dodge em as soon as possible
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT