Post your age here

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VxDx
    FFR Player
    • May 2003
    • 1871

    #76
    Originally posted by aperson
    Originally posted by VxDx
    I more just made it work in the most confusing way.
    We think alike.


    I once had to write a small database in class, I made it out of a bunch of switch and for loops instead of a list, oh man that pissed the teacher off because it worked perfectly.
    If I can find my pong code Ill show you. So confusing. By the end even I didn't know how it worked.

    Edit: found it...

    Code:
    #include<conio.h>
    #include<iostream.h>
    #include<dos.h>
    #include<mem.h>
    #include<stdlib.h>
    #include<math.h>
    
    //---------------------------------
    //video
    unsigned char *vga = &#40;unsigned char *&#41; MK_FP&#40;0xA000, 0&#41;;
    
    void setTEXT&#40;&#41;&#123;
    		_AX= 0x0003;
          geninterrupt&#40;0x10&#41;;
                 &#125;
    
    void setMCGA&#40;&#41;&#123;
    
        _AX = 0x0013;
    
        geninterrupt &#40;0x10&#41;;
    
      &#125;
    
    void MEMPutpixel &#40;int x, int y, unsigned char Col&#41;
    &#123;
        memset&#40;vga+x+&#40;y*320&#41;,Col,1&#41;;
    &#125;
    //video
    //------------------------------
    
    
    
    void menu&#40;&#41;;
    void igmenu&#40;&#41;;
    void drawball&#40;&#41;;
    void drawpaddle1&#40;int&#41;;
    void drawpaddle2&#40;int&#41;;
    void drawtable&#40;&#41;;
    /*void drawscore&#40;int , int&#41;;
    void d1&#40;int , int&#41;;
    void d2&#40;int , int&#41;;
    void d3&#40;int , int&#41;;
    void d4&#40;int , int&#41;;
    void d5&#40;int , int&#41;;
    void d6&#40;int , int&#41;;
    void d7&#40;int , int&#41;;
    void d8&#40;int , int&#41;;
    void d9&#40;int , int&#41;;
    void d0&#40;int , int&#41;;
    */
    void hitproj&#40;&#41;;
    void supar&#40;&#41;;
    void calcbpos&#40;&#41;;
    
    
    
    int color , speed , bx=160 , by=100 , p1y=100 , p2y=100 , quit=0 , dir=-1;
    int proj=1;
    float tempx=160 , tempy=100;
    
    ////////////////////////////////////////////////////////////////////////////////
    //MAIN//////////////////////////////////////////////////////////////////////////
    void main&#40;&#41;
    &#123;
    	int key=72;
    
    	menu&#40;&#41;;
       setMCGA&#40;&#41;;
       drawtable&#40;&#41;;
       drawpaddle1&#40;2&#41;;
       drawpaddle2&#40;2&#41;;
    
    while&#40;bx!=8&&bx!=312&#41;
    &#123;
       drawball&#40;&#41;;
    
    	if&#40;kbhit&#40;&#41;&#41;
       &#123;
       	key = getch&#40;&#41;;
       &#125;
          switch&#40;key&#41;
          &#123;
          	case 72&#58;p2y-=3;   drawpaddle2&#40;1&#41;;   break;
             case 80&#58;p2y+=3;   drawpaddle2&#40;0&#41;;   break;
             case 97&#58;p1y-=3;   drawpaddle1&#40;1&#41;;   break;
             case 122&#58;p1y+=3;  drawpaddle1&#40;0&#41;; setTEXT&#40;&#41;;cout<<"aaa";  break;
             case 27&#58;igmenu&#40;&#41;;
          &#125;
    
       hitproj&#40;&#41;;
       delay&#40;4*speed&#41;;
       calcbpos&#40;&#41;;
    
    &#125;
    
    getch&#40;&#41;;
    &#125;
    //END MAIN//////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    
    
    
    
    void menu&#40;&#41;
    &#123;
    cout<<"Color 1 - 16...";
    cin>>color;
    color-=1;
    cout<<"\n\nSpeed 1-4 &#40;4 = slow&#41;...";
    cin>>speed;
    &#125;
    
    
    
    
    
    void supar&#40;&#41;
    &#123;
    	int c=0 , x=160 , y=100 , vect=0 , colo=10 , key;
       randomize&#40;&#41;;
    
       while&#40;key != 27&#41;
       &#123;
    
       switch&#40;vect&#41;
       &#123;
       	case 0&#58;	x=x+1;   break;
       	case 1&#58;	y=y-1;   break;
          case 2&#58;	x=x-1;   break;
          case 3&#58;	y=y+1;   break;
       &#125;
    
       if&#40;c==0&#41;colo=10;
       if&#40;c==30000&#41;colo=0;
    	MEMPutpixel&#40;x,y,colo&#41;;
       c++;
       switch&#40;random&#40;7&#41;&#41;
       &#123;
       	case 0&#58; vect=random&#40;4&#41;;
    	&#125;
       if&#40;kbhit&#40;&#41;&#41;key = getch&#40;&#41;;
       &#125;
    
    &#125;
    
    
    
    
    
    void igmenu&#40;&#41;
    &#123;
       int ch;
    	setTEXT&#40;&#41;;
       cout<<"1&#58; Continue\n";
       cout<<"2&#58; Quit\n";
       cout<<"666&#58; FOR A SUPAR TIME\n\n";
       cin>>ch;
    
       if&#40;ch==2&#41;exit&#40;0&#41;;
       setMCGA&#40;&#41;;
       if&#40;ch==666&#41;supar&#40;&#41;;
       drawtable&#40;&#41;;
       drawpaddle1&#40;2&#41;;
       drawpaddle2&#40;2&#41;;
    &#125;
    
    
    
    
    void drawball&#40;&#41;
    &#123;
    	MEMPutpixel&#40;bx,by,color&#41;;
    &#125;
    
    void drawpaddle1&#40;int ud&#41;
    &#123;
       int e;
       if&#40;p1y>32&&p1y<154&#41;for&#40;e=0 ; e<16 ; e++&#41;&#123;MEMPutpixel&#40;16,&#40;p1y+e&#41;,color&#41;;&#125;
       if&#40;ud==1&&p1y>32&&p1y<154&#41;
       	&#123;
           MEMPutpixel&#40;16,p1y+17,0&#41;;
           MEMPutpixel&#40;16,p1y+18,0&#41;;
           MEMPutpixel&#40;16,p1y+19,0&#41;;
          &#125;
       if&#40;ud==0&&p1y>32&&p1y<154&#41;
       	&#123;
           MEMPutpixel&#40;16,p1y-1,0&#41;;
           MEMPutpixel&#40;16,p1y-2,0&#41;;
           MEMPutpixel&#40;16,p1y-3,0&#41;;
          &#125;
    &#125;
    
    void drawpaddle2&#40;int ud&#41;
    &#123;
       int e;
    	if&#40;p2y>32&&p2y<154&#41;for&#40;e=0 ; e<16 ; e++&#41;&#123;MEMPutpixel&#40;304,&#40;p2y+e&#41;,color&#41;;&#125;
       if&#40;ud==1 && p2y>32 && p2y<154&#41;
       	&#123;
           MEMPutpixel&#40;304,p2y+17,0&#41;;
           MEMPutpixel&#40;304,p2y+18,0&#41;;
           MEMPutpixel&#40;304,p2y+19,0&#41;;
          &#125;
       if&#40;ud==0&&p2y>32&&p2y<154&#41;
       	&#123;
           MEMPutpixel&#40;304,p2y-1,0&#41;;
           MEMPutpixel&#40;304,p2y-2,0&#41;;
           MEMPutpixel&#40;304,p2y-3,0&#41;;
          &#125;
    &#125;
    
    void drawtable&#40;&#41;
    &#123;
    	for&#40;int y=32 ; y<168 ; y++&#41;&#123;MEMPutpixel&#40;8,y,color&#41;;  MEMPutpixel&#40;312,y,color&#41;;&#125;
       for&#40;int x=8 ; x<312 ; x++&#41;&#123;MEMPutpixel&#40;x,32,color&#41;;  MEMPutpixel&#40;x,168,color&#41;;&#125;
    &#125;
    
    
    
    void hitproj&#40;&#41;
    &#123;
    	// |  add 2
       // |  add 2
       // |  add 2
       // |  add 1
       // |  add 1
       // |  add .5
       // |  add .5
       // |  add 0
       // |  add 0
       // |  sub .5
       // |  sub .5
       // |  sub 1
       // |  sub 1
       // |  sub 2
       // |  sub 2
       // |  sub 2
    
       //dir  <- = -1   1 = ->
       //when hit, ball changes direction and slope to the opposites
    
       if&#40;by == 33||by == 167&#41;proj = -proj;
       if&#40;bx == 17&&dir == -1&#41;
          	switch&#40;by-p1y&#41;
             &#123;
             	case 0&#58;
                case 1&#58;
                case 2&#58;dir=1;  proj+=2;  break;
                case 3&#58;
                case 4&#58;dir=1;  proj+=1;  break;
                case 5&#58;
                case 6&#58;dir=1;  proj+=.5;  break;
                case 7&#58;
                case 8&#58;dir=1;  break;
                case 9&#58;
                case 10&#58;dir=1;  proj-=.5;  break;
                case 11&#58;
                case 12&#58;dir=1;  proj-=1;  break;
                case 13&#58;
                case 14&#58;
                case 15&#58;dir=1;  proj-=2;  break;
             &#125;
    
       if&#40;bx == 303&&dir == 1&#41;
             switch&#40;by-p2y&#41;
             &#123;
             	case 0&#58;
                case 1&#58;
                case 2&#58;dir=-1;  proj+=2;  break;
                case 3&#58;
                case 4&#58;dir=-1;  proj+=1;  break;
                case 5&#58;
                case 6&#58;dir=-1;  proj+=.5;  break;
                case 7&#58;
                case 8&#58;dir=-1;  break;
                case 9&#58;
                case 10&#58;dir=-1;  proj-=.5;  break;
                case 11&#58;
                case 12&#58;dir=-1;  proj-=1;  break;
                case 13&#58;
                case 14&#58;
                case 15&#58;dir=-1;  proj-=2;  break;
             &#125;
    
    
    &#125;
    
    
    
    void calcbpos&#40;&#41;
    &#123;
       if&#40;dir == 1&#41;
       &#123;
       if&#40;proj==1&#41;&#123;bx++;by--;&#125;
       else&#123;bx++;by++;&#125;
       &#125;
    	else
       &#123;
       if&#40;proj==1&#41;&#123;bx--;by++;&#125;
       else&#123;bx--;by--;&#125;
       &#125;
    
    
       MEMPutpixel&#40;100,100,14&#41;;
      	/*if&#40;dir == 1&#41;
       &#123;
    
    		if&#40;proj>0&#41;
          &#123;
          	if&#40;proj>=1&#41;
       		&#123;tempx+=1/proj;tempy-=1;&#125;
          	else &#123;tempx+=1;tempy-=1/proj;&#125;
          &#125;
          if&#40;proj<0&#41;
          &#123;
          	if&#40;proj<=-1&#41;
          	&#123;tempx+=1/proj;tempy+=1;&#125;
          	else &#123;tempx+=1;tempy+=1/proj;&#125;
          &#125;
          if&#40;proj==0&#41;tempx+=1;
    	&#125;
    
       if&#40;dir == -1&#41;
       &#123;
       	if&#40;proj>0&#41;
          &#123;
          	if&#40;proj>=1&#41;
       		&#123;tempx-=1/proj;tempy+=1;&#125;
          	else &#123;tempx-=1;tempy+=1/proj;&#125;
          &#125;
          if&#40;proj<0&#41;
          &#123;
          	if&#40;proj<=-1&#41;
          	&#123;tempx-=1/proj;tempy-=1;&#125;
          	else &#123;tempx-=1;tempy-=1/proj;&#125;
          &#125;
          if&#40;proj==0&#41;tempx--;
       &#125;
    
       bx=tempx;
       by=tempy;
       */
    &#125;

    Comment

    • aperson
      FFR Hall of Fame
      FFR Simfile Author
      • Jul 2003
      • 3431

      #77
      Lol jesus that is confusing.

      Comments are for pussies :P

      Comment

      • makaveli121212
        FFR Player
        • May 2003
        • 3823

        #78
        the supar time is the best though
        Originally posted by VxDx
        Stick it in her butt and pee.

        Comment

        • VxDx
          FFR Player
          • May 2003
          • 1871

          #79
          Maybe you'd appreciate this. It's the complete game of missle command.

          Code:
          nclude <X11/Xlib.h>
          #include <unistd.h>
          typedef long O; typedef struct                    &#123; O b,f,u,s,c,a,t,e,d; &#125; C;
          Display *d; Window w; GC g; XEvent e;
          char Q&#91;&#93; = "Level %d   Score %d", m&#91;222&#93;;
          #define N&#40;r&#41; &#40;random&#40;&#41;%&#40;r&#41;&#41;
          #define U I&#91;n++&#93;=L&#91;n&#93;=l; n%=222
          #define K c=-l.u; l=I&#91;i&#93;; l.t=0; c+=l.u
          #define E l.e--&&!--L&#91;l.e&#93;.d&&&#40;L&#91;l.e&#93;.t=3&#41;
          #define M&#40;a,e,i,o&#41; a&#91;0&#93;=e,&#40;a&#91;1&#93;=i&#41;&&XFillPolygon&#40;d,w,g,&#40;void*&#41;a,o,1,1&#41;
          #define F return
          #define R while&#40;
          #define Y if&#40;l.t
          
          
                                O p                                           ,B,
                             D,A=6,Z                                         ,S=0,v=
                          0,n=0,W=400                                       ,H=300,a&#91;7&#93;
                        =&#123; 33,99, 165,                                     231,297,363&#125; ;
                      XGCValues G=&#123; 6,0                                   ,~0L,0,1&#125; ; short
                     T&#91;&#93;=&#123; 0,300,-20,0,4                                 ,-20,4,10,4,-5,4,5,
                   4,-20,4,20,4,-5,4,5,4,                               -10,4,20&#125;,b&#91;&#93;=&#123; 0,0,4,
                  0,-4,4,-4,-4,4,-4,4,4&#125; ;                             C L&#91;222&#93;,I&#91;222&#93;;dC&#40;O x&#41;&#123;
                 M&#40;T,a&#91;x&#93;,H,12&#41;; &#125; Ne&#40;C l,O                           s&#41; &#123; l.f=l.a=1; l.b=l.u=s;
                l.t=16; l.e=0; U; &#125; nL&#40;O t,O                         a,O b,O x,O y,O s,O p&#41;&#123; C l;
               l.d=0; l.f=s; l.t=t; y-=l.c=b;                       l.e=t==2?x&#58;p; x-=l.s=a;s=&#40;x|1&#41;
              %2*x; t=&#40;y|1&#41;%2*y; l.u=&#40;a=s>t?s&#58;                     t&#41;>>9;l.a=&#40;x<<9&#41;/a;l.b=&#40;y<<9&#41;/a;
             U; &#125; di&#40;C I&#41;&#123; O p,q,r,s,i=222;C l;                   B=D=0; R i--&#41;&#123; l=L&#91;i&#93;; Y>7&#41;&#123; p=I.s
            -l.s>>9; q=I.c-l.c>>9; r=l.t==8?l.b&#58;                 l.a; s=p*p+q*q; if&#40;s<r*r||I.t==2&&s<
            26&#41; F S+=10; s=&#40;20<<9&#41;/&#40;s|1&#41;; B+=p*s;               D+=q*s; &#125;&#125; F 0; &#125; hi&#40;O x,O d&#41;&#123; O i=A;
           R i--&&&#40;x<a&#91;i&#93;-d||x>a&#91;i&#93;+d&#41;&#41;; F i; &#125;      dL&#40;&#41;&#123; O      c,r=0, i=222,h; C l; R i--&#41;&#123; l=L&#91;i&#93;;
           Y&#41;&#123; r++;c=l.f; Y==3&#41;&#123;c=l.u; l.t=0;     E; &#125;R c--&#41;&#123;--     l.u;h=l.c>>9; Y>7&#41;&#123;XDrawArc&#40;d,w,g,
          &#40;l.s>>9&#41;-++l.a,h-l.a,l.a*2,l.a*2,0   ,90<<8&#41;; if&#40;!l.u&#41;&#123;    I&#91;i&#93;.t-=8; l=I&#91;i&#93;; &#125; &#125; else Y==2&#41;M
          &#40;b,l.s>>9,h,6&#41;; else XDrawPoint&#40;d    ,w,g,&#40;l.s+=l.a&#41;>>9,    h=&#40;l.c+=l.b&#41;>>9&#41;; Y==4&&!l.u&#41;&#123; Ne
          &#40;l,20&#41;; K; &#125; Y&&l.t<3&&&#40;di&#40;l&#41;||h>    H&#41;&#41;&#123; if&#40;h>H&&&#40;c=hi&#40;    l.s>>9,25&#41;&#41;>=0&#41;&#123; dC&#40;c&#41;; a&#91;c&#93;=a&#91;--
          A&#93;; &#125;Ne&#40;l,30&#41;; Y==1&#41;&#123; E;K; &#125; else    c=l.t=0;&#125; Y==1&&h<H    -75&&!N&#40;p*77&#41;&#41;&#123; do&#123; nL&#40;1,l.s,l.c,
                                                N&#40;W<<9&#41;,H<<9,1,i+
                                                  1&#41;; I&#91;i&#93;.d++;
                                                     &#125;R N&#40;3&#41;
          
                                                  &#41;;         K;
                                                 l.u=c; c=0; &#125; Y
                                                ==2&#41;&#123; l.s+=l.a+B;
                                               l.a= &#40;l.e-l.s&#41;/&#40;&#40;H+
                                              20-h&#41;|1&#41;; l.c+=l.b+D;
                                             M&#40;b,l.s>>9,l.c>>9,6&#41;; &#125;
                                            &#125; L&#91;i&#93;=l; &#125; &#125; F r; &#125; J&#40;&#41;&#123;
                                           R A&#41; &#123; XFlush&#40;d&#41;; v&&sleep&#40;
                                          3&#41;; Z=++v*10; p=50-v; v%2&&hi
                                         &#40;&#40;a&#91;A&#93;=N&#40;W-50&#41;+25&#41;,50&#41;<0 &&A++;
          	                      XClearWindow &#40;d,w&#41;; for&#40;B=0; B<A;
                                       dC&#40;B++&#41;&#41;; R Z|dL&#40;&#41;&#41;&#123; Z&&!N&#40;p&#41;&&&#40;Z--
                                      ,nL&#40;1+!N&#40;p&#41;,N&#40;W<<9&#41;, 0,N&#40;W<<9&#41;,H<<9,1
                                     ,0&#41;&#41;; usleep&#40;p*200&#41;; XCheckMaskEvent&#40;d,
                                    4,&e&#41;&&A&&--S&&nL&#40;4,a&#91;N&#40;A&#41;&#93;<<9,H-10<<9,e.
                                   xbutton.x<<9,e.xbutton.y<<9,5,0&#41;;&#125;S+=A*100;
                                       B=sprintf&#40;m,Q,v,S&#41;; XDrawString&#40;d,w
                                               ,g,W/3,H/2,m,B&#41;; &#125; &#125;
          
          main &#40;&#41;
          &#123;
          O i=2;
          d=XOpenDisplay&#40;0&#41;;
          w=RootWindow&#40;d,0&#41;;
          R i--&#41; XMapWindow&#40;d,w=XCreateSimpleWindow&#40;d,w,0,0,W,H,0,0,0&#41;&#41;;
          XSelectInput&#40;d,w,4|1<<15&#41;;
          XMaskEvent&#40;d,1<<15,&e&#41;;
          g=XCreateGC&#40;d,w,829,&G&#41;;
          srandom&#40;time&#40;0&#41;&#41;;
          J&#40;&#41;;
          puts&#40;m&#41;;
          &#125;

          Comment

          • Moogy
            嗚呼
            FFR Simfile Author
            • Aug 2003
            • 10303

            #80
            That is awesome.
            Plz visit my blog

            ^^^ vintage signature from like 2006 preserved

            Comment

            • aperson
              FFR Hall of Fame
              FFR Simfile Author
              • Jul 2003
              • 3431

              #81
              You fucking scare me o_O

              So did you do it like normal then go through and format it to be like that?

              Comment

              • Yanah_God
                Banned
                • Oct 2003
                • 1330

                #82
                god dammit, i wish i weren't too fucking lazy to learn to program


                then I might be able to understand more than 7/8 of what you say

                * EDIT *

                god dammit, how did you get me to post in another age thing? >_<

                Comment

                • VxDx
                  FFR Player
                  • May 2003
                  • 1871

                  #83
                  Originally posted by aperson
                  You #$#ing scare me o_O

                  So did you do it like normal then go through and format it to be like that?
                  sorry I really should have given credit. I didn't write that (though I wish I had) It was a winner in the International Obfuscated C Code Contest. The programmer was John Williams.

                  Comment

                  • Lupin_the_3rd
                    FFR Player
                    • Oct 2003
                    • 2665

                    #84
                    John williams the composer?

                    Comment

                    • drummerboy765
                      FFR Player
                      • Oct 2003
                      • 720

                      #85
                      John williams the composer?
                      lol...

                      Comment

                      • Takisho
                        FFR Player
                        • Nov 2003
                        • 920

                        #86
                        I feel stupid because I don't understand all that code and probably everyone else does

                        Comment

                        • Yanah_God
                          Banned
                          • Oct 2003
                          • 1330

                          #87
                          i don't understand all of it, just about 7/8 of it

                          Comment

                          • QreepyBORIS
                            FFR Player
                            • Feb 2003
                            • 7454

                            #88
                            What the hell, linus? I am not under thirteen, I am thirteen. Get your facts straight, please.

                            Signature subject to change.

                            THE ZERRRRRG.

                            Comment

                            • Yanah_God
                              Banned
                              • Oct 2003
                              • 1330

                              #89
                              who is this "linus" character you speak of?

                              Comment

                              • QreepyBORIS
                                FFR Player
                                • Feb 2003
                                • 7454

                                #90
                                Read page two.

                                Signature subject to change.

                                THE ZERRRRRG.

                                Comment

                                Working...