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

    Всего: 26

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

    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
    arr=[]
    def play():
      a=""
      while a!="Игрок 1 победил" and a!="Игрок 2 победил":
          if 1 in list[0] or 1 in list[1] or 1 in list[2] or 1 in list[3] or 1 in list[4] or 1 in list[5] or 1 in list[6] or 1 in list[7]:
            print("\nИгрок 1 вводит координаты")
            letter=input()
            f(letter)
            arr.append(1)
          if 1 in list[0] or 1 in list[1] or 1 in list[2] or 1 in list[3] or 1 in list[4] or 1 in list[5] or 1 in list[6] or 1 in list[7]:
            print("\nИгрок 2 вводит координаты")
            letter=input()
            f(letter)
            arr.append(2)
          else:
            if arr[-1]==1:
              a="Игрок 1 победил"
            else:
              a="Игрок 2 победил"
          print(a)

    Давайте вспоминать былые деньки. И ЛАБЫ!

    ISO, 01 Октября 2023

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

    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
    public readonly struct Int64 : IComparable<long>, IConvertible, 
    IEquatable<long>, IParsable<long>, ISpanParsable<long>, 
    System.Numerics.IAdditionOperators<long,long,long>, 
    System.Numerics.IAdditiveIdentity<long,long>, 
    System.Numerics.IBinaryInteger<long>, System.Numerics.IBinaryNumber<long>, 
    System.Numerics.IBitwiseOperators<long,long,long>, 
    System.Numerics.IComparisonOperators<long,long,bool>, 
    System.Numerics.IDecrementOperators<long>, 
    System.Numerics.IDivisionOperators<long,long,long>, 
    System.Numerics.IEqualityOperators<long,long,bool>, 
    System.Numerics.IIncrementOperators<long>, 
    System.Numerics.IMinMaxValue<long>, 
    System.Numerics.IModulusOperators<long,long,long>, 
    System.Numerics.IMultiplicativeIdentity<long,long>, 
    System.Numerics.IMultiplyOperators<long,long,long>, 
    System.Numerics.INumber<long>, System.Numerics.INumberBase<long>, 
    System.Numerics.IShiftOperators<long,int,long>, 
    System.Numerics.ISignedNumber<long>, 
    System.Numerics.ISubtractionOperators<long,long,long>, 
    System.Numerics.IUnaryNegationOperators<long,long>, 
    System.Numerics.IUnaryPlusOperators<long,long>

    https://learn.microsoft.com/en-us/dotnet/api/system.int64?view=net-7.0

    ISO, 18 Сентября 2023

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

    0

    1. 1
    2. 2
    public ArgumentException (string? message, string? paramName);
    public ArgumentNullException (string? paramName, string? message);

    https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception.-ctor?view=net-7.0#system-argumentexception-ctor(system-string-system-string)
    https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception.-ctor?view=net-7.0#system-argumentnullexception-ctor(system-string-system-string)

    ISO, 15 Сентября 2023

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

    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
    @dataclass(slots=True)
    class Govno:
        govno_index: int
        
        def patch(self, indices_dict: Dict[int, int]) -> None:
            new_index = indices_dict[self.govno_index]
            self.govno_index = new_index
    
    
    @dataclass(slots=True)
    class Mocha:
        mocha_index: int
        
        def patch(self, indices_dict: Dict[int, int]) -> None:
            new_index = indices_dict[self.govno_index]
            self.govno_index = new_index

    Метод «patch» был скопипащен из класса «Govno» в класс «Mocha». Тайпчекер никаких ошибок не показывал; все типы были выведены корректно.

    А в рантайме всё упало, что и неудивительно!

    ISO, 13 Июня 2023

    Комментарии (42)
  6. JavaScript / Говнокод #28785

    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
    if (this.$arg0 == 'inc')    this.$ret = this.$math = args[0] + 1;
            if (this.$arg0 == 'dec')    this.$ret = this.$math = args[0] - 1;
            if (this.$arg0 == 'div')    this.$ret = this.$math = args[0] / args[1];
            if (this.$arg0 == 'ceil')   this.$ret = this.$math = Math.ceil(args[0]);
            if (this.$arg0 == 'floor')  this.$ret = this.$math = Math.floor(args[0]);
            if (this.$arg0 == 'sqrt')   this.$ret = this.$math = Math.sqrt(args[0]);
            if (this.$arg0 == 'exp')    this.$ret = this.$math = Math.exp(args[0]);
            if (this.$arg0 == 'log')    this.$ret = this.$math = Math.log(args[0]);
            if (this.$arg0 == 'sin')    this.$ret = this.$math = Math.sign(args[0]);
            if (this.$arg0 == 'log10')  this.$ret = this.$math = Math.log10(args[0]);
            if (this.$arg0 == 'cos')    this.$ret = this.$math = Math.cos(args[0]);
            if (this.$arg0 == 'tan')    this.$ret = this.$math = Math.tan(args[0]);
            if (this.$arg0 == 'acos')   this.$ret = this.$math = Math.acos(args[0]);
            if (this.$arg0 == 'atan')   this.$ret = this.$math = Math.atan(args[0]);
            if (this.$arg0 == 'round')  this.$ret = this.$math = Math.round(args[0]);
            if (this.$arg0 == 'atan2')  this.$ret = this.$math = Math.atan2(args[0]);

    Исходный код интерпретатора компилятора (!) Языка Программирования «AsmX».
    https://github.com/langprogramming-AsmX/AsmX/blob/main/compiler.js#L215

    ISO, 19 Мая 2023

    Комментарии (55)
  7. Python / Говнокод #28638

    0

    1. 1
    AttributeError: type object 'datetime.datetime' has no attribute 'from_timestamp'. Did you mean: 'fromtimestamp'?

    ISO, 19 Марта 2023

    Комментарии (24)
  8. C++ / Говнокод #28597

    −1

    1. 1
    std::int32_t(v8::Maybe<std::int32_t>::* maybe_from_just)() && = v8::Maybe<std::int32_t>::FromJust;

    ISO, 10 Февраля 2023

    Комментарии (54)
  9. VisualBasic / Говнокод #28567

    −2

    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
    Public Function DescendingSort(ByRef Data As Variant) As Variant
        Dim i As Long
        For i = LBound(Data) To UBound(Data) - 1
            Dim j As Long
            For j = i + 1 To UBound(Data)
                If Data(i) < Data(j) Then
                    Dim Temp As Variant
                    Temp = Data(j)
                    Data(j) = Data(i)
                    Data(i) = Temp
                End If
            Next
        Next
    
        DescendingSort = Data
    End Function

    Вот все спрашивают, зачем на собеседованиях требуют сортировки писать — так вот для этого! Вдруг вам придётся писать на «VBA»?
    > Как в VBA правильно создавать одномерный массив. ArrayList
    https://habr.com/ru/post/712000/

    ISO, 23 Января 2023

    Комментарии (279)
  10. Java / Говнокод #28543

    +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
    static private Double getHashString(String string, Integer foundation){
        Double hash = 0.0 ;
        short [] charsToInteger = getCharArray(string);
        double step = Double.MAX_VALUE / 256 - foundation;
        for (int i = 0; i < charsToInteger.length ; i++ ){
            hash += charsToInteger[i] * step;
            step = step / 2 - 1;
        }
        return hash;
    }
    
    static private short [] getCharArray(String string){
        char [] chars = string.toLowerCase().toCharArray();
        short [] bytes = new short [chars.length];
        for (int i = 0; i < chars.length; i++){
            bytes [i] = (short) (chars[i] & 0x00FF);
            //System.out.println("bytes [" + i + "] = " + bytes[i]);
        }
        return bytes;
    }

    Вычисление сигнатуры строки для её применения в сортировке строк в алфавитном порядке по всем символам
    https://habr.com/ru/post/709406/ / https://itnan.ru/post.php?c=1&p=709406
    https://github.com/Helgi-cell/HashStringAlphabetical

    ISO, 08 Января 2023

    Комментарии (43)
  11. Куча / Говнокод #28530

    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
    table inet filter {
        set open_ports {
            type inet_proto . inet_service
            counter
            elements = { tcp . 123 counter packets 0 bytes 0,
                     udp . 123 counter packets 0 bytes 0,
                     tcp . 456 counter packets 0 bytes 0,
                     tcp . 567 counter packets 0 bytes 0 }
        }
    
        chain input {
            type filter hook input priority filter; policy drop;
            iifname "eth*" ct state established,related accept
            iifname "eth*" ct state invalid drop
            iifname "eth*" ct state new meta l4proto . th dport @open_ports accept
        }
    }

    «nftables» — охуенны.

    ISO, 30 Декабря 2022

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