Thread: IOCCC Flight Simulator

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York

    IOCCC Flight Simulator

    Do a barrel roll -- with the IOCCC flight simulator (banks 1998) I'm running it under cygwin and it's really entertaining

    #include                                     <math.h>
    #include                                   <sys/time.h>
    #include                                   <X11/Xlib.h>
    #include                                  <X11/keysym.h>
                                              double L ,o ,P
                                             s[999],E,h= 8,I,
                                            1E3,r,t, u,v ,W,S=
                                            a,B,A=32.2,c, F,H;
                                            int N,q, C, y,p,U;
                                           Window z; char f[52]
                                        ; GC k; main(){ Display*e=
     XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
    ; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
    0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
    ; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B=
    sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E
    *T*B,E*d/K *B+v+B/K*F*D)*_; p<y; ){ T=p[s]+i; E=c-p[w]; D=n[p]-L; K=D*m-B*T-H*E; if(p [n]+w[ p]+p[s
    ]== 0|K <fabs(W=T*r-I*E +D*P) |fabs(D=t *D+Z *T-a *E)> K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
     *D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M;
      XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){
                                       XEvent z; XNextEvent(e ,&z);
                                             N-LT? UP-N?& E:&
                                             J:& u: &h); --*(
                                             DN -N? N-DT ?N==
                                             RT?&u: & W:&h:&J
                                              ); } m=15*F/l;
                                              c+=(I=M/ l,l*H
                                              +I*M+a*X)*_; H
                                               )/S; K=F*M+(
                                               h* 1e4/l-(T+
                                               a=2.63 /l*d;
                                               X+=( d*l-T/S
                                                *(.19*E +a
                                                )-M* v +A*
                                                Z)*_; l +=
                                                K *_; W=d;
                                                "%5d  %3d"
                                                "%7d",p =l
                                  O*57.3)%0550,(int)i); d+=T*(.45-14/l*
                                 X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47
                                 *I-m* 52+E*94 *D-t*.38+u*.21*E) /1e2+W*
                                 179*v)/2312; select(p=0,0,0,0,&G); v-=(
                                   )/107e2)*_; D=cos(o); E=sin(o); } }
    It uses X windows and compiles using the following

    #! /bin/sh
    cc banks.c -o banks -DIT=XK_Page_Up -DDT=XK_Page_Down \
    	-DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
    	-DCS=XK_Return -Ddt=0.02 -lm -lX11 -L/usr/X11R6/lib
    I also was procrastinating doing java coding () and I learned how to use autoconf tools! Pretty awesome I think -- I survived make distcheck so I'm pretty happy. Here's a link if you want my autoconf setup

    banks-1.0.tar.gz - zxcvbn - ioccc flight simulator - Google Code

    Basically the usage is that it contains these scenary files and you run it like so --

        cat | ./banks
        cat | ./banks
    Try it out

  2. #2
    Registered User
    Join Date
    Dec 2006
    That is very cool!

    And I got an integer overflow . (I think that means I crashed or something)

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York
    Yea I think so, the crashing sequence is so funny it tumbles and then int overflow

    Barrel roll :]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  2. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Replies: 6
    Last Post: 03-02-2005, 02:45 AM
  5. Flight Simulator Viewing System
    By Anarchist in forum Game Programming
    Replies: 8
    Last Post: 02-12-2002, 05:16 AM