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

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

    +105

    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
    procedure TForm2.FormCreate(Sender: TObject);
    begin
      SpeedButton1.Left := Form2.ClientWidth div 2 - SpeedButton1.Width;
      SpeedButton1.Top := Form2.ClientHeight div 2 - SpeedButton1.Height;
     
      SpeedButton2.Left := Form2.ClientWidth div 2;
      SpeedButton2.Top := Form2.ClientHeight div 2 - SpeedButton2.Height;
     
      SpeedButton3.Left := Form2.ClientWidth div 2 - SpeedButton3.Width;
      SpeedButton3.Top := Form2.ClientHeight div 2;
     
      SpeedButton4.Left := Form2.ClientWidth div 2;
      SpeedButton4.Top := Form2.ClientHeight div 2;
    end;

    Fai, 30 Августа 2011

    Комментарии (13)
  3. Си / Говнокод #6905

    +105

    1. 1
    2. 2
    3. 3
    4. 4
    if ( (value[0] - 'N') == 0 || (value[0] - 'n') == 0 )
       val = 0;
    if ( (value[0] - 'Y') == 0 || (value[0] - 'y') == 0 )
       val = 1;

    нет, просто сравнить - это слишком скучно и неоригинально.

    ЗЫ от автора http://govnokod.ru/5034

    Dummy00001, 09 Июня 2011

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

    +105

    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
    function TForm1.CheckGameO: String;
    begin
     Result := '';
     If (A1.Tag = 2) and (A2.Tag = 2) then
      Begin
       Result := 'A3';
       If not CheckPos(Result) then Exit;
      End;
    
     If (A1.Tag = 2) and (A3.Tag = 2) then
      Begin
       Result := 'A2';
       If not CheckPos(Result) then Exit;
      End;
    
     If (A1.Tag = 2) and (C3.Tag = 2) then
      Begin
       Result := 'B2';
       If not CheckPos(Result) then Exit;
      End;
    
     If (A1.Tag = 2) and (B2.Tag = 2) then
      Begin
       Result := 'C3';
      If not CheckPos(Result) then Exit;
      End;
    
     If (A1.Tag = 2) and (B1.Tag = 2) then
      Begin
       Result := 'C1';
       If not CheckPos(Result) then Exit;
      End;
    
     If (A1.Tag = 2) and (C1.Tag = 2) then
      Begin
       Result := 'B1';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (C3.Tag = 2) then
      Begin
       Result := 'A1';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (A2.Tag = 2) then
      Begin
       Result := 'C2';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (C2.Tag = 2) then
      Begin
       Result := 'A2';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (C1.Tag = 2) then
      Begin
       Result := 'A3';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (A3.Tag = 2) then
      Begin
       Result := 'C1';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (B1.Tag = 2) then
      Begin
       Result := 'B3';
       If not CheckPos(Result) then Exit;
      End;
    
     If (B2.Tag = 2) and (B3.Tag = 2) then
      Begin
       Result := 'B1';
       If not CheckPos(Result) then Exit;
      End;
    
     If (C3.Tag = 2) and (A3.Tag = 2) then
      Begin
       Result := 'B3';
       If not CheckPos(Result) then Exit;
      End;
    
     If (C3.Tag = 2) and (B3.Tag = 2) then
      Begin
       Result := 'A3';
       If not CheckPos(Result) then Exit;
      End;
    
     If (C3.Tag = 2) and (C2.Tag = 2) then
      Begin
       Result := 'C1';
       If not CheckPos(Result) then Exit;
      End;
    
    ...

    Кто угадает для чего это предназначалось получит печенье.

    Govnocoder#0xFF, 06 Апреля 2011

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

    +105

    1. 1
    int c = ((i-(i%(int)pow(10,p)))/(int)pow(10,p))%10;

    Выделение из числа I цифры, стоящей на месте P с конца.
    =>
    i = 1234, p = 2, c => 2

    danilissimus, 16 Марта 2011

    Комментарии (24)
  6. Си / Говнокод #5887

    +105

    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
    #define C_WRONG              -2000
    
    ....
    
    int tttt_atoi(char* p_string){
    
       int result = C_WRONG;
    
       if ( *p_string < '0' || *p_string > '9' )
          return C_WRONG;
    
       result = atoi(p_string);
       return result;
    }
    
    double tttt_atof(char* p_string){
    
       double result = C_WRONG;
       result = atof(p_string);
       if (result!=0){
          return result;
       }
       else{
          if(strcmp(p_string,"0.0")==0 || strcmp(p_string,"0")==0 || strcmp(p_string,"0.")==0){
             return result;
          }
          else{
             return C_WRONG;
          }
       }
    }

    и вы посмейтесь. или facepalm'нитесь. синтакс оригинала.

    Dummy00001, 04 Марта 2011

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

    +105

    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
    case nd of
    0..9:days.Caption := '00'+IntToStr(nd);
    10..99:days.Caption := '0'+IntToStr(nd);
    100..999:days.Caption := IntToStr(nd);
    end;
    case nh of
    0..9:hrs.Caption := '0'+IntToStr(nh);
    10..99:hrs.Caption := IntToStr(nh);
    end;
    case nm of
    0..9:mins.Caption := '0'+IntToStr(nm);
    10..99:mins.Caption := IntToStr(nm);
    end;
    case nsec of
    0..9:secs1.Caption := '0'+IntToStr(nsec);
    10..99:secs1.Caption := IntToStr(nsec);
    end;
    case nsec2 of
    0..9:secs2.Caption := '0000000'+IntToStr(nsec2);
    10..99:secs2.Caption := '000000'+IntToStr(nsec2);
    100..999:secs2.Caption := '00000'+IntToStr(nsec2);
    1000..9999:secs2.Caption := '0000'+IntToStr(nsec2);
    10000..99999:secs2.Caption := '000'+IntToStr(nsec2);
    100000..999999:secs2.Caption := '00'+IntToStr(nsec2);
    1000000..9999999:secs2.Caption := '0'+IntToStr(nsec2);
    10000000..99999999:secs2.Caption := IntToStr(nsec2);
    end;

    Таймер для дураков.

    PEMOHT, 12 Декабря 2010

    Комментарии (8)
  8. Си / Говнокод #4500

    +105

    1. 1
    2. 2
    3. 3
    int run_zero[] = {0xfffffffe,0xfffffffd,0xfffffffb,0xfffffff7,0xffffffef,0xffffffdf,0xffffffbf,0xffffff7f,0xfffffeff,0xfffffdff,0xfffffbff,0xfffff7ff,0xfffefff,0xffffdfff,0xffffbfff,0xffff7fff,0xfffeffff,0xfffdffff,0xfffbffff,0xfff7ffff,0xffeffff,0xffdfffff,0xffbfffff,0xff7fffff,0xfeffffff,0xfdffffff,0xfbffffff,0xf7ffffff,0xefffffff,0xdfffffff,0xbfffffff,0x7fffffff};
    int run_one[] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100,0x200,0x400,0x800,0x1000,0x2000,0x4000,0x8000,0x10000,0x20000,0x40000,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0x10000000,0x20000000,0x40000000,0x80000000};
    int chess_code[] = {0xa5,0x5a};

    Первые строки теста регистров некоего контроллера. Хорошо, что регистры не 64-разрядные, а то задолбался бы паренёк. А уж про chess_code вообще молчу. Вот так суровые российские программеры, не боящиеся лишней работы, тестируют авиационное бортовое оборудование.

    whiskey, 01 Ноября 2010

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

    +105

    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
    implementation
    uses Unit1,Unit2,Unit3,Unit4,Unit5,Unit6,Unit7,Unit8;
    {$R *.dfm}
    var
    k,Zst,zk,Vm12,Vm23,Vm34,Vm45,Vm56,Z2pr,Z3pr,Z4pr,Z5pr,Z6pr,Lm12,Lm23,Lm34,Lm45,Lm56,Vk,Vst,Q,q11,q2ob,q3ob,q4ob,q5ob,q6ob,
    Sst,P1st,P2st,p0k,p12k,p23k,p34k,p45k,p56k,L0,Dk,Dst,H,Hst: real;
    J0,j, i: integer;
    const a=1.1; g=9.81; Y=0.03; x1=605; Y1=48; X2=772; Y2=104;
    x3=627; Y3=107; X4=646; Y4=379;
    x5=X3; Y5=194; X6=576; Y6=200;
    x7=582; Y7=193; X8=576;
    x9=X3; Y9=285; X10=526; Y10=291;
    x11=532; Y11=284; X12=X10;
    x13=650; Y13=380; X14=395; Y14=399;
    x15=479; Y15=377; X16=473;
    x17=394; Y17=Y13; X18=314; Y18=Y14;
    x19=398; Y19=Y15; X20=392;
    x21=314; Y21=Y13; X22=233; Y22=Y14;
    x23=317; Y23=Y15; X24=311;
    x25=233; Y25=Y13; X26=152; Y26=Y14;
    x27=235; Y27=Y15; X28=229;
    x29=152; Y29=Y13; X30=70; Y30=Y14;
    x31=154 ; Y31=Y15; X32=148;
    X33=70;Y33=Y13;X34=3;Y34=Y14;
    X35=72;Y35=Y15;X36=66;
    procedure TForm9.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    Form9.visible:=false;
    end;

    куча Паскаля

    bugmenot, 12 Сентября 2010

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

    +105

    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
    type
      THackImage = class(TGraphicControl)
      public
        property Canvas;
      end;
    
    procedure TColorPicker.ImageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    begin
      {$IFDEF HACKS}
      Assert(Sender is TImage, 'в Sender всегда передается экземпляр класса TImage');
      FSelectedColor := THackImage(Sender).Canvas.Pixels[X, Y];
      {$ELSE}
      (* то, что было лень писать сразу *)

    Говнистая работа с библиотекой VCL. Не притрагивался к проекту около года, потом загрузил и почти час втыкал, за каким этот грёбаный хак здесь нужен.

    bugmenot, 07 Сентября 2010

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

    +105

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    str_sql = " select convert(varchar(6),e.id) as  equipment_id,e.name as name,1 as is_check  " +
                              "         ,(select count(t2.id) from equipment t2 where t2.parent_id=e.id) count_child" +
                              " from equipment e " +
                              " where isnull(e.parent_id,0)=" + e.Node.Value +
                              "       and id in (select cod from f_DisplayEqipmentContract_nodes_2(" + str_contract + "))";

    а вот так мы собираем sql запрос

    madnezz, 02 Августа 2010

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