Guest User

htw-steveverrill.c

a guest
May 4th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #define Q(N) (N+"ehtweuewgwth"[N%4*3+e])%20
  2. #define P printf(
  3. i,d,e,a,b;main(){int p=19,q=srand(&p),h=rand()%p,w=rand()%p;while(p-h&&p-w){for(e=3;e--;){q=Q(p);(q-w)||P"you smell a wumpus\n",a|=2<<p);(q-h)||P"you feel a breeze\n",b|=1<<p);}for(i=20;i--;)P"%c%c",i-p?48+(a>>i&2)+(b>>i&1):"-\\/"[d],"\n "[i%4]);scanf("%d",&i);e=(d+i/9)*"edde"[p%4]%3;q=Q(p);if(i%5){e=rand()%3;w=q-w?P"arrow missed\n",a=0)&0+Q(w):(p=20);}else p=q,d=e;}P p-20?p-w?"YOU FELL IN A HOLE!\n":"THE WUMPUS GOT YOU!\n":"YOU KILLED THE WUMPUS!\n");}
Advertisement
Add Comment
Please, Sign In to add comment