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

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

    +85

    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
    pocedure TForm1.line(x, y, N: integer; l: real; d: boolean);
    var
      x1,x2,x3,x4,y1,y2,y3,y4: integer;
      begin
        if l>2 then
          begin
              if d then
                case N  of
                  1: begin
                        x1:=x; y1:=y;
                        x2:=x1; y2:=y1-round(1);
                        x3:=x1+round(1); y3:=y1-round(1);
                        x4:=x1+round(1); y4:=y1;
                  end;
                  2: begin
                        x2:=x; y2:=y;
                        x1:=x2; y1:=y2+round(1);
                        x3:=x2+Round(1); y3:=y2;
                        x4:=x2+Round(1); y4:=y2+round(1);
                     end;
                  3: begin
                        x3:=x; y3:=y;
                        x1:=x3-round(1); y1:=y3+round(1);
                        x2:=x3-round(1); y2:=y3;
                        x4:=x2+round(1); y4:=y2+round(1);
    
                  end;
                  4: begin
                  x4:=x; y4:=y;
                  x1:=x4-round(1); y1:=y4;
                  x2:=x4-round(1); y2:=y4-round(1);
                  x3:=x4; y3:=y4-round(1);
                  end;
                end
                else
                 case N  of
                  1: begin
                        x1:=x; y1:=y;
                        x2:=x1; y2:=y1+round(1);
                        x3:=x1+round(1); y3:=y1+round(1);
                        x4:=x1+round(1); y4:=y1;
                  end;
                  2: begin
                        x2:=x; y2:=y;
                        x1:=x2; y1:=y2-round(1);
                        x3:=x2-Round(1); y3:=y2;
                        x4:=x2-Round(1); y4:=y2-round(1);
                     end;
                  3: begin
                        x3:=x; y3:=y;
                        x1:=x3+round(1); y1:=y3-round(1);
                        x2:=x3+round(1); y2:=y3;
                        x4:=x2-round(1); y4:=y2-round(1);
    
                  end;
                  4: begin
                  x4:=x; y4:=y;
                  x1:=x4+round(1); y1:=y4;
                  x2:=x4+round(1); y2:=y4+round(1);
                  x3:=x4; y3:=y4+round(1);
                  end;
                end;
                with Canvas do
                  begin
                    Pen.Color :=RGB(Random(256),Random(256),Random(256));
                    MoveTo(x1,y1);
                    LineTo(x2,y2);
                    LineTo(x3,y3);
                    LineTo(x4,y4);
                    LineTo(x1,y1);
                    Brush.Color:=Pen.Color;
                    FloodFill((x2+x3) div 2, (y2+y1) div 2, Pen.Color,fsBorder);
                    if l=200 then line (x1,y1,1,1/2, not d);
                    if n<>1 then line (x1,y1,1,1/2, not d);
                    if n<>2 then line (x2,y2,2,1/2, not d);
                    if n<>3 then line (x3,y3,3,1/2, not d);

    угадайте...:D

    ChakuZa, 24 Августа 2009

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

    +126.9

    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
    else
    																		{
    																			if ((index == 103))
    																			{//bla
    																			}
    																			else
    																			{
    																				if ((index == 104))
    																				{//bla
    																				}
    																			}
    																		}
    																	}
    																}
    															}
    														}
    													}
    												}
    											}
    										}
    									}
    								}
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    }                                                                                                                                                                                                                                                                                                                                                        } }}}}}}}}}}}}}}}}}}}}}}}}}

    Конец однородного файла (В моем маленьком случае 300Kb) сгенерированным Microsoft EdmGen.

    62316e, 24 Августа 2009

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

    +154

    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
    <?
    function clearComma($str)
    {
      $str = preg_replace("#(,|\.|-|\/|:|;|\"|'|\?|\(|\)|\\|*)#", '', $str);
      return $str;
    }
    function generate($bold_o, $bold_c)
    {
      $art = file_get_contents('article.txt');
      $voc_str_mass = file('voc.txt');
      $key = file('key.txt');
      foreach ($key as $word)
      {
        $keys[] = trim($word);
      }
      foreach ($voc_str_mass as $voc_str)
      {
        $voc[] = explode("\t", trim($voc_str));
      }
      $words_massive = explode(' ', clearComma($art));
      foreach ($words_massive as $word)
      {
        if (strlen($word) > 3)
        {
          foreach ($voc as $check)
          {
            if (in_array($word, $check) && $word != 'keyword')
            {
              $c = count($check);
              $art = str_replace($word, $check[rand(0, $c - 1)], $art);
            }
          }
        }
      }
      $art_mass = explode(' ', $art);
      foreach ($art_mass as $string)
      {
        $art_out .= str_replace('keyword', $bold_o . $keys[rand(0, count($keys) - 1)] . $bold_c, $string) . ' ';
      }
      return $art_out;
    }
    //echo(generate('<b>', '</b>'));
    //exit();
    $tpl_mass = file("tpl.tpl");
    foreach ($tpl_mass as $tpl_string)
    {
      $template .= str_replace('{GENERATE}', generate('<b>', '</b>'), $tpl_string);
    }
    //$date = date(d).'-'.date(m).'-'.date(Y).'_'.date(H).'-'.date(i).'-'.date(s);
    $handle = fopen($date . '_generated.html', "w");
    fwrite($handle, $template);
    fclose($handle);
    ?>

    ну тут тока матом если...

    пгуые, 20 Августа 2009

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

    +170.5

    1. 1
    2. 2
    $menu=new menu;
    $menu->menu=$menu->menu($menu_arr); // Меню

    Человек знал толк в ООП

    alesha, 19 Августа 2009

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

    +27

    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
    template<class T>
    class TAbstractObject
    {
    private:
    	T Value;
    public:
    	bool operator==(TAbstractObject& Obj);
    };
    
    ...
    
    template<class T>
    bool TAbstractObject<T>::operator==(TAbstractObject<T>& Obj)
    {
    	...
    	Value++;
    	...
    };

    Код в мешке...

    Говногость, 19 Августа 2009

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

    +32.2

    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
    class TString
    {
    public:
    	...
    	char len;
    };
    ...
    int GetWidth(TString& str)
    {
    	if(&str==NULL)
    		return 0;
    	return str.len;
    };

    Мрахахаха(фр)хахаха.

    Говногость, 19 Августа 2009

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

    +164.1

    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
    /**
    function.php
    */
    function result($selected, $sources, $date_from, $date_till, $step)
    {
      $ret = $header = array();
      if (is_array($selected) and count($selected))
      {
        foreach ($selected as $item=>$value)
        {
          if ('on' == $value)
          {
            $header[$item] = $sources[$item]['name'];
            if (isset($sources[$item]['db_host']))
            {
              // external db
              class DB_EXT extends DB
              {
    .......

    объявление класса внутри цикла внутри функции!!
    рыдааййууу

    shitcoder, 18 Августа 2009

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

    +147.8

    1. 1
    2. 2
    3. 3
    4. 4
    if ($i++%2==0)
            $bgc='#eeeeee';
        else
            $bgc='#cccccc';

    Самое интересное, что инкремент производится после прохождения проверки

    p0dl0m, 17 Августа 2009

    Комментарии (7)
  10. Ruby / Говнокод #1603

    −145.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    # I really hate Western week system (0 - sunday, 6 - saturday),
          # maybe it is better, but this crap is incompatible with
          # Russian week system (0 - monday, 6 - sunday)
          wday = date.wday - 1
          wday = 6 if wday == -1

    Кусок кода из реализации расписания с календарём в текущем проекте.

    Только что оказалось, что для этого как раз есть метод Date#cwday :)

    eveel, 17 Августа 2009

    Комментарии (7)
  11. ActionScript / Говнокод #1569

    −132.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
    public function showNotAvailableAlert(str:String):void
    {
    	var defString:String = str = "Connection with server is lost. Unfortunately you can not continue now. Please try later.";
    	if(str)
    	{
    		Alert.show(str, "Not connected to server");
    	}
    	else
    	{
    		Alert.show(defString, "Not connected to server");
    	}
    }

    Kuros, 13 Августа 2009

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