1. Си / Говнокод #17804

    +138

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    #define poff    acurp + curp * (nSQs+2)        /*probs: offset*/
    long psum() {return  c(poff+ 1);}    long pmax()    {return c(poff+2);}
    long pn     (long n)                {return          c(poff+2+n);   }
    void setp   (long n, long x){set    (poff+2+n, x);} /*prob changes:*/ 
    void setmax         (long x){set    (poff+2,   x);} /*metasearching*/
    void setsum         (long x){set    (poff+1,   x);}
    long get2ndmax()    {long n= poff+2, x=pmax(), m=n,  s=0,end=n+nSQs;   
         do     {n++;}   while  (c(n) != x);  /*find 2nd-highest <=pmax*/     
         do     {m++;    if (s < c(m) && m !=n) s= c(m);}/*jue tncheck?*/
                 while      (s < x    && m < end);       return  s;}
    void addtoSQ(long i, long val) {long x;   /*increase prob of ith SQ*/
         if  (val < 1 || i >nSQs || i<1) return;        /*not possible!*/
         x =  psum()+val;if (x > maxint) return;   /*has max normalizer*/
         setsum (x);    /*normalizer +*/ x =  pn(i)+val; setp(i, x); 
         if (x > pmax()) setmax (x);}   /*maximal SQprob has increased */    
    void subofSQ(long i, long val) {long x;   /*decrease prob of ith SQ*/
         if  (val < 1 || i >nSQs || i<1) return;        /*not possible!*/
         x =  pn(i)-val; if (x < 0)      return;/*no neg probabilities!*/
         setsum (psum()- val);           setp(i,x);/*don't check if =0!*/   
         if (x + val  == pmax()) setmax (get2ndmax());} /*change of max*/
    void incSQ()        {long i= top();  addtoSQ(i,1);} /*top, not pop!*/
    void decSQ()        {long i= top(),  x,y,z; /*decrem prob of the SQ*/
         if  (i> nSQs   || i< 1) return;/*no such search Q number known*/
         x =  pn(i);     if     (x==0)   return;        /*SQ: already 0*/
         y  = psum();    z =     pmax();              
         if  (x == 1 &&  y    <= z+1)    stop    /*leave at least 2 SQs*/
         if  (x == z)    setmax         (get2ndmax());  /*change of max*/
         setp(i, x-1);   setsum (y-1);}                 /*normalizer -1*/
    long upSQ;          /*SQ probability:enumerator  +=  upSQ: increase*/
    void oldSQ()   {long a=pop()+ndecl,  n,i; if(a<0||a> oldp)stop/*bad*/
         n=old[a].size;  a=old[a].start;/*all SQs of old nondecl: +upSQ*/
         tncheck  n+=a;  for(i=a;i<n;i++)addtoSQ(SQ[q[i].Q],     upSQ);}
    
    void setpat()       {long i= pop(); /*instantiate my search pattern*/
         if  (i<0 || i > patp)     stop /*no such search pattern exists*/
         set (acurp,i);}/*next SQ-search defined via new probabilities!*/
    void pupat()        {long    i  =    apatp;   /*push search pattern*/ 
         if  (i>maxpat)  stop    i++;    set(apatp,i);  /*not too many?*/
         cpabn  (poff+1, acurp + 1 + i *(2+ nSQs),       2 + nSQs,  
                                         acurp + 1,      aendpats);     }  
    void popat()        {long i= apatp;  if(i==0)   stop
         set(apatp,i-1); push(i); }                /*pop search pattern*/

    Полный исходник http://www.idsia.ch/~juergen/oopscode.c

    Запостил: j123123, 17 Марта 2015

    Комментарии (11) RSS

    • проитал как www.india.ch
      Ответить
    • Тарас радостно улыбается, глядя на этот код.
      Ответить
    • code {
          text-align: justify; // так верстают только мудаки
      }
      Ответить
    • А питон бы это даже не распарсил! Скобкобляди соснули!
      Ответить
      • Ты так говоришь будто питон должен уметь парсить Си.
        Ответить
    • Подогнано под редактор Turbo C?
      Ответить
      • Похоже на то, самый дальний нонспейс в 77 колонке.
        Ответить
    • Надо ж было так всё испоганить во второй строке.
      Ответить
    • зато умещается и с комментариями
      Ответить
    • >#define amin
      Вот имя Отца, Сына и Святого Духа...
      Ответить
    • http://people.idsia.ch/~juergen/oopscode.c
      http://people.idsia.ch/~juergen/

      Since age 15 or so, the main goal of professor Jürgen Schmidhuber has been to build a self-improving Artificial Intelligence (AI) smarter than himself, then retire. His lab's Deep Learning Neural Networks (NNs) (since 1991) and Long Short-Term Memory have transformed machine learning and AI, Deep Learning since 1991 - Winning Contests in Pattern Recognition and Sequence Learning Through Fast & Deep / Recurrent Neural Networks and are now (2017) available to billions of users through the world's most valuable public companies including Google, Apple, Microsoft, Amazon, etc. In 2011, his team was the first to win official computer vision contests through deep NNs, with superhuman performance. His research group also established the field of mathematically rigorous universal AI and recursive self-improvement in universal problem solvers that learn to learn (since 1987). His formal theory of creativity & curiosity & fun explains art, science, music, and humor. He also generalized algorithmic information theory and the many-worlds theory of physics, and introduced the concept of Low-Complexity Art, the information age's extreme form of minimal art. He is recipient of numerous awards, and president of the company NNAISENSE, which aims at building the first practical general purpose AI.

      Но код у него говно
      Ответить

    Добавить комментарий