1. Pascal / Говнокод #26502

    0

    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
    Type
      ONETWO = 1 .. 2;
    
    var I: ONETWO;
    begin
    	I:=1;
    	I:=I+1;
    	writeln(I); //2
    	I:=1+I;     
    	writeln(I); //3
    	inc(I);
    	writeln(I); //4
    	inc(I);
    	writeln(I);	//5
    end.

    https://ideone.com/mtmPPq
    Всё что нужно знать о продвинутой тупизации в «Паскале».

    3.14159265, 13 Марта 2020

    Комментарии (189)
  2. Pascal / Говнокод #26436

    +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
    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
    begin
                     G4.Caption:='X';
                     if G5.Caption='' then
                     begin
                       G5.Caption:='X';
                       if G6.Caption='' then
                       begin
                         G6.Caption:='X';
                         if G7.Caption='' then
                         begin
                           G7.Caption:='X';
                           if G8.Caption='' then G8.Caption:='X' else
                           if sg8=1 then
                              G8.Font.Style:=[fsBold,fsStrikeOut];
                         end else
                         if sg7=1 then
                            G7.Font.Style:=[fsBold,fsStrikeOut];
                       end else
                       if sg6=1 then
                          G6.Font.Style:=[fsBold,fsStrikeOut];
                     end else
                     if sg5=1 then
                        G5.Font.Style:=[fsBold,fsStrikeOut];
                   end else
                   if sg4=1 then
                      G4.Font.Style:=[fsBold,fsStrikeOut];
                 end else
                 if sg3=1 then
                    G3.Font.Style:=[fsBold,fsStrikeOut];
               end else
               if sg2=1 then
                  G2.Font.Style:=[fsBold,fsStrikeOut];
               if H2.Caption='' then H2.Caption:='X' else
               if sh2=1 then H2.Font.Style:=[fsBold,fsStrikeOut];
               if F2.Caption='' then
               begin
                 F2.Caption:='X';
                 if E3.Caption='' then
                 begin
                   E3.Caption:='X';
                   if D4.Caption='' then
                   begin
                     D4.Caption:='X';
                     if C5.Caption='' then
                     begin
                       C5.Caption:='X';
                       if B6.Caption='' then
                       begin
                         B6.Caption:='X';
                         if A7.Caption='' then A7.Caption:='X' else
                         if sa7=1 then
                         A7.Font.Style:=[fsBold,fsStrikeOut];
                       end else
                       if sb6=1 then
                       B6.Font.Style:=[fsBold,fsStrikeOut];
                     end else
                     if sc5=1 then
                     C5.Font.Style:=[fsBold,fsStrikeOut];
                   end else
                   if sd4=1 then
                   D4.Font.Style:=[fsBold,fsStrikeOut];
                 end else
                 if se3=1 then
                 E3.Font.Style:=[fsBold,fsStrikeOut];
               end else
               if sf2=1 then
               F2.Font.Style:=[fsBold,fsStrikeOut];
             end;
          6: begin //Король
        {E1}   if ((se1=1) and not ((E1.Caption<>'Ферзь') or (E1.Caption<>'Ладья') or (E1.Caption<>'Король')) or
        {D1}   ((sd1=1) and not ((E1.Caption='') and ((D1.Caption='Ферзь') or (D1.Caption='Ладья')))) or
        {C1}   ((sc1=1) and not (((E1.Caption='') and (D1.Caption='')) and ((C1.Caption='Ферзь') or (C1.Caption='Ладья')))) or
        {B1}   ((sb1=1) and not (((E1.Caption='') and (D1.Caption='') and (C1.Caption='')) and ((B1.Caption='Ферзь') or (B1.Caption='Ладья')))) or
        {A1}   ((sa1=1) and not (((E1.Caption='') and (D1.Caption='') and (C1.Caption='') and (B1.Caption='')) and ((A1.Caption='Ферзь') or (A1.Caption='Ладья')))) or
        {E2}   ((se2=1) and not ((E2.Caption='Слон') or (E2.Caption='Ферзь') or (E2.Caption='Пешка') or (E2.Caption='Король'))) or
        //ПРОДОВЖИТИ
        {D3}   ((sd3=1) and not ((E2.Caption='') and ((D3.Caption='Ферзь') or (D3.Caption='Слон')))) or
        {C4}   ((sc4=1) and not (((E2.Caption='') and (D3.Caption='')) and ((C4.Caption='Ферзь') or (C4.Caption='Слон')))) or
        {B5}   ((sb5=1) and not (((E2.Caption='') and (D3.Caption='') and (C4.Caption='')) and ((B5.Caption='Ферзь') or (B5.Caption='Слон')))) or
        {A6}   ((sa6=1) and not (((E2.Caption='') and (D3.Caption='') and (C4.Caption='') and (B5.Caption='')) and ((A6.Caption='Ферзь') or (A6.Caption='Ладья')))) or
        {F2}   ((sf2=1) and not (E2.Caption='Ладья') or (E2.Caption='Ферзь')) or
        {F3}   ((sf3=1) and not ((F2.Caption='') and ((F3.Caption='Ферзь') or (F3.Caption='Ладья')))) or
        {F4}   ((sf4=1) and not (((F2.Caption='') and (F3.Caption='')) and ((F4.Caption='Ферзь') or (F4.Caption='Ладья')))) or
        {F5}   ((sf5=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='')) and ((F5.Caption='Ферзь') or (F5.Caption='Ладья')))) or
        {F6}   ((sf6=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='')) and ((F6.Caption='Ферзь') or (F6.Caption='Ладья')))) or
        {F7}   ((sf7=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='') and (F6.Caption='')) and ((F7.Caption='Ферзь') or (F7.Caption='Ладья')))) or
        {F8}   ((sf8=1) and not (((F2.Caption='') and (F3.Caption='') and (F4.Caption='') and (F5.Caption='') and (F6.Caption='') and (F7.Caption='')) and ((F8.Caption='Ферзь') or (F8.Caption='Ладья')))) or
        {G2}   ((sg2=1) and not (G2.Caption='Ферзь') or (G2.Caption='Слон')) or
        {H3}   ((sh3=1) and not ((G2.Caption='') and ((H3.Caption='Ферзь') or (H3.Caption='Слон')))) or
        {H1}   ((sh1=1) and not (H1.Caption'Ферзь') or (H1.Caption='Слон')) or
       {Кони}  ((sh2=1) and not (H2.Caption='Конь')) or ((sg3=1) and not (G3.Caption='Конь')) or  ((se3=1) and not (E3.Caption='Конь')) or  ((sd2=1) and not(D2.Caption='Конь'))
               ) then if (F1.Caption='') then F1.Caption:='X' else
               if sf1=1 then F1.Font.Style:=[fsBold,fsStrikeOut];
             end;

    Как-то на первом или втором курсе недоунивера возникло желание сделать шахматы в ООП на Паскале. Решил закодить 64 кнопки (8*8 поле). Сделал переменные для идентификации хода черных/белых, для 2 режимов, в первом из которых кликаешь на свою фигуру (надпись на кнопке) и тебе показывают доступные ходы ею (Х куда можно поставить фигуру, подчеркнутое название вражеской фигуры при возможность её забрать). Ты кликаешь, поле очищается от подсказок, фигура перемещается, проверка на шах/мат (ад), ход передается другому цвету фигур (Жирное начертание для определения) и режим взаимодействия с игровым полем опять переходит в выбор фигуры. Теоретически закодировав каждую кнопку на все возможные события шахматы были бы закончены полностью. Вот только спустя окончания кодировки первой кнопки я заYAYлся и забросил ибо говнокод вышел в 1000 строк на одну YAYдь кнопку. Разумеется, показать могу лишь часть

    Zick, 12 Февраля 2020

    Комментарии (38)
  3. Pascal / Говнокод #26433

    0

    1. 1
    https://pastebin.com/ABfdEgS5

    Выкладываю не глядя мой код примерно 12-го года.

    vistefan, 10 Февраля 2020

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

    0

    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
    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
    
    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Edit2: TEdit;
        Button1: TButton;
        ListBox1: TListBox;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
    a,b:string;
    i:integer;
    begin
      a := Edit1.Text;
      b := Edit2.Text;
      for i := 0 to 9 do
        begin
            ListBox1.Items.Add('BEGIN:VCARD');
            ListBox1.Items.Add('VERSION:2.1');
            ListBox1.Items.Add('N:' + '000' + IntToStr(i) + ';' + '000' + IntToStr(i) + ';;;');
            ListBox1.Items.Add('FN:' + '000' + IntToStr(i) + ' ' + '000' + IntToStr(i));
            ListBox1.Items.Add('TEL;CELL:' + a + '000' + IntToStr(i) + b);
            ListBox1.Items.Add('END:VCARD');
        end;
      for i := 10 to 99 do
        begin
            ListBox1.Items.Add('BEGIN:VCARD');
            ListBox1.Items.Add('VERSION:2.1');
            ListBox1.Items.Add('N:' + '00' + IntToStr(i) + ';' + '00' + IntToStr(i) + ';;;');
            ListBox1.Items.Add('FN:' + '00' + IntToStr(i) + ' ' + '00' + IntToStr(i));
            ListBox1.Items.Add('TEL;CELL:' + a + '00' + IntToStr(i) + b);
            ListBox1.Items.Add('END:VCARD');
        end;
      for i := 100 to 999 do
        begin
            ListBox1.Items.Add('BEGIN:VCARD');
            ListBox1.Items.Add('VERSION:2.1');
            ListBox1.Items.Add('N:' + '0' + IntToStr(i) + ';' + '0' + IntToStr(i) + ';;;');
            ListBox1.Items.Add('FN:' + '0' + IntToStr(i) + ' ' + '0' + IntToStr(i));
            ListBox1.Items.Add('TEL;CELL:' + a + '0' + IntToStr(i) + b);
            ListBox1.Items.Add('END:VCARD');
        end;
      for i := 1000 to 9999 do
        begin
            ListBox1.Items.Add('BEGIN:VCARD');
            ListBox1.Items.Add('VERSION:2.1');
            ListBox1.Items.Add('N:' + IntToStr(i) + ';' + IntToStr(i) + ';;;');
            ListBox1.Items.Add('FN:' + IntToStr(i) + ' ' + IntToStr(i));
            ListBox1.Items.Add('TEL;CELL:' + a + IntToStr(i) + b);
            ListBox1.Items.Add('END:VCARD');
        end;
    
    end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      ListBox1.Items.SaveToFile('C:\Users\Admin\Desktop\import_tel.vcf');
    end;
    
    end.

    Программа для генерации номеров телефона которую написал друг)

    Reds, 09 Января 2020

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

    −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
    1)
    const
      OUT_OF_BOUNDS:TPoint=(X:-1; Y:-1);
    var
      INT_OUT_OF_BOUNDS:Integer absolute OUT_OF_BOUNDS;
    
    TargetForm.Perform(WM_LBUTTONUP,0,INT_OUT_OF_BOUNDS);
    
    2)
    const
      ZERO_ZERO:TPoint=(X:0; Y:0);
    var
      INT_ZERO_ZERO:Integer absolute ZERO_ZERO;
    
    TargetForm.Perform(WM_LBUTTONUP,0,INT_ZERO_ZERO);
    
    3)
    TargetForm.Perform(WM_LBUTTONUP,0,0);

    Болею. Стояла задача воспроизвести системное меню. Но оказалось, что при клике на элемент фейкового системного меню, форме не посылается WM_LBUTTONUP и кнопка-иконка не перекрашивается в ненажатый вид. Решил перформить WM_LBUTTONUP прямо при клике, но туда нужно передавать координаты мышки куда был совершён клик в High(lParam) и Low(lParam). Сначала хотел передавать -1;-1 но подумал что передавать туда $FFFFFFFF как-то некрасиво, а прямое приведение типов а-ля Integer(Point(-1,-1)) оно у меня хавать не захотело, и поэтому красоты ради наговнокодил первый вариант кода. Потом подумал, а что если там только положительные значения, будет же 65535;65535 непорядок, лучше буду передавать нули. Впихнуть туда просто 0 сразу в голову не пришло (болею же, башка квадратная) и наговнокодил второй вариант.

    Потом, конечно же, написал всё по нормальному.

    KOTOM, 07 Января 2020

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

    0

    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
    procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;
      ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
      var
        http:tidhttp;
        ss:tstringstream;
      begin
      try
        http:=tidhttp.Create(nil);
        http.CookieManager:=tIdcookiemanager.Create(nil);
        http.HandleRedirects:=true;
        http.AllowCookies:=True;
        http.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; rv:56.0) Gecko/20100101 Firefox/56.0';
        http.IOHandler:=tidssliohandlersocketopenssl.Create(nil);
        http.Compressor:=tidcompressorzlib.Create(nil);
        http.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
        http.Request.AcceptEncoding:='gzip, deflate';
        SS:=tstringstream.Create;
        HTTP.Get(ARequestInfo.URI, SS);
        aresponseinfo.CharSet:=http.Response.CharSet;
        aresponseinfo.ContentType:=http.Response.ContentType+'; '+'charset='+http.Response.CharSet+';';
        aresponseinfo.ContentStream:=SS;
        AResponseInfo.WriteContent;
      except
    
      end;
    
    
    end;

    Мой разложившийся мозг сопротивляется. Сковзь пелену галлюцинаций, где где меня имеют сразу несколько волосатых таджиков, отчетливо пробивается реклама. Ее много. Очень много. Реклама и навязчивые видео с предложениями "срубить бабла" даже страшнее галлюцинаций. Я написал простой фильтр, заключающийся в локальном сервере, к которому я подключаюсь из браузера. Сервер является точкой доступа. Неугодные запросы я буду отпиздовывать на корню.
    Собственно, этот код я запостил как фикс досадного гълюка, заключающегося в том, что браузер посылает нахой поле charset. Это херит даже код html.
    Кодировку следует указывать в поле "КонтентТипе"

    пожалуй, всё. пока.

    AnalBoy, 30 Декабря 2019

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

    0

    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
    procedure TForm1.Button1Click(Sender: TObject);
      var
        RequestBody,SResponseBody: TStringStream;
    
        ResponseBody: string;
    begin
    
    
      try
         RequestBody := TStringStream.Create('{"login":"user","password":"pass999"}') ;
        httpconn.HandleRedirects:=TRUE;
        IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method:=sslvSSLv23;
        //httpconn.Host:='api.owencloud.ru';
        httpconn.Request.Accept:='application/xml';
        httpconn.Request.ContentLength:=68;
        httpconn.Request.ContentType:='application/x-www-form-urlencoded';
    
        ResponseBody:=httpconn.Post('https://api.owencloud.ru/v1/auth/open', RequestBody);
        SResponseBody:=TStringStream.Create(httpconn.Post('https://api.owencloud.ru/v1/auth/open', RequestBody));
        memo1.Text:=utf8toansi(ResponseBody);
        xmldocument1.LoadFromStream(SResponseBody);
     finally
        RequestBody.Free;
        SResponseBody.Free;
     end;
    end;

    Передача в мемо волшебна, а в xml так вообще виртуозна

    untitled_001, 30 Ноября 2019

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

    +1

    1. 1
    https://pastebin.com/8c6KxabR

    Бон аппетит, блядь.

    cmepmop, 01 Октября 2019

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

    0

    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
    inside:=false;
    tag:=uppercase(tagpure);
    spacep:=pos(' ',tag);
    if spacep=0 then tagname:=tag else tagname:=copy(tag,1,spacep-1);
    
    if (not inscript) and (tagname='A') then
    begin
    ParseTag(tagpure);
    //если флажок Ссылки или флажок Якоря включен
    if checkBox9.Checked or checkBox10.Checked then
    begin
    linktext:=Lg.GR(24);
    linktag:='HREF';
    link2text:=Lg.GR(25);
    link2tag:='NAME';
    needlink:=true;
    needdbr:=true;
    end;
    end;

    Вернулся в 2007 1997.
    s: h/465709

    gost, 01 Сентября 2019

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Ent := 0.0;
      for I := Low(Freq) to High(Freq) do
        Ent := Ent + Freq[I];
      Ent := Ln(FileSize(Input)) / Ln(2) * Ent;
      for I := Low(Freq) to High(Freq) do
      begin
        if Freq[I] > 0 then
          Ent := Ent - Freq[I] * Ln(Freq[I]) / Ln(2);
      end;
      Ent := Ent / FileSize(Input);

    Скучно, девочки!

    Increment_Excrement, 23 Марта 2019

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