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

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

    +133.4

    1. 1
    2. 2
    3. 3
    #include <math.h>
     
    result = (use_cos ? cos : sin)(M_PI);

    Прогрессивно.

    guest, 03 Июля 2009

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

    −354.7

    1. 1
    2. 2
    def _ne_ (self, cmp):
        return True if (self < cmp or self > cmp) else False

    Сравнение объектов

    guest, 03 Июля 2009

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

    +151.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if(Silverlight.isInstalled("2.0"))
    	logWrite("Падшая женщина!");
    // На сервере обработка просто убила (C#):
    string blyad = "Падшая женщина!";
    ...
    if (respString == blyad)
         GetProfile(userID).isSilverlight = Convert.ToBoolean(blyad.Length.GetHashCode());

    guest, 02 Июля 2009

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

    +151.3

    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
    function Cross(value) {
      if (value == 0) document.pole0.src = x.src;
      if (value == 1) document.pole1.src = x.src;
      if (value == 2) document.pole2.src = x.src;
      if (value == 3) document.pole3.src = x.src;
      if (value == 4) document.pole4.src = x.src;
      if (value == 5) document.pole5.src = x.src;
      if (value == 6) document.pole6.src = x.src;
      if (value == 7) document.pole7.src = x.src;
      if (value == 8) document.pole8.src = x.src;
    }
    
    function Zero(value) {
      if (value == 0) document.pole0.src = o.src;
      if (value == 1) document.pole1.src = o.src;
      if (value == 2) document.pole2.src = o.src;
      if (value == 3) document.pole3.src = o.src;
      if (value == 4) document.pole4.src = o.src;
      if (value == 5) document.pole5.src = o.src;
      if (value == 6) document.pole6.src = o.src;
      if (value == 7) document.pole7.src = o.src;
      if (value == 8) document.pole8.src = o.src;
    }
    
    function CheckVictory() {
      if (cell[0] == cell[1] && cell[1] == cell[2] && cell[2] > 0) return true; 
      if (cell[3] == cell[4] && cell[4] == cell[5] && cell[5] > 0) return true;
      if (cell[6] == cell[7] && cell[7] == cell[8] && cell[8] > 0) return true;
      if (cell[6] == cell[3] && cell[3] == cell[0] && cell[0] > 0) return true;
      if (cell[7] == cell[4] && cell[4] == cell[1] && cell[1] > 0) return true;
      if (cell[8] == cell[5] && cell[5] == cell[2] && cell[2] > 0) return true;
      if (cell[6] == cell[4] && cell[4] == cell[2] && cell[2] > 0) return true;
      if (cell[0] == cell[4] && cell[4] == cell[8] && cell[8] > 0) return true;
    }
    
    function CompTurn() {
      for (i=0; i<9; i++) if (cell[i] == 0) PutHere = i;
      for (i=0; i<3; i++) {
      if (cell[0] == cell[1] && cell[2] == 0 && cell[0] == i) PutHere = 2;
      if (cell[0] == cell[2] && cell[1] == 0 && cell[0] == i) PutHere = 1;
      if (cell[1] == cell[2] && cell[0] == 0 && cell[2] == i) PutHere = 0;
      if (cell[3] == cell[4] && cell[5] == 0 && cell[3] == i) PutHere = 5;
      if (cell[3] == cell[5] && cell[4] == 0 && cell[3] == i) PutHere = 4;
      if (cell[4] == cell[5] && cell[3] == 0 && cell[5] == i) PutHere = 3;
      if (cell[6] == cell[7] && cell[8] == 0 && cell[6] == i) PutHere = 8;
      if (cell[6] == cell[8] && cell[7] == 0 && cell[6] == i) PutHere = 7;
      if (cell[7] == cell[8] && cell[6] == 0 && cell[8] == i) PutHere = 6;
    
      if (cell[6] == cell[3] && cell[0] == 0 && cell[6] == i) PutHere = 0;
      if (cell[6] == cell[0] && cell[3] == 0 && cell[6] == i) PutHere = 3;
      if (cell[3] == cell[0] && cell[6] == 0 && cell[3] == i) PutHere = 6;
      if (cell[7] == cell[4] && cell[1] == 0 && cell[7] == i) PutHere = 1;
      if (cell[7] == cell[1] && cell[4] == 0 && cell[7] == i) PutHere = 4;
      if (cell[4] == cell[1] && cell[7] == 0 && cell[4] == i) PutHere = 7;
      if (cell[8] == cell[5] && cell[2] == 0 && cell[8] == i) PutHere = 2;
      if (cell[8] == cell[2] && cell[5] == 0 && cell[8] == i) PutHere = 5;
      if (cell[5] == cell[2] && cell[8] == 0 && cell[5] == i) PutHere = 8;
    
      if (cell[6] == cell[4] && cell[2] == 0 && cell[6] == i) PutHere = 2;
      if (cell[6] == cell[2] && cell[4] == 0 && cell[6] == i) PutHere = 4;
      if (cell[4] == cell[2] && cell[6] == 0 && cell[4] == i) PutHere = 6;
      if (cell[0] == cell[4] && cell[8] == 0 && cell[0] == i) PutHere = 8;
      if (cell[0] == cell[8] && cell[4] == 0 && cell[0] == i) PutHere = 4;
      if (cell[4] == cell[8] && cell[0] == 0 && cell[4] == i) PutHere = 0;
      }
      Zero(PutHere);
      cell[PutHere] = 2;
      if (CheckVictory() == true) {
        alert("Выиграл JavaScript =).");
        GameOver();
      }
    }
    
    function GameOver() {
      for (i=0; i<9; i++) cell[i] = 0;
      document.pole0.src = e.src;
      document.pole1.src = e.src;
      document.pole2.src = e.src;
      document.pole3.src = e.src;
      document.pole4.src = e.src;
      document.pole5.src = e.src;
      document.pole6.src = e.src;
      document.pole7.src = e.src;
      document.pole8.src = e.src;
    }

    Найдено тут: http://top.asf.ru/Sgames/xo/. В остальном без комментариев, код говорит сам за себя.

    guest, 30 Июня 2009

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

    +165

    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
    <?
    
    function q($q){
        return mysql_query($q);
    }
    
    function fa($q){
        return mysql_fetch_array($q);
    }
    
    function nr($q){
        return mysql_num_rows($q);
    }
    
    function gr($t,$f,$w,$wf,$def){
        $r = ($a = mysql_fetch_array(mysql_query("SELECT $f FROM $t WHERE $wf = '$w' LIMIT 1"))) ? $a[$f] : $def ;
        return $r;
    }
    
    ?>

    лень творит чудеса

    guest, 30 Июня 2009

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

    +81

    1. 1
    2. 2
    3. 3
    4. 4
    bool b = false;
    while (!b) {
      // ...
    }

    guest, 27 Июня 2009

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

    −348.2

    1. 1
    2. 2
    if (len(filter(lambda path: path == "../stubs", os.sys.path)) == 0):
        os.sys.path.insert(0, '../stubs')

    Хитрая провека на то, нет ли уже "../stubs" в sys.path.

    guest, 25 Июня 2009

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

    +79.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
    For Each LVRefWarnItem In Me.ListViewRefWarn.ListItems 
      For Each LVDiagItem In Me.ListViewDiag.ListItems 
        For Each LVReqdClassItem In Me.ListViewReqdClass.ListItems 
          For Each LVReqdPayItem In Me.ListViewReqdPay.ListItems 
            For Each LVReqdSpecItem In Me.ListViewReqdSpec.ListItems 
              For Each LVReqingSpecItem In Me.ListViewReqingSpec.ListItems 
                For Each LVSvcItem In Me.ListViewSvc.ListItems 
                  For Each LVReqdContItem In Me.ListViewReqdCont.ListItems 
                    For Each LVReqingContItem In Me.ListViewReqingCont.ListItems 
                      For Each LVReqingClassItem In ListViewReqingClass.ListItems 
                        For Each LVReqingPayItem In ListViewReqingPay.ListItems 
                          For Each LVHPCodesItem In ListViewHPCodes.ListItems 
                            For Each LVHPOptionCodesItem In ListViewHPOptionCodes.ListItems 
                              For Each LVPOSItem In ListViewPOS.ListItems 
                                For Each LVReqdProvIDItem In ListViewReqdProvID.ListItems 
                                  For Each LVReqingProvIDItem In ListViewReqingProvID.ListItems 
                                    For Each LVAuthTypeItem In ListViewAuthType.ListItems 
                                      For Each LVMembCondItem In ListViewMemberCondition.ListItems 
                                          TempDe1.InsertRule _ 
                                             AdvancedRule, "Advanced", Me.TextGroup, Me.CheckAutoApprove.Value, _ 
                                             CDate(Me.DTPickerFromDt), CDate(Me.DTPickerToDt), ExpDate, _ 
                                             LVSvcItem.Text, LVSvcItem.ListSubItems(1).Text, LVDiagItem.Text, _ 
                                             LVDiagItem.ListSubItems(1).Text, IIf(LVSvcItem.ListSubItems.Count = 1, _ 
                                             "0", LVSvcItem.ListSubItems(LVSvcItem.ListSubItems.Count).Text), _ 
                                             LVReqdSpecItem.Text, LVReqdSpecItem.ListSubItems(1).Text, _ 
                                             LVReqdClassItem.Text, LVReqdClassItem.ListSubItems(1).Text, _ 
                                             LVReqdContItem.Text, LVReqdContItem.ListSubItems(1).Text, _ 
                                             LVReqdPayItem.Text, LVReqdPayItem.ListSubItems(1).Text, _ 
                                             LVReqingSpecItem.Text, LVReqingSpecItem.ListSubItems(1).Text, 
                                             LVReqingClassItem.Text, LVReqingClassItem.ListSubItems(1).Text, _ 
                                             LVReqingContItem.Text, LVReqingContItem.ListSubItems(1).Text, _ 
                                             LVReqingPayItem.Text, LVReqingPayItem.ListSubItems(1).Text, _ 
                                             LVHPCodesItem.Text, LVHPCodesItem.ListSubItems(1).Text, _ 
                                             LVPOSItem.Text, LVPOSItem.ListSubItems(1).Text, _ 
                                             LVReqdProvIDItem.Text, LVReqdProvIDItem.ListSubItems(1).Text, _ 
                                             LVReqingProvIDItem.Text, LVReqingProvIDItem.ListSubItems(1).Text, _ 
                                             TextDesc.Text, TextAgeFrom.Text, TextAgeTo.Text, _ 
                                             LVAuthTypeItem.Text, LVAuthTypeItem.ListSubItems(1).Text, _ 
                                             LVMembCondItem.Text, LVMembCondItem.ListSubItems(1).Text, _ 
                                             Me.cboRuleType.SelectedItem.Key, Me.txtRulePriority.Text, _ 
                                             Int(LVRefWarnItem.Text), Int(LVRefWarnItem.ListSubItems(1).Text), _ 
                                             LVHPOptionCodesItem.Text, LVHPOptionCodesItem.ListSubItems(1).Text 
                                      Next 
                                    Next LVAuthTypeItem 
                                  Next LVReqingProvIDItem 
                                Next LVReqdProvIDItem 
                              Next LVPOSItem 
                            Next LVHPOptionCodesItem 
                          Next LVHPCodesItem 
                        Next LVReqingPayItem 
                      Next LVReqingClassItem 
                    Next LVReqingContItem 
                  Next LVReqdContItem 
                Next LVSvcItem 
              Next LVReqingSpecItem 
            Next LVReqdSpecItem 
          Next LVReqdPayItem 
        Next LVReqdClassItem 
      Next LVDiagItem 
    Next LVRefWarnItem

    ... ооп во всех позах :)

    guest, 17 Июня 2009

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

    +138.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
    [DataContract]
        public class MyDataContract {
            string lASTNAME = "";
            string nAMESUFFIX = "";
            string mIDDLENAME = "";
            string fIRSTNAME = "";
            [DataMember]
            public string LASTNAME {
                get { return lASTNAME; }
                set { lASTNAME = value; }
            }
            [DataMember]
            public string FIRSTNAME {
                get { return fIRSTNAME; }
                set { fIRSTNAME = value; }
            }
            [DataMember]
            public string MIDDLENAME {
                get { return mIDDLENAME; }
                set { mIDDLENAME = value; }
            }
            [DataMember]
            public string NAMESUFFIX {
                get { return nAMESUFFIX; }
                set { nAMESUFFIX = value; }
            }
        }

    Акуенная конвенция именования переменных

    guest, 16 Июня 2009

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

    +73.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    /*
     * когда-нибудь этот код будет смотреть другой программист
     * так вот, если ты есть тот самый программист и надеюсь ты хороший программист, 
     * то если возникнут какие-то недопонятки, извиняй, старался писать код как-можно качественее
     * но если несложно напиши мне(--------) если считаешь что код дерьмовый. я постараюсь его отрефакторить и объяснить тебе)
     * 
     * маразм какой-то конечно написал), но мне просто интересно насколько качествен или дерьмов мой код).
     * спс
     */

    думаю это надо постить на antigovnokod.ru, но к сожалению такого проекта еще нету. поэтому запостил строчки этого хорошего программиста сюда)

    guest, 11 Июня 2009

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