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

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

    −45.6

    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
    if ( g_nIdleState == 0 ) 
    	{	// Initialize the splash screen right away
    		if ( g_CurrentOptions.get_splash_screen() ) 
    			fgSplashInit();
    		g_nIdleState++;
        } 
    	else 
    		if ( g_nIdleState == 1 ) 
    			g_nIdleState++;
    		else 
    			if ( g_nIdleState == 2 ) 
    				g_nIdleState++;
    			else
    				if ( g_nIdleState == 3 ) 
    				{
    					if( !fgInitSubsystems()) 
    					{
    						FG_LOG(__FILE__, __LINE__,  FG_DK_GENERAL, FG_FALSE,   "Subsystem initializations failed ..." );
    						exit(-1);
    					}
    					g_nIdleState++;
    				}
    				else
    					if ( g_nIdleState == 4 ) 
    					{
    						fgInitVisuals();  // setup OpenGL view parameters
    						g_nIdleState++;
    					}
    					else
    						if ( g_nIdleState == 5 ) 
    							g_nIdleState++;
    						else 
    							if ( g_nIdleState == 6 ) 
    							{
    								mark_time( &g_tsFrame );
    								mark_time(&g_tsTime);
    								g_nIdleState = 1000;
    							} 
    
        if ( g_nIdleState == 1000 ) 
    		fgMainLoop();
    	else 
    		if ( g_CurrentOptions.get_splash_screen() == 1 ) 
    			fgSplashUpdate(0.0);

    процесс загрузки и вывода сплэш-скрина и запуск основного рендера после этого (так предлагал делать flight gear в очень старой версии или чел, который ваял этот код, когда переделывал FG под нужды двигла, бугага)

    guest, 12 Декабря 2008

    Комментарии (2)
  3. PHP / Говнокод #114

    +29

    1. 1
    $result = $this->CachedRequest(600, $sirenaXml->Write(true) . ' ', $rxml);  // Никто никогда не поверит, зачем нужен пробел. ЧТОБЫ ВСЕ РАБОТАЛО! Магия.

    запрос в систему бронирования авиабилетов

    guest, 11 Декабря 2008

    Комментарии (2)
  4. C++ / Говнокод #97

    +29

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    bool MyProc::CompareModule(int *operand1, int *operand2, int n) {
        for (int i = 1; i < n; i++) {
            if (operand1[i] != operand2[i]) {
                if (operand1[i] < operand2[i])
                    return false;
                else
                    return true;
            };
        };
        return true;
    };

    guest, 10 Декабря 2008

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

    −42.8

    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
    procedure TForm1.fritb(ie:longint;var fr0:extended);
     begin
    v1:=0;
     for nsf:=1 to 5 do
      begin
       kl11:=0;kl12:=0;kl22:=0;
      for k:=1 to km[nsf] do
        begin
        if (cm^[ie]=cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and (cm^[ie]=1)
        then      kl11:=kl11+1;
        if (cm^[ie]=cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and (cm^[ie]=2)
        then      kl22:=kl22+1;
    if (cm^[ie]<>cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and(cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]]<>0)and (cm^[ie]<>0)
        then      kl12:=kl12+1;
         end;
      fr0:=fr0+kl11*(p11[1,nsf])+kl22*p11[2,nsf]+kl12*p11[3,nsf];
      v1:=v1+kl11*(f11[1,nsf])+kl22*f11[2,nsf]+kl12*f11[3,nsf];
       end;
      fr0:=fr0-sqrt(abs(v1));
     end;

    процеДуро

    guest, 09 Декабря 2008

    Комментарии (2)
  6. Java / Говнокод #86

    −50

    1. 1
    2. 2
    3. 3
    4. 4
    contents = contents.replaceAll("\\&lt;(\\w+)\\&gt;", "<CT_$1>\n");
    				contents = contents.replaceAll("\\&lt;(\\w+)(\\s\\w+)=\\&quot;(\\w+)\\&quot;\\&gt;", "<CT_$1$2=\"$3\">\n");
    				contents = contents.replaceAll("\\&lt;(\\w+)(\\s\\w+)=\\&apos;(\\w+)\\&apos;\\&gt;", "<CT_$1$2='$3'>\n");
    				contents = contents.replaceAll("\\&lt;/(\\w+)\\&gt;", "\n</CT_$1>\n");

    преобразуем эскейпнутые тэги в обычные

    guest, 09 Декабря 2008

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

    +30

    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
    private static string identifier(string wmiClass, string wmiProperty)
                {
                    string result = "";
                    System.Management.ManagementClass mc =
                new System.Management.ManagementClass(wmiClass);
                    System.Management.ManagementObjectCollection moc = mc.GetInstances();
                    foreach (System.Management.ManagementObject mo in moc)
                    {
                        //Only get the first one
                        if (result == "")
                        {
                            try
                            {
                                result = mo[wmiProperty].ToString();
                                break;
                            }
                            catch
                            {
                            }
                        }
                    }
                    return result;
                }

    guest, 08 Декабря 2008

    Комментарии (2)
  8. JavaScript / Говнокод #29184

    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
    let fallbackFunc = ()=>console.log("Hello, World!");
    let settings = {
        fallbackButtonName: "Hello, World!",
        fallbackWidth: 512,
        fallbackHeight: 512,
        settingsMenuExitButtonHeight: 32,
        settingsMenuExitButtonName: "X",
        settingElementHeight: 32,
        settingsMenuExitButtonAtBeginning: true,
        settingElementTrueName: "ON",
        settingElementFalseName: "OFF",
        settingsMenuBooleanSeperatorName: "- $",
        hideExtraButtonsToolbar: true,
        updateToolbar: updateToolbar,
        updateSettingsMenu: updateSettingsMenu,
        activateFallbackFunc: fallbackFunc
    };
    
    let settingsMenu = document.getElementById("settings");
    let settingsElement = document.querySelector(".setting-element#hide");
    
    // -------------------------------------------------------------------
    
    function updateSettingsMenu() {
        settingsMenu.innerHTML = "";
        let exitButton = document.createElement("button");
        exitButton.style.height = settings.settingsMenuExitButtonHeight+"px";
        exitButton.innerText = settings.settingsMenuExitButtonName;
        exitButton.onclick = function() {
            settingsMenu.style.display = "none";
        }
    
        if (settings.settingsMenuExitButtonAtBeginning) settingsMenu.appendChild(exitButton);
        for (let k in settings) {
            let v = settings[k];
    
            let setting = settingsElement.cloneNode(true);
            setting.id = "";
            console.log(setting)
            setting.style.height = settings.settingElementHeight+"px";
            let [name,value] = setting.children;
            if (typeof v !== "function") {
                name.innerText = k;
                function booleanToString(bool) {
                    return (bool?settings.settingsMenuBooleanSeperatorName.replaceAll("$",settings.settingElementTrueName):settings.settingsMenuBooleanSeperatorName.replaceAll("$",settings.settingElementFalseName))
                }
                value.innerText = (typeof v === "boolean")?booleanToString(v):v;
                value.onclick = function() {
                    if (typeof v === "boolean") {
                        settings[k] = !settings[k];
                        value.innerText = booleanToString(settings[k]);
                    } else {
                        let input = prompt(`New value for ${k}:`);
                        let newValue = isNaN(input)?input:Number(input);
                        value.innerText = newValue;
                        settings[k] = newValue
                    }
                }
            } else {
                name.remove()
                value.innerText = k;
                value.onclick = v;
            }
    
            settingsMenu.appendChild(setting);
        }
        if (!settings.settingsMenuExitButtonAtBeginning) settingsMenu.appendChild(exitButton);
    }
    function showSettings() {
        settingsMenu.style.display = "flex";
        updateSettingsMenu();
    }

    Как вам код?

    manabanana, 29 Сентября 2025

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

    +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
    using Godot;
    
    namespace CW2EB.UI;
    public partial class EscQuittingLabel : Label {
    
    	Tween tween, tween2thesequel;
    	public override void _Ready(){
    		base._Ready();
    		tween = GetTree().CreateTween().SetParallel();
    		tween2thesequel = GetTree().CreateTween();
    		tween.TweenProperty(this, "theme_override_colors/font_color", new Color(1f, 1f, 1f, 1f), 1);
    		tween.TweenProperty(this, "theme_override_colors/font_shadow_color", new Color(0f, 0f, 0f, 1f), 1);
    
    		
    		tween2thesequel.TweenCallback(Callable.From(TweenStage1)).SetDelay(.25);
    		tween2thesequel.TweenCallback(Callable.From(TweenStage2)).SetDelay(.25);
    		tween2thesequel.TweenCallback(Callable.From(TweenStage3)).SetDelay(.25);
    		tween2thesequel.TweenCallback(Callable.From(TweenStage4)).SetDelay(.5);
    	}
    
    	public void TweenStage1()
    		=> Text = Tr("Quitting") + ".";
    
    	public void TweenStage2()
    		=> Text = Tr("Quitting") + "..";
    
    	public void TweenStage3()
    		=> Text = Tr("Quitting") + "...";
    
    	public void TweenStage4()
    		=> GetTree().Quit();
    }

    Как сделать постепенно появляющееся многоточие?

    GhostNoise, 29 Сентября 2025

    Комментарии (1)
  10. Python / Говнокод #29164

    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
    n = int(input())
    d = n
    i = 0
    a = 0
    c = 0
    has1 = False
    has2 = False
    has3 = False 
    has4 = False
    has5 = False
    has6 = False
    has7 = False
    has8 = False
    last_dig = 0
    while n > 0:
        last_dig = n % 10
        if last_dig > i :
            i = last_dig
            if last_dig == 1:
                c = 1
        elif last_dig == 1:
            has1 = True
        elif last_dig == 2:
            has2 = True
        elif last_dig == 3:
            has3 = True
        elif last_dig == 4:
            has4 = True
        elif last_dig == 5:
            has5 = True
        elif last_dig == 6:
            has6 = True
        elif last_dig == 7:
            has7 = True
        elif last_dig == 8:
            has8 = True
        n = n // 10
    c = d % 10
    if has1 == True and c >= 1:
        a = 1
    elif has2 == True and c >= 2:
        a = 2
    elif has3 == True and c >= 3:
        a = 3
    elif has4 == True and c >= 4:
        a = 4
    elif has5 == True and c >= 5:
        a = 5
    elif has6 == True and c >= 6:
        a = 6
    elif has7 == True and c >= 7:
        a = 7
    elif has8 == True and c >= 8:
        a = 8
    else:
        a = c
    print('Максимальная цифра равна', i)
    print('Минимальная цифра равна', a)

    Дано натуральное число n. Напишите программу, которая определяет его максимальную и минимальную цифры

    Permanent_Record, 28 Июля 2025

    Комментарии (1)
  11. Haskell / Говнокод #29148

    +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
    (defun sbcl-vrt-simd-pntr (a f fa &aux (defun (progn (defmacro << (x y) `,(ash x y)) (defmacro >> (x y) `,(ash x (- y))) (defmacro ~ (x) `(lognot ,x))))
                                           (if (progn (labels ((t (a f fa) (declare (type integer a)
                                                                                    (type (function (integer (function () (values)) (pointer single-float)) integer) f)
                                                                                    (type (array real (*)) fa))
                                                                           (declaim (optimize (speed (the (list integer (*)) '(-1 0 1))) (debug 0) (safety 0) (space 0))))) (funcall #'t a f fa)))))
    
      (defclass res (standard-class) ((%size-st :initform nil :accessor size-st)))
      (defclass d (standard-class) ((%size-n :initform nil :accessor size-n)))
      (defmethod sb-mop:validate-superclass ((class class) (meta standard-class)) defun t)
      (defmethod initialize-instance :after ((obj res) &key &allow-other-keys) (setf (size-st obj) (sb-vm::primitive-object-size (type-of (let ((a #xFFFF)) (declare (type (integer #x0 #xFFFF) a)))))))
      (defmethod initialize-instance :after ((obj d) &key) (setf (size-n obj) (sb-vm::primitive-object-size 0)))
      (defclass simd-virtual-guard (res d) ((%spn :initform 0 :accessor spn :type integer)) (:metaclass d))
    
      (let ((lac (make-instance 'simd-virtual-guard)) (data f) (b "8153024679"))
        `(declare (type (array (member ,(let* ((i '())) (do* ((y 0 (+ y 1))) ((= (- y 1) 9) 'nil) (push y i)))) (3)) data)
                  (type string b)
                  (type simd-virtual-duard lac))
    
        (setf (spn lac) (+ (size-st lac) (size-n lac)))
    
        (loop for ll from (- (sb-vm::primitive-object-size b) 55) downto 0 by 4
              do (progn
                   (setf (char b ll) #\0)
                   (setf (char b (- ll #x1)) #\1)
                   (setf (char b (if (= ll 1) (- (+ ll 9) #x2) (- ll #x2))) #\2)))
    
        (- (ash 1 2) (- (char-code (char b 0)) (sb-vm::primitive-object-size "2")))))
    
    (defun sbcl-vrt-simd64 (f0 f1 &aux (returnable 0) (declare (labels ((nil (f0 f1) (declare (type (function ()) f0) (type (function ()) f1)))) (funcall #'nil f0 f1))))
      (labels ((pntr (addr) (sb-sys:sap-ref-8 (sb-sys:int-sap addr) 0))
               (ref (obj) (sb-kernel:get-lisp-obj-address obj)))
    
        (macrolet ((s (v) `(setq returnable ,v)))
          (let ((d (- (ref f0) (ref f1))))
            (declare (type integer d))
    
            (if (not (ash (- (* (integer-length 0) (integer-length 0)) 1) d))
              (do* ((d d (- d 1))) (zerop d)
                (case (+ (ref f0) d)
                  (0XC3C9 (s 0))
                  (0XB8 (if (not (+ (ref f0) d 1)) (s 1) (s -1))
                  (0XC031 (s 2)))))))
    
          (return-from sbcl-vrt-simd64 returnable))))

    пародия на https://www.govnokod.ru/29120

    lisp-worst-code, 23 Июня 2025

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