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

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

    +159

    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
    bool Document::_Parse_Auto (char sym)
    	{
    		bool error = 0;
    
    		switch (mInfo.AutoState)
    		{
    		case 0:
    			{
    				if (is_stag (sym))
    					mInfo.AutoState = 1;
    				else
    					mInfo.AutoState = 14;
    				break;
    			}
    		case 1:
    			{
    				if (is_name (sym))
    					mInfo.AutoState = 24;
    				else if (is_delim (sym))
    					mInfo.AutoState = 2;
    				else if (is_prcom (sym))
    					mInfo.AutoState = 11;
    				else if (is_info (sym))
    					mInfo.AutoState = 25;
    				else if (is_ekey (sym))
    					mInfo.AutoState = 21;
    				else
    					error = true;
    				break;
    			}
    <100500 строк case'ов>
    		case 26:
    			{
    				if (is_etag (sym))
    					mInfo.AutoState = 0;
    				else
    					error = true;
    				break;
    			}
    		}
    
    		return error;
    	}
    
    	void Document::_Parse_React (char sym)
    	{
    		switch (mInfo.AutoState)
    		{
    		case 0:
    			{
    				switch (mInfo.NodeType)
    				{
    				case ParseInfo::preproc:
    					{
    						delete mInfo.CurrentNode;
    						mInfo.CurrentNode = mInfo.LastTextNode;
    						break;
    					}
    				case ParseInfo::info:
    					{
    						delete mInfo.CurrentNode;
    						mInfo.CurrentNode = mInfo.LastTextNode;
    						break;
    					}
    				case ParseInfo::close:
    					{
    						
    						if (mInfo.name == mInfo.CurrentNode->name)
    							mInfo.CurrentNode = mInfo.CurrentNode->parent;
    						else
    						{ mInfo.Error = 51; return; }
    
    						mInfo.name.clear ();
    						break;
    					}
    				}
    				break;
    			}
    <ещё 100500 строк case'ов>
    		case 25:
    			{
    				mInfo.NodeType = ParseInfo::info;
    				mInfo.LastTextNode = mInfo.CurrentNode;
    				mInfo.CurrentNode = new Node;
    				break;
    			}
    		}
    
    		switch (mInfo.LastAutoState)
    		{
    <и ещё 100500 строк case'ов>

    Это я в 10 классе писал XML парсер, работающий на конечном автомате, в котором было 27 состояний.

    YuraTim, 20 Марта 2011

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

    +107

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    static void Main(string[] args)
            {
                int a = int.Parse(Console.ReadLine());
                int b = int.Parse(Console.ReadLine());
                int c = int.Parse(Console.ReadLine());
                Math.Cos(double x) = (b * b + c * c - a * a) / (2 * b * c);
                Math.Cos(double x)=i;
                if(-1>i>0) Console.WriteLine("Треугольник тупоугольный");
                if()
            }

    Не столько смешно, сколько хочется плакать от тупоугольности таких вот студентов...

    FMB, 20 Марта 2011

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

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?
    function save($author,$title,$pubyear,$price) {
            $sql = "INSERT INTO catalog(author,title,pubyear,price) 
                            VALUES('$author','$title',$pubyear,$price)";
            mysql_query($sql) or die (mysql_error());
    }
     function selectAll() {
                    $sql = "SELECT * FROM catalog";
                    $result = mysql_query($sql) or die(mysql_error());
                    return $result;
    }

    qbasic, 17 Марта 2011

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

    +161

    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
    function explode( delimiter, string ) {	// Split a string by string
    	// 
    	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    	// +   improved by: kenneth
    	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    
    	var emptyArray = { 0: '' };
    
    	if ( arguments.length != 2
    		|| typeof arguments[0] == 'undefined'
    		|| typeof arguments[1] == 'undefined' )
    	{
    		return null;
    	}
    
    	if ( delimiter === ''
    		|| delimiter === false
    		|| delimiter === null )
    	{
    		return false;
    	}
    
    	if ( typeof delimiter == 'function'
    		|| typeof delimiter == 'object'
    		|| typeof string == 'function'
    		|| typeof string == 'object' )
    	{
    		return emptyArray;
    	}
    
    	if ( delimiter === true ) {
    		delimiter = '1';
    	}
    
    	return string.toString().split ( delimiter.toString() );
    }

    Из сборника JS-реализаций PHP функций : http://javascript.ru/php/explode
    Сюда можно половину этого сборника постить.

    scalar4eblo4no, 17 Марта 2011

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

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Function F1(z: Byte): Real;  {Функция возведения (-1) в степень "к"}
    
      Begin
    
        If z=1
    
          Then F1:=-1
    
          Else F1:=F1(z-1)*-1;
    
      End;

    Нашел в лабораторной по вычмату 2-х годичной давности)

    1_and_0, 15 Марта 2011

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

    −91

    1. 1
    2. 2
    3. 3
    4. 4
    if ((m_window.popupBox_mc.popupBox_tf.text == "Пожалуйста обратитесь в службу поддержки и опишите действия после которых возникла ошибка. Затем обновите страницу.")||(m_window.popupBox_mc.popupBox_tf.text == "Ошибка ресурсов сервера. Пожалуйста обратитесь в службу поддержки и опишите действия после которых возникла ошибка. Затем обновите страницу.")||(m_window.popupBox_mc.popupBox_tf.text == "Ты запустил игру в двух браузерах или окнах одновременно. Закрой одно из окон и обнови страницу!")||(m_window.popupBox_mc.popupBox_tf.text == GlobalEngine.quickLocalize("FarmGame", "ServerError"))||(m_window.popupBox_mc.popupBox_tf.text == GlobalEngine.quickLocalize("FarmGame", "RefreshGame")))
    {				
    m_window.popupBox_mc.accept_bt.visible = false;
    }

    jahnique, 09 Марта 2011

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

    +177

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    enum
    {
       QUEST_5727              = 5727,
       QUEST_6566              = 6566,
    };

    chaoswithin, 06 Марта 2011

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

    +160

    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
    <html> 
    <head>
    <title>Калькулятор</title> 
    </head>
    <body>
    <?
    function show()
    {
    global $action, $result, $first, $second;
    ?>
    <FORM method="GET" action="">
    <input type="text" name="first">
    <input type="text" name="second">
    <table>
    <tr>
    <td><input type="submit" name="action" value="sum"></td>
    <td><input type="submit" name="action" value="min"></td>
    <td><input type="submit" name="action" value="mult"></td>
    </tr>
    <tr>
    <td><input type="submit" name="action" value="dev" ;></td>
    <td><input type="submit" name="action" value="stepen";></td>
    <td><input type="submit" name="action" value="procent";></td>
    <td><input type="submit" name="action" value="koren";></td>
    </tr>
    </table>
    </form>
    <?
    }
    function calc() 
    { 
    global $action, $result, $first, $second; 
    switch($action)
    {
    case "sum": $result = $first+$second; 
    break;
    case "min": $result = $first-$second; 
    break;
    case "mult": $result = $first*$second; 
    break;
    case "dev":
    if (!$second) 
    {
    exit("Извините, программа не может выполнить действие: на ноль делить нельзя");
    }
    $result=$first/$second; 
    break;
    case "procent": $result = $first*($second/100); 
    break;
    case "stepen": $result = pow($first, $second); 
    break;
    case "koren": $result = pow($first,0.5); 
    break;
    }
    ?>
    <b> <? echo $result; ?> </b> 
    <?
    }
    if ($action) 
    calc(); 
    else show();
    ?>
    </body> 
    </html>

    qbasic, 04 Марта 2011

    Комментарии (10)
  10. JavaScript / Говнокод #5815

    +145

    1. 1
    <noscript><meta http-equiv="refresh" content="0; URL=/badbrowser.php"></noscript>

    Паша Дура запретил отрубать его говноскрипты, теперь все должны смотреть на контакт, засранный скриптами.

    TarasB, 27 Февраля 2011

    Комментарии (10)
  11. JavaScript / Говнокод #5785

    +169

    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
    <script type="text/javascript"> 
    opt_text13=new Array("Internet","Hardware","Mobiles","Soft","Sequrity","Networks","Interface");
    opt_val13=new Array("14","28","44","54","61","67","72");
    opt_val113=new Array("114","115","116","117","118","119","120","121");
    opt_text122=new Array("Essays","Scintific Publications","Online Lessons & Tests","Scintific Libraries","Other");
    opt_val122=new Array("123","124","125","126","127");
    opt_text128=new Array("Your Appartment","Cookery","All for Holidays","Family","Pats","Health","Fashion and Beauty","Purchases");
    opt_val128=new Array("129","138","146","155","162","170","179","189");
    opt_text129=new Array("Country Cottage","Repair","Construction","Interior Design","Landscape Design","Building Materials","Sanitary","Other");
    opt_val129=new Array("130","131","132","133","134","135","136","137");
    opt_text138=new Array("Recepies","Diet","Products","Tabacco","Bavarage","Delivery","Other");
    opt_val138=new Array("139","140","141","142","143","144","145");
    opt_text146=new Array("E-Cards","Tostes and scenaries","Gifts","Flowers Delivery","Holiday Organization","Fireworks","Holidays","Other");
    opt_val146=new Array("147","148","149","150","151","152","153","154");
    opt_text155=new Array("For Parents","For Children","Relation's Psyhology","Marrage","Marrage Agancies","Other");
    //...............
    opt_val252=new Array("253","254","255","256","257","258");opt_text259=new Array("Astrology","Fortune-telling","Esotericism","UFO","Other");
    opt_val259=new Array("260","261","262","263","264");
    opt_text268=new Array("Places","Tourism","Vocation","Hobbies");
    opt_val268=new Array("269","280","292","297");
    opt_text269=new Array("Restaurants & Bars","Clubs & Diskos","Bowling & Billiard","Casinos","Places for children","Circuses","Parks & Zoos","Theaters","Cinemas","Other");
    opt_val269=new Array("270","271","272","273","274","275","276","277","278","279");
    opt_text428=new Array("Newspapers","Magazines","Publishing Houses","Business publications","Computer publications","Motor-Car publications","Sport publications","Entertaining publications","Music/Cinema/TV","Publications for women","Publications for men","Publications for kids","Other publications");opt_val428=new Array("429","430","431","432","433","434","435","436","437","438","439","440","441");opt_text446=new Array("Metallurgy","Mechanical engineering","Equipment","Electronics","Energetics","Chemical industry","Agriculture","Food Industry","Factories","Light Industry","Heavy Industry","Other industries");opt_val446=new Array("447","451","458","469","473","479","483","484","485","486","487","488");opt_text447=new Array("Iron industry","Non-ferrous metallurgy","Other");opt_val447=new Array("448","449","450");opt_text451=new Array("Motor-car Factories","Engeenering Factories","Agricultural Factories","Sheepbuilding","Aircraft building","Other");
    //........
    opt_text529=new Array("Office equipment","Office furneture","Lock boxes","Stationery","Other");opt_val529=new Array("530","531","532","533","534");opt_text536=new Array("Encyclopedias","Transport","Maps","Addresses & Phones","Search people","Dictionaries","Weather","Other");opt_val536=new Array("537","543","552","553","554","555","556","557");opt_text537=new Array("Universal","Medical","Biographical","Subject encyclopedia","Other");opt_val537=new Array("538","539","540","541","542");opt_text543=new Array("Timetables","Air transport","Railway","Sailing","Urban transport","Taxi & Car rent","Bus transport","Other");opt_val543=new Array("544","545","546","547","548","549","550","551");opt_text558=new Array("Other");
    opt_val558=new Array("559");//**************************************************************

    qbasic, 23 Февраля 2011

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