1. Список говнокодов пользователя GAMER

    Всего: 4

  2. Python / Говнокод #28655

    −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
    def get_decrease_fan_speed_delta(fan_speed: float, delta: float, turn_off: bool):
        # if the fan is already running slower than minimum speed
        if fan_speed < MIN_FAN_SPEED:
            # we ignore the turn_off argument and always set the fan off
            return -fan_speed
        # if fan would be running slower than minimum speed after decreasing it by delta:
        if (fan_speed - delta) < MIN_FAN_SPEED:
            if turn_off:
                return -fan_speed  # turn the fan off
            else:
                return -fan_speed + MIN_FAN_SPEED  # make it run at minimum speed
        return -delta
    
    
    def get_increase_fan_speed_delta(fan_speed, delta):
        new_fan_speed = fan_speed + delta
        # if fan would be running faster than maximum speed
        if new_fan_speed > 100:
            return 100 - fan_speed  # cap it at 100%
        elif new_fan_speed < MIN_FAN_SPEED:
            return MIN_FAN_SPEED - fan_speed  # jump to minimum fan speed
        return delta
    
    
    def compute_fan_speed_delta(temp: float, temp_delta: float, fan_speed: float):
        if temp >= HOT:
            return get_increase_fan_speed_delta(fan_speed, 100.0)
    
        if temp <= COLD:
            # if temperature is decreasing, we slowly decrease the fan speed
            if temp_delta < 0.0:
                return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=True)
            # if temperature is constant or increasing we don't change fan speed
            # until it rises above COLD
            return 0.0
    
        # if temperature is decreasing we decrease fan speed slowly
        if temp_delta < 0.0:
            return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=False)
    
        # if temperature is increasing we increase fan speed slowly
        if temp_delta > 0.0:
            return get_increase_fan_speed_delta(fan_speed, FAN_DELTA)
    
        # if temperature is not changing, don't change the fan speed
        return 0.0

    GAMER, 30 Марта 2023

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

    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
    switch(argCount)
    	{
    		case 0: sprintf(dst, fmt); break;
    		case 1: sprintf(dst, fmt, args[0]); break;
    		case 2: sprintf(dst, fmt, args[0], args[1]); break;
    		case 3: sprintf(dst, fmt, args[0], args[1], args[2]); break;
    		case 4: sprintf(dst, fmt, args[0], args[1], args[2], args[3]); break;
    		case 5: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4]); break;
    		case 6: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5]); break;
    		case 7: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break;
    		case 8: sprintf(dst, fmt, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); break;
    		...

    GAMER, 15 Января 2023

    Комментарии (29)
  4. PHP / Говнокод #28525

    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
    include( 'includes/systems/header.inc' ); #Подключение Заголовка
    
    @list($wdth,$hght) = getImageSize( $_GET['photo'] );
    
    while( ( $wdth > $_SESSION['wdth']-100 ) || ( $hght > $_SESSION['hght']-100 ) ){
    $wdth = $wdth / 1.00001;
    $hght = $hght / 1.00001;
    }
    # echo $wdth . 'x' . $hght ;
    # $hghtP = $hght - 85;
    # $wdthP = $wdth - 85;
    $hghtP = $hght;
    $wdthP = $wdth;
    
    
    @$prms = ( $wdth > $hght )? 'width=' . (int)$wdthP: 'height=' . (int)$hghtP;
    # echo $wdth . 'x' . $hght;

    photo.php

    GAMER, 26 Декабря 2022

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

    +147

    1. 1
    #define true 0

    счастливой отладки, суки!

    GAMER, 30 Июля 2011

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