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

    В номинации:
    За время:
  2. Pascal / Говнокод #549

    +152

    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
    if currIndex=2 then
          begin
          // разкрываем выделенные узлы
            TreeView_U.Items[r].Expanded:=true;
            if TreeView_U.Items[r].Parent <> nil then
            begin
              TreeView_U.Items[r].Parent.Expanded:=true;
              if TreeView_U.Items[r].Parent.Parent <> nil then
              begin
                TreeView_U.Items[r].Parent.Parent.Expanded:=true;
                if TreeView_U.Items[r].Parent.Parent.Parent <> nil then
                TreeView_U.Items[r].Parent.Parent.Parent.Expanded:=true;
              end;
            end;

    Наткнулся тут в прокете. Поначалу просто кусок закоментировал не разбираясь, потому что просто не нужен. Суть - попытка раскрыть полностью ветвь дерева, если в ней есть хоть один выбранный (с помеченным чекбоксом) элемент, о чём говорит currIndex=2.
    Весь офис валяется под столами :)))

    guest, 13 Февраля 2009

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    void NaturNum (unsigned N)
    {
      if (N) printf("%i \n", N);
      if (N > 0) NaturNum (N-1);
    }

    Лекция, тема про рекурсивные функции, функция вывода ряда натуральных чисел. Институт между прочим. Пары посещаем ради лулзов :).

    PS Препод принципиально не пишет cin и cout.

    guest, 10 Февраля 2009

    Комментарии (5)
  4. PHP / Говнокод #517

    +143

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function lol ($lol)
    {
      echo $lol;
    }
    
    $lol = 'lol';
    lol ($lol);

    lol

    guest, 09 Февраля 2009

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

    +110.7

    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
    if (typ == 4)	// Это ножницы
                            if (mirror == 0)
                                Size_N = " " + (beems[1].LenghtE - (int)dd[0]["value"]).ToString() + "0";
                            else
                                Size_N = " " + (mirror - (beems[1].LenghtE - (int)dd[0]["value"])).ToString() + "0";
                        else
                        {			// Это механизм
                            if (typ == 0 || typ == 2 || typ == 3)
                            {
                                if (mirror == 0)
                                    Size_M = (((int)tRow["len"] / 2 + (beems[0].LenghtE / 2 - (int)dd[0]["value"]))).ToString() + "0";
                                else
                                    Size_M = (mirror - ((int)tRow["len"] / 2 + (beems[0].LenghtE / 2 - (int)dd[0]["value"]))).ToString() + "0";
                            }
                            else
                                if (mirror == 0)
                                    Size_M = (beems[0].LenghtE - (int)dd[0]["value"]).ToString() + "0";
                                else
                                    Size_M = (mirror - (beems[0].LenghtE - (int)dd[0]["value"])).ToString() + "0";
    
                            if (typ == 0 || typ == 2 || typ == 3)
                            {
                                if (mirror == 0)
                                    Size_M += " " + (beems[0].LenghtE - (int)dd[0]["value"] * 2).ToString() + "0";
                                else
                                    Size_M += " " + (mirror - (beems[0].LenghtE - (int)dd[0]["value"] * 2)).ToString() + "0";
                            }
                            else
                                Size_M += " 0";
                        }

    Формирование чего то для чего то..

    guest, 09 Февраля 2009

    Комментарии (5)
  6. PHP / Говнокод #515

    +189.5

    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
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    $r1=mt_rand(0,9);
    $r2=mt_rand(0,9);
    $r3=mt_rand(0,9);
    $r4=mt_rand(0,9);
    $r5=mt_rand(0,9);
    $r6=mt_rand(0,9);
    $r7=mt_rand(0,9);
    $r8=mt_rand(0,9);
    $r9=mt_rand(0,9);
    $result=$id.$r1.$r2.$r3.$r4.$r5.$r6.$r7.$r8.$r9;
    print $notvalid.$result;
    $rest1=substr($result,0,-14);
    $rest2=substr($result,2,-12);
    $rest3=substr($result,4,-10);
    $rest4=substr($result,6,-8);
    $rest5=substr($result,8,-6);
    $rest6=substr($result,10,-4);
    $rest7=substr($result,12,-2);
    $rest8=substr($result,-1);
    $ddos1=substr($result,1,-13);
    $ddos2=substr($result,3,-11);
    $ddos3=substr($result,5,-9);
    $ddos4=substr($result,7,-7);
    $ddos5=substr($result,9,-5);
    $ddos6=substr($result,11,-3);
    $ddos7=substr($result,13,-1);
    $dos1=$rest1*2;
    $dos2=$rest2*2;
    $dos3=$rest3*2;
    $dos4=$rest4*2;
    $dos5=$rest5*2;
    $dos6=$rest6*2;
    $dos7=$rest7*2;
    $dos8=$rest8*2;
    if ($dos1>=10) {
    $doss1=$dos1-9;
    } else {
    $doss1=$dos1;
    }
    if ($dos2>=10) {
    $doss2=$dos2-9;
    } else {
    $doss2=$dos2;
    }
    if ($dos3>=10) {
    $doss3=$dos3-9;
    } else {
    $doss3=$dos3;
    }
    if ($dos4>=10) {
    $doss4=$dos4-9;
    } else {
    $doss4=$dos4;
    }
    if ($dos5>=10) {
    $doss5=$dos5-9;
    } else {
    $doss5=$dos5;
    }
    if ($dos6>=10) {
    $doss6=$dos6-9;
    } else {
    $doss6=$dos6;
    }
    if ($dos7>=10) {
    $doss7=$dos7-9;
    } else {
    $doss7=$dos7;
    }
    if ($dos8>=10) {
    $doss8=$dos8-9;
    } else {
    $doss8=$doss8;
    }
    $res1=$doss1+$doss2+$doss3+$doss4+$doss5+$doss6+$doss7+$doss8;
    $res2=$ddos1+$ddos2+$ddos3+$ddos4+$ddos5+$ddos6+$ddos7;
    $rez=$res1+$res2;
    print $magic.$rez.'<br>';
    $d=$rez%10;
    if ($d==0) {
    print $valid.$result.$d;
    } else {
    $k1=$rez+1;
    $k2=$rez+2;
    $k3=$rez+3;
    $k4=$rez+4;
    $k5=$rez+5;
    $k6=$rez+6;
    $k7=$rez+7;
    $k8=$rez+8;
    $k9=$rez+9;

    ааааа пиздец!!!11

    guest, 08 Февраля 2009

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

    +153

    1. 1
    2. 2
    3. 3
    Bool IsNumber (string str) {
    return (str.Replace ("0", "").Replace ("1", "").Replace ("2", "").Replace ("3", "").Replace ("4", "").Replace ("5", "").Replace ("6", "").Replace ("7", "").Replace ("8", "").Replace ("9", "").Length == 0);
    }

    Где-то находил. Вроде это на Java

    guest, 08 Февраля 2009

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

    +140.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #include <numeric>
    #include <algorithm>
    #include <iostream>
    #include <functional>
    #include <boost/iterator/counting_iterator.hpp>
    
    int main()
    {
      std::cout << std::accumulate(boost::make_counting_iterator(2), boost::make_counting_iterator(8), 1, std::multiplies<int>());
      return 0;
    }

    guest, 05 Февраля 2009

    Комментарии (5)
  9. PHP / Говнокод #502

    +153.8

    1. 1
    2. 2
    3. 3
    4. 4
    for($i=0;$i<10;$i++){
    			$tf2[rand(0,count($tf2)-1)][2]-=$tf1[rand(0,count($tf1)-1)][1];
    			$tf1[rand(0,count($tf1)-1)][2]-=$tf2[rand(0,count($tf2)-1)][1];
    		}

    Долго не мог понять, что этот кусок делает.

    guest, 04 Февраля 2009

    Комментарии (5)
  10. PHP / Говнокод #486

    +157.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    {?$i=0;}
    {foreach from=explode(',',$item.tags) item="tag"}
    <a href="/{_ LANG}/tv,translations?tag={$tag|escape}">{$tag|escape}</a>{if $i < (count(explode(',',$item.tags)) - 1)},&nbsp; {/if} 
    {?$i++}
    {/}

    No comments.

    guest, 31 Января 2009

    Комментарии (5)
  11. Си / Говнокод #478

    +108.6

    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
    void init()
    {
      int i;
    
      for(i=0;i<4;i++)
        ALG_RxConst[i] = -1;
    
      for(i=0;i<4;i++)
        ALG_TxConst[i] = -1;
    
      for(i=0;i<4;i++)
        ALG_EqInfo[i][0] = 0;
    
      for(i=0;i<4;i++)
        ALG_EqInfo[i][1] = -1;
    
      for(i=0;i<4;i++)
        ALG_EqInfo[i][2] = -1;
    }

    Индусу очень-очень нравится for ;)

    guest, 29 Января 2009

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