1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #7002

    +131

    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
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    (defparameter n 2)
    (setf middle (make-array 2 :initial-element 0))
    (defparameter v 7)
    (setf tr (make-array `(,(+ 1 n) ,n) :initial-element 4))
    (setf ftr (make-array 3 :initial-element 1))
    (defun pow (x n)
    (cond((= n 0) 1)((= n 1) x)(T (* x (pow x (- n 1))))))
    (defun f1 (x y)
    (+ (* (pow v 2) (pow x 2))
    (* (/ v (+ v 1)) x)
    (* 15 (+ v 1) (pow y 2))
    (* -1 2 v y) (* 4 v)))
    
    (defun sigma1 (a)
    (* a (/ (+ (sqrt (+ n 1)) (- n 1))
    (* n (sqrt 2))) ))
    
    (defun sigma2 (a)
    (* a (/ (+ (sqrt (+ n 1)) -1)
    (* n (sqrt 2))) ))
    
    (defun setp (a)
    (loop for i from 1 to n do
    (loop for j from 0 to (- n 1) do
    (cond
    ((= (- i 1) j) (setf (aref tr i j) (+ (aref tr 0 0) (sigma2 a))))
    (T (setf (aref tr i j) (+ (aref tr 0 1) (sigma1 a))))))))
    
    (defun evalfun ()
    (loop for i from 0 to n do
    (setf (aref ftr i) (f1 (aref tr i '0) (aref tr i '1)))
    (format t "The functions in dot ~$:~$~$" `(,(aref tr i '0) ,(aref tr i '1)) (aref ftr i) #\newline))
    (setf ftr (sort ftr #'<)))
    
    (defun midp()
    (loop for i from 0 to n do
    (cond
    ((= (aref ftr n) (f1 (aref tr i '0) (aref tr i '1)))
    (setq tp i))))
    
    (setf middle (make-array n :initial-element 0))
    (loop for i from 0 to n do
    (cond
    ((/= i tp)
    (setf (aref middle 0) (+ (aref middle 0) (aref tr i 0)))
    (setf (aref middle 1) (+ (aref middle 1) (aref tr i 1))))))
    (setf (aref middle 1) (/ (aref middle 1) 2))
    (setf (aref middle 0) (/ (aref middle 0) 2))
    (format t "The weight center in ~$,~$" (aref middle 0) (aref middle 0))
    (princ #\newline))
    
    (defun newp()
    (setf (aref tr tp 0) (- (aref middle 0) (aref tr tp 0)))
    (setf (aref tr tp 1) (- (aref middle 1) (aref tr tp 1))))
    (defun prpolinom()
    (format t "Polinom has this dots:~$" #\newline)
    (loop for i to n do
    (loop for j to (- n 1) do
    (format t "|~$|" (aref tr i j)))
    (princ #\newline)))
    
    (setq c 1)
    (defun mloop(a)
    (setp a)
    (defun subloop()
    (setq c (+ c 1))
    (setf tmiddle (make-array n :initial-element 0))
    (loop for i to (- n 1) do
    (setf (aref tmiddle i) (aref middle i)))
    (evalfun)
    (midp)
    (newp)
    (prpolinom)
    
    (cond
    ((and (= (aref tmiddle 0) (aref middle 0)) (= (aref tmiddle 1) (aref middle 1)))(mloop (/ a 2)))
    ((> a 0.01) (subloop) (format t "Iteration ~$~$" c #\newline))))
    (subloop))
    (mloop 2)

    симплекс метод на Common Lisp=)

    zura, 20 Июня 2011

    Комментарии (24)
  3. Куча / Говнокод #6804

    +131

    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
    /*здесь заданы значения листов x и y соответственно*/
    x: [...] $
    y: [...] $
    ...
    /*и понеслась*/
    xx: [-10] $
    for i in create_list(i,i, 2,length(h)) do
    	xx: append(xx, [i,i]) $
    xx: append(xx, [10]) $
    
    yy: [ first(x) ] $
    for i in create_list(i,i, 2,length(h)) do
    	yy: append(yy, [x[i-1],x[i]]) $
    yy: append(yy, [last(yy)]) $
    
    plot2d( [discrete, xx,yy] ) $

    maxima. рисуем кусочно-заданную функцию О_о

    ilardm, 31 Мая 2011

    Комментарии (2)
  4. Куча / Говнокод #6712

    +131

    1. 1
    http://molinos.ru/portfolio/a/1/1/

    Ждем загрузку, смотрим код. Офигеваем от 300К+ табуляций.

    ling, 20 Мая 2011

    Комментарии (13)
  5. C# / Говнокод #6680

    +131

    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
    if (comboBox1.SelectedItem.ToString() == "VISA")
                {
                    pictureBox7.Visible = false;
                    pictureBox6.Visible = false;
                    pictureBox5.Visible = false;
                    pictureBox4.Visible = false;
                    pictureBox3.Visible = false;
                    pictureBox2.Visible = false;
                    pictureBox1.Visible = true;
                }
                if (comboBox1.SelectedItem.ToString() == "MasterCard")
                {
                    pictureBox7.Visible = false;
                    pictureBox6.Visible = false;
                    pictureBox5.Visible = false;
                    pictureBox4.Visible = false;
                    pictureBox3.Visible = false;
                    pictureBox1.Visible = false;
                    pictureBox2.Visible = true;
                }

    + ещй пять такие проверок. Ну не умеет человек PictureBox.Image пользоваться.

    Killster, 16 Мая 2011

    Комментарии (55)
  6. Куча / Говнокод #6606

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <tr> <td width="209" valign="top"><font color="#1674b5">Русский язык</font></td> <td width="244" valign="top"><font color="#1674b5">История России</font></td> <td width="218" valign="top"><font color="#1674b5">Биология</font></td> </tr>
                 
                  <tr> <td width="209" valign="top"><font color="#1674b5">Литература</font></td> <td width="244" valign="top"><font color="#1674b5">Обществознание</font></td> <td width="218" valign="top"><font color="#1674b5">Химия</font></td> </tr>
    
                 
                  <tr> <td width="209" valign="top"><font color="#1674b5">Математика</font></td> <td width="244" valign="top"><font color="#1674b5">Физика</font></td> <td width="218" valign="top"><font color="#1674b5">География</font></td> </tr>
                 
                  <tr> <td width="209" valign="top"><font color="#1674b5">Информатика и ИКТ</font></td> <td width="244" valign="top"><font color="#1674b5">Иностранный язык</font></td> <td width="218" valign="top">

    Вёрстка сайта на Битриксе.

    RaZeR, 09 Мая 2011

    Комментарии (18)
  7. Куча / Говнокод #6485

    +131

    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
    <div class="add_from_list"> 
    <input type="text" name="Количество товара" value="1" id="lol"> шт. 
    <script>
    function hz(id,val)
    {
    var str=id.split('-');
    var n='';
    for(var i=0;i<3;i++) n+=str[i]+'-';
    n+=val;
    document.getElementById(id).id=n;
    }
    </script>
    <a href="javascript:return false;" id="good-7307-272,80-1" class="addCart" onclick="hz(this.id,document.getElementById('lol').value);" >Добавить товар</a> 
    </div>

    GoodTalkBot, 26 Апреля 2011

    Комментарии (7)
  8. Куча / Говнокод #6331

    +131

    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
    if (continue == false and repair_clock_Contact(objGame, tActivElem[k], tVal) == true) then
                if (repair_clock_IsElemInTable(tRotateElem, tVal) ~= false) then
                  if (repair_clock_IsElemInTable(tPreviousElem, tVal) == false) then
                    --PINDEC!!! NIXTO NE KRYTITSYA! VSEM VUITI IZ SYMRAKA!!!;
                    repair_clock_StopAllElem(objGame);
                    return;
                  else
                    intWithPrev = intWithPrev + 1;
                    if (intWithPrev > 1) then
                      --PINDEC!!! NIXTO NE KRYTITSYA! VSEM VUITI IZ SYMRAKA!!!;
                      repair_clock_StopAllElem(objGame);
                      return;
                    end
                  end
                else
                  table.insert (tElem, tVal);
                end
                  table.insert (tElem, tVal);
              end

    Проверка вращения шестерёнок в часах.

    MAGnit, 13 Апреля 2011

    Комментарии (7)
  9. C# / Говнокод #5863

    +131

    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
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    static public int IIF(bool condition, int a, int b)
            {
                int x = 0;
                if (condition)
                {
                    x = a;
                }
                else
                {
                    x = b;
                }
                return x;
            }
    
            static public bool IIF(bool condition, bool a, bool b)
            {
                bool x = false;
                if (condition)
                {
                    x = a;
                }
                else
                {
                    x = b;
                }
                return x;
            }
    
            static public Single IIF(bool condition, Single a, Single b)
            {
                float x = 0;
                if (condition)
                {
                    x = a;
                }
                else
                {
                    x = b;
                }
                return x;
            }
    
            static public Double IIF(bool condition, double a, double b)
            {
                double x = 0;
                if (condition)
                {
                    x = a;
                }
                else
                {
                    x = b;
                }
                return x;
            }
    
            static public decimal IIF(bool condition, decimal a, decimal b)
            {
                decimal x = 0;
                if (condition)
                {
                    x = a;
                }
                else
                {
                    x = b;
                }
                return x;
            }

    inser, 03 Марта 2011

    Комментарии (34)
  10. Pascal / Говнокод #5807

    +131

    1. 1
    if (Edit40.Text<>t1) and (Edit38.Text<>t1) and (Edit36.Text<>t1) and (Edit34.Text<>t1) and (Edit32.Text<>t1) and (Edit30.Text<>t1) and (Edit28.Text<>t1) and (Edit26.Text<>t1) and (Edit24.Text<>t1) and (Edit22.Text<>t1) and (Edit20.Text<>t1) and (Edit18.Text<>t1) and (Edit16.Text<>t1) and (Edit14.Text<>t1) and (Edit12.Text<>t1) and (Edit10.Text<>t1) and (Edit8.Text<>t1) and (Edit6.Text<>t1) and (Edit4.Text<>t1) and (edit2.Text<>t1) ...

    Старый мем с форума:
    "Здрасте, вообщем такая проблемка:
    У меня Unit10.pas занимает 13378 КБ (13.0 МБ)
    И при работе в коде 10 формы после 5-10 изменений делфи начинает виснуть на 5-20 сек. (приходится вырезать весь текс кроме нужной процедуры и т.д, вставлять в блокнот, писать процедуру и затем обратно вставлять в делфи вырезанный текст из блокнота).
    И компелируется тож долговато.
    Всего 59988 строк.
    На строчке 400-500 знаков (эт только там где условие, но часть условия(для удобства) переходит на 2 строчку (если все вместить, то будет примерно 35000 строк))
    ____________________________________
    Постараюсь нормально сформулировать что хочу сделать.
    Есть часть условия:
    (код выше. прим. ReallyBugMeNot)
    ____________________________________
    Оно повторяется если быть точным 4200 раз.
    Изменяются только "номера\имена" эдитов (только четные от 2 до 240) и "t1" (t2, t3, t4, .. ,t35).
    Хотелось бы задать переменную (Например "Z") и присвоить ей это условие, но так чтобы переменные "t1, t2, t3, .. ,t35)" и "имена\номера" эдитов задавались в каждой процедуре (всего 6 процедур), где находится оставшееся часть условия.
    Можите подсказать как мне это реализовать?
    Зарание спс."

    Остается только удивлятся терпеливости человека, который позволил исходнику разростись до тринадцати мегов, прежде чем заметил, что что то не так.

    ReallyBugMeNot, 25 Февраля 2011

    Комментарии (29)
  11. Куча / Говнокод #5761

    +131

    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
    <html>
    <head>
    <title>Красивое облао тегов</title> 
    <script type="text/javascript" src="swfobject.js"></script>
    </head>
    <body>
    
    <div id="tags">
    
    <?php
    $tags = '<tags>
    <a href="http://Wincert.ru" style="font-size: 15pt">Wincert</a>
    <a href="http://W-blog.ru" style="font-size: 15pt">Мой блог</a>
    <a href="http://cssor.ru" style="font-size: 15pt">Крутой сайт о CSS</a>
    <a href="http://Wincert.ru" style="font-size: 15pt">Веб разработчик</a>
    <a href="http:// W-blog.ru" style="font-size: 15pt">Интересное</a>
    </tags>';
    ?>
    Для корректного отображения этого элемента вам необходимо установить FlashPlayer и включить в браузере Java Script.
    <script type="text/javascript">
    var rnumber = Math.floor(Math.random()*9999999);
    var widget_so = new SWFObject("tagcloud.swf?r="+rnumber, "tagcloudflash", "230", "140", "9", "#ffffff");
    widget_so.addParam("allowScriptAccess", "always");widget_so.addVariable("tcolor", "0x333333");
    widget_so.addVariable("tspeed", "115");
    widget_so.addVariable("distr", "true");
    widget_so.addVariable("mode", "tags");
    widget_so.addVariable("tagcloud", "<?php echo urlencode($tags); ?>");
    widget_so.write("tags");</script> 
    
    </div>
    
    </body>
    </html>

    qbasic, 22 Февраля 2011

    Комментарии (7)