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

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

    +102

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    switch (occupation.name)
    {
    	case "architecture and engineering occupations:":
    		if (occupation.isNB)
    		{
    			if (occupation.maleId == ex_nb_id)
    			{
    				model.ArchitectureAndEngineeringOccupationsMalePercentageNB = occupation.percent;
    			}
    			if (occupation.femaleId == ex_nb_id)
    			{
    				model.ArchitectureAndEngineeringOccupationsFemalePercentageNB = occupation.percent;
    			}
    		}
    		else
    		{
    			if (occupation.maleId == ex_city_id)
    			{
    				model.ArchitectureAndEngineeringOccupationsMalePercentageCity = occupation.percent;
    			}
    			if (occupation.femaleId == ex_city_id)
    			{
    				model.ArchitectureAndEngineeringOccupationsFemalePercentageCity = occupation.percent;
    			}
    		}
    	break;
    
    	case "arts, design, entertainment, sports, and media occupations:":
    		if (occupation.isNB)
    		{
    			if (occupation.maleId == ex_nb_id)
    			{
    				model.ArtsDesignEntertainmentSportsAndMediaOccupationsMalePercentageNB = occupation.percent;
    			}
    			if (occupation.femaleId == ex_nb_id)
    			{
    				model.ArtsDesignEntertainmentSportsAndMediaOccupationsFemalePercentageNB = occupation.percent;
    			}
    		}
    		else
    		{
    			if (occupation.maleId == ex_city_id)
    			{
    				model.ArtsDesignEntertainmentSportsAndMediaOccupationsMalePercentageCity = occupation.percent;
    			}
    			if (occupation.femaleId == ex_city_id)
    			{
    				model.ArtsDesignEntertainmentSportsAndMediaOccupationsFemalePercentageCity = occupation.percent;
    			}
    		}
    	break;
    
    	case "business and financial operations occupations:":
    		if (occupation.isNB)
    		{
    			if (occupation.maleId == ex_nb_id)
    			{
    				model.BusinessAndFinancialOperationsOccupationsMalePercentageNB = occupation.percent;
    			}
    			if (occupation.femaleId == ex_nb_id)
    			{
    				model.BusinessAndFinancialOperationsOccupationsFemalePercentageNB = occupation.percent;
    			}
    		}
    		else
    		{
    			if (occupation.maleId == ex_city_id)
    			{
    				model.BusinessAndFinancialOperationsOccupationsMalePercentageCity = occupation.percent;
    			}
    			if (occupation.femaleId == ex_city_id)
    			{
    				model.BusinessAndFinancialOperationsOccupationsFemalePercentageCity = occupation.percent;
    			}
    		}
    	break;
    
    	case "community and social services occupations:":
    		if (occupation.isNB)
    		{
    			if (occupation.maleId == ex_nb_id)
    			{
    				model.CommunityAndSocialServicesOccupationsMalePercentageNB = occupation.percent;
    			}
    			if (occupation.femaleId == ex_nb_id)
    			{
    				model.CommunityAndSocialServicesOccupationsFemalePercentageNB = occupation.percent;
    			}
    		}
    		else
    		{
    			if (occupation.maleId == ex_city_id)
    			{
    				model.CommunityAndSocialServicesOccupationsMalePercentageCity = occupation.percent;
    			}
    			if (occupation.femaleId == ex_city_id)
    			{
    				model.CommunityAndSocialServicesOccupationsFemalePercentageCity = occupation.percent;
    			}
    		}

    эх жаль здесь ограничение на 100 строк всего лишь...не поместилось всего 200+ отборного ветвления. известный до боли мегапрограммер наваял очередной шедевр)))) по мотивам http://govnokod.ru/10448 и http://govnokod.ru/10313 и еще http://govnokod.ru/12136...

    mangyst, 29 Ноября 2012

    Комментарии (23)
  3. Java / Говнокод #12125

    +98

    1. 1
    2. 2
    3. 3
    public String toString() {
            return new String(body.toString());
        }

    Но зачем?

    3.14159265, 14 Ноября 2012

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

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(Normal(Pawn.Acceleration) Dot Vect(1,0,0) > 0)
          {
             tempRot.Yaw = 0;
             Pawn.SetRotation(tempRot);
          }

    Из туториала по UDK. Почему просто не написать Pawn.Acceleration > 0 ?

    tirinox, 12 Ноября 2012

    Комментарии (23)
  5. Куча / Говнокод #12074

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    infixr 6 `then'`
    then' True = fst
    then' False = snd
    if' = id
    else' suc fail = (suc, fail)
    main = do
        print $ if' (1<5) `then'` "true" `else'` "false"
        print $ if' False `then'` "true" `else'` "false"

    bormand
    У ифа особый синтаксис. Как ты его реализуешь?
    Challenge accepted:
    Сначала был тред
    http://govnokod.ru/12068#comment159236
    а потом родилось говно:
    http://ideone.com/rOKDPP
    Реализовал if. За правильными приоритетами операций и ассоциативностью не следил.

    HaskellGovno, 07 Ноября 2012

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

    +122

    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
    data IdPState a r = IdPEnd r | IdPNeedInput | IdPHaveInput a
    {-# INLINE_STREAM idP #-}
    idP :: (Monad m) => Stream l a a r m r
    idP = Stream next IdPNeedInput where
    	{-# INLINE_INNER next #-}
    	next (IdPEnd r) = Done r
    	next IdPNeedInput = NeedInput IdPHaveInput IdPEnd
    	next (IdPHaveInput a) = HaveOutput IdPNeedInput (return ()) a
    
    {-# INLINE_STREAM pipe #-}
    pipe :: Monad m => Stream l a b r0 m r1 -> Stream Void b c r1 m r2 -> Stream l a c r0 m r2
    pipe (Stream nextL sL) (Stream nextR sR) = Stream next (Right (return (), sL, Right sR)) where
    	{-# INLINE_INNER next #-}
    	next (Left r) = Done r
    	next (Right (final, sL, Right sR)) = case nextR sR of
    		Skip sR' -> Skip (Right (final, sL, Right sR'))
    		HaveOutput sR' c o -> HaveOutput (Right (final, sL, Right sR')) (c >> final) o
    		NeedInput p c -> Skip (Right (final, sL, Left (p, c)))
    		Done r -> PipeM (final >> return (Left r))
    		PipeM ms -> PipeM (liftM (Right . (final, sL,) . Right) ms)
    		Leftover _ i -> absurd i
    	next (Right (final, sL, Left (p, c))) = case nextL sL of
    		Skip sL' -> Skip (Right (final, sL', Left (p, c)))
    		HaveOutput sL' final' o -> Skip (Right (final', sL', Right (p o)))
    		NeedInput pL cL -> NeedInput (Right . (final,, Left (p, c)) . pL) (Right . (final,, Left (p, c)) . cL)
    		Done r -> Skip (Right (return (), sL, Right (c r)))
    		PipeM ms -> PipeM (liftM (Right . (final,, Left (p, c))) ms)
    		Leftover sL' i -> Leftover (Right (final, sL', Left (p, c))) i
    
    {-# INLINE_STREAM purePipe #-}
    purePipe :: (forall m . Monad m => Stream l a b r0 m r1) -> (forall m . Monad m => Stream Void b c r1 m r2) -> (forall m . Monad m => Stream l a c r0 m r2)
    purePipe (Stream nextL sL) (Stream nextR sR) = Stream next (sL, Right sR) where
    	{-# INLINE_INNER next #-}
    	next (sL, Right sR) = case nextR sR of
    		Skip sR' -> Skip (sL, Right sR')
    		HaveOutput sR' _ o -> HaveOutput (sL, Right sR') (return ()) o
    		NeedInput p c -> Skip (sL, Left (p, c))
    		Done r -> Done r
    		PipeM ms -> Skip (sL, Right (runIdentity ms))
    		Leftover _ i -> absurd i
    	next (sL, Left (p, c)) = case nextL sL of
    		Skip sL' -> Skip (sL', Left (p, c))
    		HaveOutput sL' _ o -> Skip (sL', Right (p o))
    		NeedInput pL cL -> NeedInput ((, Left (p, c)) . pL) ((, Left (p, c)) . cL)
    		Done r -> Skip (sL, Right (c r))
    		PipeM ms -> Skip (runIdentity ms, Left (p, c))
    		Leftover sL' i -> Leftover (sL', Left (p, c)) i

    qbasic, 03 Ноября 2012

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

    +42

    1. 1
    2. 2
    3. 3
    4. 4
    objbase.h:
    
    #define __STRUCT__ struct
    #define interface __STRUCT__

    спасибо Микрософт за счастливое детство соответствие стандарту при засирании глобального неймспейса своими больными фантазиями

    defecate-plusplus, 03 Октября 2012

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

    +141

    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
    public string Search(string title)
     {
     List<string> str1 = new List<string>();
     string count = cmainlibrary.Count.ToString();
     int counter = Convert.ToInt32(count);
     int i = 0;
    
     for ( i = 0; i < counter; i++)
     {
     string title_library = cmainlibrary[i].Title.ToString();
     if (title.ToUpper().Contains(title_library. ToUpper()))
     {
     str1.Add(cmainlibrary[i].Title);
    
     }
     }
     return str1[i];
     }

    Хотя я это выкладывал в коментариях к говнокоду #11830, решил повеселить народ отдельным постом.
    Это реализация библиотеки книг. Метод должен искать список книг которые соответствуют title.

    sater, 25 Сентября 2012

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

    +42

    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
    std::string loc =
    	( {
    		const char *str = "";
    
    		switch (location) {
    		case Net::HANDSHAKE_TIMEOUT:
    			str = _(" due to handshake timeout");
    			break;
    		case Net::RECV_HANDSHAKE:
    			str = _(" while waiting for handshake");
    			break;
    		case Net::HANDSHAKE_DATA:
    			str = _(" due to unsupported handshake data");
    			break;
    		case Net::HANDSHAKE_AUTH:
    			str = _(" while parsing handshake data");
    			break;
    		case Net::WAIT_DEVICE:
    			str = _(" while waiting for device");
    			break;
    		case Net::TRANSFER_DATA:
    			str = _(" while transferring data");
    			break;
    		}
    		str;
    	});

    Я хуею с юных оптимизаторов.

    gvy, 28 Августа 2012

    Комментарии (23)
  10. C# / Говнокод #11372

    +133

    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 ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text) |
        (textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text) |
        (textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text) |
        (textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text) |
        (textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text) |
        (textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text) |
        (textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text) |
        (textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text) |
        (textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) ;
    else
    }
       label1.Visible = true;
       label2.Visible = true;
    }

    Это эпик.

    Fai, 07 Июля 2012

    Комментарии (23)
  11. PHP / Говнокод #11312

    +65

    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
    92. 92
    93. 93
    94. 94
    $quGroup = mysql_query($x = "
            SELECT
                a.latitude, a.longitude, a.catid, a.id, a.title, a.arttype, a.userid, b.firstname, b.lastname, b.usertype,
                a.latitude2, a.longitude2, a.latitude3, a.longitude3, a.latitude4, a.longitude4, a.latitude5, a.longitude5,
                a.latitude6, a.longitude6, a.latitude7, a.longitude7, a.latitude8, a.longitude8, a.latitude9, a.longitude9,
                a.latitude10, a.longitude10, a.latitude11, a.longitude11
            from materials a, users b
            where a.status='1' and a.userid=b.id and add_date > $day)
            $sql_cond");
        while ($flGroup = mysql_fetch_row($quGroup)) {
            $j++;
            $a1 = $a2 = array ();
            $l1 = $flGroup[0];
            $l2 = $flGroup[1];
            if ($l1 && $l2) {
                $a1[] = $l1;
                $a2[] = $l2;
            }
    
            $latitude2 = $flGroup[10];
            $longitude2 = $flGroup[11];
            if ($latitude2 && $longitude2) {
                $a1[] = $latitude2;
                $a2[] = $longitude2;
            }
    
            $latitude3 = $flGroup[12];
            $longitude3 = $flGroup[13];
            if ($latitude3 && $longitude3) {
                $a1[] = $latitude3;
                $a2[] = $longitude3;
            }
    
            $latitude4 = $flGroup[14];
            $longitude4 = $flGroup[15];
            if ($latitude4 && $longitude4) {
                $a1[] = $latitude4;
                $a2[] = $longitude4;
            }
    
            $latitude5 = $flGroup[16];
            $longitude5 = $flGroup[17];
            if ($latitude5 && $longitude5) {
                $a1[] = $latitude5;
                $a2[] = $longitude5;
            }
    
            $latitude6 = $flGroup[18];
            $longitude6 = $flGroup[19];
            if ($latitude6 && $longitude6) {
                $a1[] = $latitude6;
                $a2[] = $longitude6;
            }
    
            $latitude7 = $flGroup[20];
            $longitude7 = $flGroup[21];
            if ($latitude7 && $longitude7) {
                $a1[] = $latitude7;
                $a2[] = $longitude7;
            }
    
            $latitude8 = $flGroup[22];
            $longitude8 = $flGroup[23];
            if ($latitude8 && $longitude8) {
                $a1[] = $latitude8;
                $a2[] = $longitude8;
            }
    
            $latitude9 = $flGroup[24];
            $longitude9 = $flGroup[25];
            if ($latitude9 && $longitude9) {
                $a1[] = $latitude9;
                $a2[] = $longitude9;
            }
    
            $latitude10 = $flGroup[26];
            $longitude10 = $flGroup[27];
            if ($latitude10 && $longitude10) {
                $a1[] = $latitude10;
                $a2[] = $longitude10;
            }
    
            $latitude11 = $flGroup[28];
            $longitude11 = $flGroup[29];
            if ($latitude11 && $longitude11) {
                $a1[] = $latitude11;
                $a2[] = $longitude11;
            }
    
            if (!$l1 && !$l2 && !$latitude2 && !$longitude2 && !$latitude3 && !$longitude3 && !$latitude4 && !$longitude4 && !$latitude5 && !$longitude5 && !$latitude6 && !$longitude6 && !$latitude7 && !$longitude7 && !$latitude8 && !$longitude8 && !$latitude9 && !$longitude9 && !$latitude10 && !$longitude10 && !$latitude11 && !$longitude11)
                continue;
    
    ...
    }

    как изящно

    shmaltorhbooks, 28 Июня 2012

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