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

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

    +94.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
    type
     p = ^h;
     h = record
          no:word;
          nx:p;
         end;
    var
     n,k,i:word;
     a,b:p;
    
    begin
    readln(n,k);
    new(b);
    a:=b;
    for i:=1 to n-1 do
    begin
     a^.no:=i;
     new(a^.nx);
     a:=a^.nx;
    end;
    a^.no:=n;
    a^.nx:=b;
    i:=1;
    while true do
    begin
     if a^.nx=a then break;
     if i=k then
     begin
      b:=a^.nx;
      a^.nx:=a^.nx^.nx;
      dispose(b);
      i:=1;
     end;
     a:=a^.nx;
     inc(i);
    end;
    writeln(a^.no);
    end.

    "Гуманитарное" решение задачи Иосифа Флавия (гуглите).
    Тут n - количество людей, убивают каждого k-нного, пока не останется один единственный выживший.

    Lolwho, 11 Декабря 2009

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

    +94.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
    61. 61
    62. 62
    /// Из aspx файла
    
    //<asp:Repeater ID="Repeater1" runat="server">
    //    <HeaderTemplate>
    //        <table width="100%" cellspacing="5">
    //    </HeaderTemplate>
    //    <ItemTemplate>
    //        <tr>
    //            <td>
    //                ...
    //            </td>
    //            <asp:Label runat="server" Visible='<%# DataBinder.Eval(Container.DataItem, "visibleCol2") %>'>
    //                <td>
    //                    ...
    //                </td>
    //            </asp:Label>
    //            <asp:Label ID="LCol3" runat="server" Visible='<%# DataBinder.Eval(Container.DataItem, "visibleCol3") %>'>
    //                <td>
    //                    ...
    //                </td>
    //            </asp:Label>
    //        </tr>
    //    </ItemTemplate>
    //    <FooterTemplate>
    //        </table>
    //    </FooterTemplate>
    //</asp:Repeater>
    
    // Из cs файла
    
    DataTable dtres = // получаем товары
    if (dtres != null && dtres.Rows.Count > 0)
    {
        DataTable dt = new DataTable();
    	/*...*/
        
        for (int i=0;i<dtres.Rows.Count;)
        {
            DataRow dr=dtres.Rows[i];
            /*...*/
    
            int col2Index = i + 1;
            if (col2Index < dtres.Rows.Count)
            {
                /*...*/
                i++;
                int col3Index = i + 1;
                if (col3Index < dtres.Rows.Count)
                {
                    /*...*/
                    i++;
                }
                else { /*...*/ }
            }
            else { /*...*/ }
    
            dt.Rows.Add(newRow);
            i++;
        }
    
        /*...*/
    }

    Человеку нужно было сделать товары в сетке 3x6.
    От того что он сделал у меня пропал дар речи. (Чтобы тут очень много кода не бы большую (не нужную для понимания) часть заменил на "...")
    Вобщем, в двух словах, он поместил вторую и третью ячейки таблицы в серверные контролы (причем в Label), а в коде берёт по три товара и засовывает в один RepeaterItem, ну а если количество товаров не делится нацело на три, то в последний RepeaterItem засовываются пустые данные, а Label делается невидимым.
    Как-то так.
    И самое главное, я не знаю, как человеку объяснить, что так нехорошо делать, т.к он главный программист...

    Ordos, 27 Сентября 2009

    Комментарии (9)
  4. Pascal / Говнокод #2793

    +94.2

    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
    procedure TNamePlay.OKBtnClick(Sender: TObject);
    var
     reg:treginifile;
     a,s,d,f,g,h,j,k,l,z,x:integer;
    begin
    if setp.CheckBox1.Checked =true then
    playsound('Music\xxx.WAV',0,snd_async);
    
     if vopros.Easy.Checked=false then
      och.Caption:=inttostr(strtoint(och.caption)+50);
     with gamers do begin
       Reg := TReginifile.Create;
       Reg.RootKey := HKEY_LOCAL_MACHINE;
       with reg do begin
        o1.caption:=readstring('Software\xxx\Gamers\Result','First','');
        o2.caption:=readstring('Software\xxx\Gamers\Result','Two','');
        o3.caption:=readstring('Software\xxx\Gamers\Result','Three','');
        o4.caption:=readstring('Software\xxx\Gamers\Result','Four','');
        o5.caption:=readstring('Software\xxx\Gamers\Result','Five','');
        o6.caption:=readstring('Software\xxx\Gamers\Result','Six','');
        o7.caption:=readstring('Software\xxx\Gamers\Result','Seven','');
        o8.caption:=readstring('Software\xxx\Gamers\Result','Eight','');
        o9.caption:=readstring('Software\xxx\Gamers\Result','Nine','');
        o10.caption:=readstring('Software\xxx\Gamers\Result','Ten','');
        g1.caption:=readstring('Software\xxx\Gamers','First','');
        g2.caption:=readstring('Software\xxx\Gamers','Two','');
        g3.caption:=readstring('Software\xxx\Gamers','Three','');
        g4.caption:=readstring('Software\xxx\Gamers','Four','');
        g5.caption:=readstring('Software\xxx\Gamers','Five','');
        g6.caption:=readstring('Software\xxx\Gamers','Six','');
        g7.caption:=readstring('Software\xxx\Gamers','Seven','');
        g8.caption:=readstring('Software\xxx\Gamers','Eight','');
        g9.caption:=readstring('Software\xxx\Gamers','Nine','');
        g10.caption:=readstring('Software\xxx\Gamers','Ten','');
       end;
     end;
     if password.Text='' then
      raise erangeerror.Create('Вы не ввели имени')
     else begin
      with gamers do begin
       a:=strtoint(o1.caption);
       s:=strtoint(o2.caption);
       d:=strtoint(o3.caption);
       f:=strtoint(o4.caption);
       g:=strtoint(o5.caption);
       h:=strtoint(o6.caption);
       j:=strtoint(o7.caption);
       k:=strtoint(o8.caption);
       l:=strtoint(o9.caption);
       z:=strtoint(o10.caption);
       x:=strtoint(nameplay.och.caption);
       if x>a then begin
        g10.Caption:=g9.Caption;
        o10.Caption:=o9.caption;
        g9.Caption:=g8.Caption;
        o9.Caption:=o8.caption;
        g8.Caption:=g7.Caption;
        o8.Caption:=o7.caption;
        g7.Caption:=g6.Caption;
        o7.Caption:=o6.caption;
        g6.Caption:=g5.Caption;
        o6.Caption:=o5.caption;
        g5.Caption:=g4.Caption;
        o5.Caption:=o4.caption;
        g4.Caption:=g3.Caption;
        o4.Caption:=o3.caption;
        g3.Caption:=g2.Caption;
        o3.Caption:=o2.caption;
        g2.Caption:=g1.Caption;
        o2.Caption:=o1.caption;
        g1.Caption:=nameplay.Password.Text;
        o1.Caption:=nameplay.och.Caption;
       end else if x=a then begin
        g1.Caption:=nameplay.Password.Text;
        o1.Caption:=nameplay.och.Caption;
       end else if x<a then begin
        if x>s then begin
         g10.Caption:=g9.Caption;
         o10.Caption:=o9.caption;
         g9.Caption:=g8.Caption;
         o9.Caption:=o8.caption;
         g8.Caption:=g7.Caption;
         o8.Caption:=o7.caption;
         g7.Caption:=g6.Caption;
         o7.Caption:=o6.caption;
         g6.Caption:=g5.Caption;
         o6.Caption:=o5.caption;
         g5.Caption:=g4.Caption;
         o5.Caption:=o4.caption;
         g4.Caption:=g3.Caption;
         o4.Caption:=o3.caption;
         g3.Caption:=g2.Caption;
         o3.Caption:=o2.caption;
         g2.Caption:=nameplay.Password.Text;
         o2.Caption:=nameplay.och.Caption;
        end else if x=s then begin
         g2.Caption:=nameplay.Password.Text;
         o2.Caption:=nameplay.och.Caption;
        end else if x<s then begin
    ...

    Ололо, феерический говнокод! LOL

    ancestor, 15 Марта 2010

    Комментарии (17)
  5. Pascal / Говнокод #2581

    +94.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
    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
    unit uboot;
    
    	procedure boot;
    
    	begin
    
    	delay(100);
    
    	output_buffer:='Uboot v0.1'+chr(10)+'Status: ...Ready!';
    
    	uboot_shell;
    
    	end;
    
    	procedure uboot_shell;
    
    	begin
    
    	showForm;
    
    	removeCommand(enter_cmd);
    
    	input_buffer_num:=formAddString(output_buffer);
    
    	enter_cmd:=createCommand('ok', CM_ITEM, 1);
    
    	input_buffer_num:=formAddTextField('boot >>', '', 256, TF_ANY);
    
    	addCommand(enter_cmd);
    
    	repaint;
    
    	repeat
    
    	delay(100);
    
    	until getClickedCommand=enter_cmd;
    
    	uboot_parse;
    
    	end;
    
    	procedure uboot_parse;
    
    	//Получаем буфер ввода в нижнем регестре
    
    	input_buffer:=locase(formGetText(input_buffer_num));
    
    	if input_buffer='shutdown' then shutdown;
    
    	else if input_buffer='help' then output_buffer:='shutdown, help, boot, clear';
    
    	else if input_buffer='boot' then	os_boot;
    
    	else if input_buffer='clear' then clear;
    
    	else output_buffer:='Unsupported command';
    
    	uboot_shell;
    
    	end;
    
    	procedure shutdown;
    
    	begin
    
    	clearForm;
    
    	halt;
    
    	end;
    
    	procedure clear;
    
    	begin
    
    	clearForm;
    
    	output_buffer:='';
    
    	delay(100);
    
    	uboot_shell;
    
    	end;
    
    	procedure os_boot;
    
    	begin
    
    	input_buffer:='';
    
    	output_buffer:='';
    
    	clearForm;
    
    	kernel.kernel_start('');

    SieMaster, 09 Февраля 2010

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

    +94

    1. 1
    2. 2
    SetLength(kokoko, Length(kokoko)+1);
    kokoko[Length(kokoko)-1] := Something;

    БЕСИТ

    TarasB, 10 Марта 2015

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

    +94

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    combinations.AddRange(combinations4);
                combinations.AddRange(from combination5 in combinations5
                                      where
                                          (from combination4 in combinations4
                                           where
                                               (from c4class in combination4.Classes
                                                where !combination5.Classes.Contains(c4class)
                                                select c4class).Count() == 0
                                           select combination4).Count() == 0
                                      select combination5);

    Теперь у меня есть ачивка "сделать через LINQ не смотря ни на что".
    Тому, кто поймёт, что же здесь происходит - достанется воображаемый пряник.

    krypt, 24 Января 2015

    Комментарии (9)
  8. Java / Говнокод #17475

    +94

    1. 1
    MenuGame extends GameMenu

    jangolare, 19 Января 2015

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

    +94

    1. 1
    2. 2
    3. 3
    4. 4
    public static string ToNew(this String source)
    {
        return new string(source.ToCharArray());
    }

    pushistayapodmyshka, 04 Декабря 2014

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

    +94

    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
    function TMyDb.getUserItemsINTOMarkt(userid: Int64; marktid: String): SOString;
    var
      Query : TZQuery;
    begin
     Result := '';
     try
     lock;
     Query := TZQuery.Create(nil);
     if not isConnected() then
            connect();
       Query.Connection := SQLCon;
          Query.SQL.TEXT:='SELECT mi.markt_id, mi.price, mi.item_id,ui.used_limit,'+
                               'ui.max_limit,ui.inv_id,ui.inv_min_damage, ui.inv_max_damage,'+
                               'ui.inv_options,ui.inv_bonuses,ui.inv_mods,ui.modifed,'+
                               'i.name FROM bkheroes.markt_items mi '+
                               'JOIN user_inventory ui ON mi.user_id='+IntToStr(userid)+' AND '+
                               'mi.user_inv_id=ui.inv_id AND mi.markt_id='''+marktid+
                              ''' AND ui.userSellItem=''yes'' JOIN items i ON i.id=mi.item_id';
    
       if SQLCon.Connected = True then
      begin
        Query.Open;
        if Query.RecordCount > 0 then
        begin
          while not Query.EOF do
          begin
              Result := Result+'{"marktid":'+Query.FieldByName('markt_id').AsString+
                        ',"inv_id":'+Query.FieldByName('inv_id').AsString+
                        ',"price":'+Query.FieldByName('price').AsString+
                        ',"itemid":'+Query.FieldByName('item_id').AsString+
                        ',"used_limit":'+Query.FieldByName('used_limit').AsString+
                        ',"max_limit":'+Query.FieldByName('max_limit').AsString+
                        ',"min_damage":'+Query.FieldByName('inv_min_damage').AsString+
                        ',"max_damage":'+Query.FieldByName('inv_max_damage').AsString+
                        ',"options":'+explodeParams(query.FieldByName('inv_options').AsString,',',':').AsString+
                        ',"bonuses":'+explodeParams(Query.FieldByName('inv_bonuses').AsString,',',':').AsString+
                        ',"mods":'+explodeParams(Query.FieldByName('inv_mods').AsString,',',':').AsString+
                        ',"modifed":"'+Query.FieldByName('modifed').AsString+
                        '","name":"'+Query.FieldByName('name').AsString+'"},';
              query.Next;
          end;
        end;
      Result:='{"marktid":'+marktid+',"items":['+Copy(Result,1,Length(Result)-1)+']}';
      end;
      TLogger.GeneralLog('getUserItemsINTOMarkt: '+Result,'TMyDBUnit',ltTrace);
      finally
      Query.Close;
      Query.Free;
      unlock;
      end;
    end;

    О боже! Как можено такое писать за деньги? Да вообще, как можно писать такое??

    Cynicrus, 24 Ноября 2014

    Комментарии (26)
  11. Pascal / Говнокод #16947

    +94

    1. 1
    2. 2
    fisher(Sender);//fisher
    macd(Sender);//macd

    Буква "С" - Содержательные комментарии.

    Практически единственные комменты в программе на 7000 строк.

    hardreset, 27 Октября 2014

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