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

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

    +25

    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
    if (delitel.number.at(0) == '0')
                         {
                             chastnoe.number.push_back('D');
                             chastnoe.number.push_back('e');
                             chastnoe.number.push_back('L');
                             chastnoe.number.push_back('e');
                             chastnoe.number.push_back('N');
                             chastnoe.number.push_back('i');
                             chastnoe.number.push_back('e');
                             chastnoe.number.push_back(' ');
                             chastnoe.number.push_back('n');
                             chastnoe.number.push_back('a');
                             chastnoe.number.push_back(' ');
                             chastnoe.number.push_back('0');
     
                             return chastnoe;
                         }

    Из чьей-то реализации длинной арифметики

    west_coast_coders, 08 Февраля 2013

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

    +25

    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
    95. 95
    96. 96
    97. 97
    public OnPlayerSpawn(playerid) {
        IsSpawned[playerid]=1;
        if(Team[playerid]==ZOMBIE) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Zombie~w~. Kill & Infect every Human to complete your mission.");
    	} else if(Team[playerid]==HUMAN) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Human~w~. Prevent Zombie attacks and survive till the end."); }
        TextDrawHideForAll(Box); TextDrawHideForAll(text_Top5[0]); TextDrawHideForAll(text_Top5[1]);
    	TextDrawShowForPlayer(playerid, Textdraw0);	 TextDrawShowForPlayer(playerid, Textdraw1);
    	TextDrawShowForPlayer(playerid, Textdraw2);	 TextDrawShowForPlayer(playerid, Textdraw3);
    	TextDrawShowForPlayer(playerid, Textdraw4);	 TextDrawShowForPlayer(playerid, Textdraw5);
    	TextDrawShowForPlayer(playerid, Textdraw6);	 TextDrawShowForPlayer(playerid, Textdraw7);
    	TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
    	TextDrawShowForPlayer(playerid, Textdraw15); TextDrawShowForPlayer(playerid, Textdraw16[playerid]);
    	SetTeam(playerid); SetClass(playerid); 
    	if(Infection==1) {
            Infection=0;
            if(Totalplayers>=2) {
    			SetTimer("InfectionLoad",0,0);
    		} else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=20) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=30) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=45) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=60) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers<=75) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}
    	} return 1; }

    Серьезно?

    d3n4, 08 Декабря 2012

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

    +25

    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
    template <typename T> struct Pool { static std::vector<T> data; };
    
    std::vector<tbphys::Body> Pool<tbphys::Body>::data;
    std::vector<Ball>         Pool<Ball>        ::data;
    std::vector<Wall>         Pool<Wall>        ::data;
    std::vector<Bat>          Pool<Bat>         ::data;
    std::vector<Brick>        Pool<Brick>       ::data;
    
    template <typename T, typename U> struct List
    {
    	typedef T Head;
    	typedef U Tail;
    };
    
    struct End {};
    
    typedef List<tbphys::Body, List<Brick, List<Bat, List<Ball, List<Wall, End> > > > > Components;
    typedef List<Brick, List<Bat, List<Ball, List<Wall, End> > > > DrawableComponents;
    typedef List<Brick, List<Ball, List<Bat, End> > > MovableComponents;
    
    const size_t badindex = size_t(-1);
    
    struct GameBody
    {
    	size_t self,body,bat,brick,wall,ball;
    
    	template <typename T> size_t& IndexOf ();
    	template <> size_t& IndexOf <tbphys::Body> () {return body;}
    	template <> size_t& IndexOf <Bat  >        () {return bat;}
    	template <> size_t& IndexOf <Brick>        () {return brick;}
    	template <> size_t& IndexOf <Wall >        () {return wall;}
    	template <> size_t& IndexOf <Ball >        () {return ball;}
    
    	template <typename T>
    	T& AddComponent ()
    	{
    		size_t index = Pool<T>::data.size();
    		Pool<T>::data.resize(index+1);
    		T& result = Pool<T>::data[index];
    
    		result.hostIndex = self;	
    		IndexOf<T>() = index;
    		return result;
    	}
    
    	template <typename T> void SetBadIndex ()
    	{
    		IndexOf<T::Head> () = badindex;
    		SetBadIndex<T::Tail> ();
    	}
    	template <> void SetBadIndex <End> () {}
    };

    Сколько тут говнопаттернов крестоблядского крестоязыка?

    TarasB, 22 Октября 2012

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

    +25

    1. 1
    2. 2
    3. 3
    4. 4
    uint32 originalDamage = damage;
    
        if (absorb && originalDamage > damage)
            *absorb += (originalDamage - damage);

    Вытащил из 1 эмулятора игры World of WarCraft

    Heisenberg, 19 Августа 2012

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

    +25

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #ncld<strm.h>
    vd mn()
    {
    ct<<"Hll, wrld!";
    cn.gt();
    }

    Нхй пргрммрвн.

    dos_, 29 Мая 2012

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

    +25

    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
    /*
        Шаг по оси, представляет собой число из следующего ряда:
        ... 0.02 0.05 0.1 0.2 0.5 1 2 5 ...
        next и prev позволяют перемещаться в обе стороны по ряду
        после создания хранится число 1
    */
    class Step
    {
    public:
        Step()
        {
            scale = 1; pr = 1; type=0;
        }
        void next()
        {
            // шаг вперед
            type++;
            if (type==1)
                scale = pr * 2;
            else if (type==2)
                scale = pr * 5;
            else
            {
                type = 0;
                pr *= 10;
                scale = pr;
            }
        }
        void prev()
        {
            // шаг назад
            type--;
            if (type==0)
                scale = pr;
            else if (type==1)
                scale = pr*2;
            else
            {
                type = 2;
                pr /= 10;
                scale = pr*5;
            }
        }
        operator float()
        {
            return scale;
        }
    protected:
        float scale;    // текущее значение
        float pr;       // недомноженое значение 1 10 100 ...
        int type;       // 0 - x1 1 - x2 2 - x5
    };

    http://govnokod.ru/10117 напомнил о том, как я когда-то рисовал график, и для меток на осях потребовались те же самые красивые значения [... 0.1 0.2 0.5 1 2 5 ...]

    bormand, 30 Апреля 2012

    Комментарии (20)
  8. Pascal / Говнокод #424

    +25

    1. 1
    2. 2
    3. 3
    4. 4
    pX := CalcDipol(coord1[index], coord2[index]).X;
    pY := CalcDipol(coord1[index], coord2[index]).Y;
    MoveTo(center.X, center.Y);
    LineTo(pX, pY);

    guest, 19 Января 2009

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

    +25

    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
    if ($sUnitsSQL != '') {
    			$sUnits = '';
    			$sRSSToday = date('j F Y, g:i');
    			//$sDateFormat = '%a, %e %b %Y %k:%i:%s GMT';
    
    			$aPIDOwnerInfo = getProfileInfo($iPID);
    
    			$vUnits = db_res( $sUnitsSQL );
    
    			$iUnitLimitChars = (int)getParam("max_blog_preview");
    			while ( $aUnitInfo = mysql_fetch_assoc($vUnits) ) {
    				/*$aOwnerInfo = getProfileInfo($aUnitInfo['OwnerID']);
    				$aUser = array('Permalink'=>$aOwnerInfo['NickName'], 'Link'=>$aUnitInfo['OwnerID']);
    				$aPost = array('Permalink'=>$aUnitInfo['UnitUri'], 'Link'=>$aUnitInfo['UnitID']);*/
    				$sUnitUrl = $oLinkGenerator->genUrl($aUnitInfo['UnitID'], $aUnitInfo['UnitUri']);
    
    				$sUnitTitle = process_line_output($aUnitInfo['UnitTitle']);
    				$sUnitDate = LocaledDataTime($aUnitInfo['UnitDateTimeUTS']);
    
    				$sLinkMore = '';
    				if ( strlen( $aUnitInfo['UnitDesc']) > $iUnitLimitChars ) {
    					$sLinkMore = "... <a href=\"".$sUnitUrl."\">"._t('_Read more')."</a>";
    				}
    				$sUnitDescVal = mb_substr( strip_tags($aUnitInfo['UnitDesc']), 0, $iUnitLimitChars ) . $sLinkMore;
    				$sUnitDesc = <<<EOF
    Date: {$sUnitDate}<br />
    Description: {$sUnitDescVal}<br />
    EOF;
    
    				$sRSSUnitIcon = '';
    				/*if (false) {
    					$sUnitIcon = (strlen(trim($aUnitInfo['UnitIcon'])) && file_exists($dir['sdatingImage'] . $aUnitInfo['UnitIcon']))
    						? "{$site['sdatingImage']}thumb_{$aUnitInfo['UnitIcon']}" : $oLinkGenerator->sPicNotAvail;
    					$sRSSUnitIcon = "<image>{$sUnitIcon}</image>";
    				}*/
    
    				$sUnitRSSFeed .= <<<EOF
    <item>
    	<title><![CDATA[{$sUnitTitle}]]></title>
    	{$sRSSUnitIcon}
    	<link><![CDATA[{$sUnitUrl}]]></link>
    	<description><![CDATA[{$sUnitDesc}]]></description>
    	<pubDate>{$sUnitDate}</pubDate>
    </item>
    EOF;
    			}
    
    			$sRSSTitle = "{$sUnitTypeC} RSS";
    			if ($iPID>0) {
    				$sRSSTitle = $aPIDOwnerInfo['NickName'] . "'s Recent {$sUnitTypeC}";
    			}
    
    			$sRet = <<<EOF
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0">
    	<channel>
    		<title>{$sRSSTitle}</title>
    		<link>{$site['url']}{$sMainLink}</link>
    		<description>{$sRSSTitle}</description>
    		<lastBuildDate>{$sRSSToday}</lastBuildDate>
    			{$sUnitRSSFeed}
    	</channel>
    </rss>
    EOF;
    			return $sRet;
    		}

    Как Вам такой стиль написания кода?

    guest, 07 Января 2009

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

    +25

    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
    private void OnRdbDatesCheckedChanged(object sender, EventArgs e)
    {
                if (rdbMonth.Checked)
                    MakeDateViewVisible("month");
                else if (rdbQuarter.Checked)
                    MakeDateViewVisible("quarter");
                else if (rdbYear.Checked)
                    MakeDateViewVisible("year");
                else
                    MakeDateViewVisible("individual");
    }
    
    private void MakeDateViewVisible(string dateView)
    {
                switch (dateView)
                {
                    case "year":
                        YearView.Visible = true;
                        QuarterView.Visible = false;
                        MonthView.Visible = false;
                        IndividualDatesView.Visible = false;
                        break;
                    case "quarter":
                        YearView.Visible = false;
                        QuarterView.Visible = true;
                        MonthView.Visible = false;
                        IndividualDatesView.Visible = false;
                        break;
                    case "month":
                        YearView.Visible = false;
                        QuarterView.Visible = false;
                        MonthView.Visible = true;
                        IndividualDatesView.Visible = false;
                        break;
                    case "individual":
                        YearView.Visible = false;
                        QuarterView.Visible = false;
                        MonthView.Visible = false;
                        IndividualDatesView.Visible = true;
                        break;
                }
    }

    Зато красиво методы вызываются!

    guest, 07 Января 2009

    Комментарии (14)
  11. C# / Говнокод #294

    +25

    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
    private string RemoveNonAlphaChars(string txt)
    {
    string returnText = txt;
    
    returnText = returnText.Replace("~", "");
    returnText = returnText.Replace("`", "");
    returnText = returnText.Replace("!", "");
    returnText = returnText.Replace("@", "");
    returnText = returnText.Replace("#", "");
    returnText = returnText.Replace("$", "");
    returnText = returnText.Replace("%", "");
    returnText = returnText.Replace("^", "");
    returnText = returnText.Replace("&", "");
    returnText = returnText.Replace("*", "");
    returnText = returnText.Replace("(", "");
    returnText = returnText.Replace(")", "");
    returnText = returnText.Replace("-", "");
    returnText = returnText.Replace("_", "");
    returnText = returnText.Replace("+", "");
    returnText = returnText.Replace("=", "");
    returnText = returnText.Replace("{", "");
    returnText = returnText.Replace("}", "");
    returnText = returnText.Replace("[", "");
    returnText = returnText.Replace("]", "");
    returnText = returnText.Replace("|", "");
    returnText = returnText.Replace("\\", "");
    returnText = returnText.Replace("\"", "");
    returnText = returnText.Replace("'", "");
    returnText = returnText.Replace(";", "");
    returnText = returnText.Replace("<", "");
    returnText = returnText.Replace(",", "");
    returnText = returnText.Replace(">", "");
    returnText = returnText.Replace(".", "");
    returnText = returnText.Replace("/", "");
    returnText = returnText.Replace("?", "");
    returnText = returnText.Replace(" ", "");
    
    return returnText.ToUpper();
    }

    Убирает разделители. ;)

    guest, 26 Декабря 2008

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