1. Python / Говнокод #29149

    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
    def animate_fight (self, игрок):
           if self.gamedata.animate_fight == True: 
              
              if self.gamedata.fight_animation_progress < 3:
               self.gamedata.screen.blit(self.fight1, (self.x - (self.width // 2), self.y - (self.width //2) ))
               
              elif 3 <= self.gamedata.fight_animation_progress < 6:
               self.gamedata.screen.blit(self.fight2, (self.x - (self.width // 2), self.y - (self.width //2) ))
    
              elif  6 <= self.gamedata.fight_animation_progress < 9:
               self.gamedata.screen.blit(self.fight3, (self.x - (self.width // 2), self.y - (self.width //2) ))
               self.gamedata.screen.blit(self.fight1, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
              elif  9 <= self.gamedata.fight_animation_progress < 12:
               self.gamedata.screen.blit(self.fight4, (self.x - (self.width // 2), self.y - (self.width //2) ))
               self.gamedata.screen.blit(self.fight2, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
              elif  12 <= self.gamedata.fight_animation_progress < 15:
               self.gamedata.screen.blit(self.fight5, (self.x - (self.width // 2), self.y - (self.width //2) ))
               self.gamedata.screen.blit(self.fight3, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
              elif  15 <= self.gamedata.fight_animation_progress < 18:
               self.gamedata.screen.blit(self.fight6, (self.x - (self.width // 2), self.y - (self.width //2) ))
               self.gamedata.screen.blit(self.fight4, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
              elif  18 <= self.gamedata.fight_animation_progress < 21:
                 self.gamedata.screen.blit(self.fight5, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
    
              elif  21 <= self.gamedata.fight_animation_progress < 24:
                 self.gamedata.screen.blit(self.fight6, (игрок.x - (self.width // 2), игрок.y - (self.width // 2) ))
               
              elif  24 <=self.gamedata.fight_animation_progress:
                 self.gamedata.animating = False
                 self.gamedata.fight_animation_progress = 0
                 self.gamedata.animate_fight = False
              if 24 > self.gamedata.fight_animation_progress:
               self.gamedata.fight_animation_progress += 1

    Зачем делить на 3, если можно написать кучу говна?

    1004w, 02 Июля 2025

    Комментарии (2)
  2. Python / Говнокод #29135

    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
    before = []
    
    def bef():
        global before
        return before
    
    def setB(b):
        global before
        before = b
    
    def foo():
        revert(bef())

    NikitaTsyb, 15 Мая 2025

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

    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
    def pause(c):                                             #replace, assist
        if c > 100: waitLong(c)
        elif c== 1: wait1s()
        elif c== 2: wait2s()
        elif c== 3: wait3s()
        elif c== 5: wait5s()
        elif c== 8: wait8s()
        elif c== 10: wait10s()
        else:
            logger.debug(f"custom timeout, need recheck({c})")
            p(c)   #ping raspberry instead of direct sleep
    
    def p(c):
        time.sleep(c)
    
    def wait1s():
        p(1)
    
    def wait2s():
        wait1s()
        wait1s()
    
    def wait3s():
        logger.debug("one, two, three")
        p(3)   
    
    def wait5s():
        logger.debug("5, 4, 3, 2, 1..")
        p(5)
    
    def wait8s():
        wait5s()
        wait3s()
    
    def wait10s():
        wait5s()
        wait5s()
    
    def waitLong(c):
        logger.debug(f"Attention, wait time is too long({c}), need to replace with waiting for some event or ping")
        p(c)
    
    def cc():
        global client
        client.connect()
        return(client)

    NikitaTsyb, 15 Мая 2025

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

    0

    1. 1
    2. 2
    import photoshop
    photoshop.CreateProgram()

    BelCodeMonkey, 10 Мая 2025

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

    0

    1. 1
    def neg(x): return int(bin(x)[2:].rjust(8, '0').replace('1','x').replace('0','1').replace('x','0'), 2)

    Операция "NEG"

    j123123, 16 Января 2025

    Комментарии (49)
  6. Python / Говнокод #28934

    0

    1. 1
    c.execute(f"UPDATE users SET cash = {c.execute(f'SELECT cash FROM users WHERE id = {inter.author.id}') - row[1]} WHERE id = {inter.author.id}")

    Новый уровень в говногенерации SQL-запросов...

    Vindicar, 29 Марта 2024

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

    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
    if "=" in cell_content:
                command["relation"] = "eq"
            elif "≠" in cell_content or "!=" in cell_content:
                command["relation"] = "ne"
            elif "<" in cell_content or "<" in cell_content:
                command["relation"] = "lt"
            elif "≤" in cell_content:
                command["relation"] = "le"
            elif ">" in cell_content or ">" in cell_content:
                command["relation"] = "gt"
            elif "≥" in cell_content:
                command["relation"] = "ge"

    Не, ну а как еще-то

    youjin1985, 14 Марта 2024

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

    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
    def razmer(arr):
     b = len (arr) - 1
     return (array_prov(arr,b))
    
    def array_prov (arr,b):
     if b == 0:
         return arr[b]
     else:
         return (arr[b]+array_prov (arr, b-1))
    
    a = [10,12,14,15,18]
    print (razmer (a))

    1004w, 12 Марта 2024

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    def print_message(num_of_times) {
        for i in range(num_of_times) {
            print("Bython is awesome!");
        }
    }
    
    if __name__ == "__main__" {
        print_message(10);
    }

    Python with braces. Because Python is awesome, but whitespace is awful.

    https://pypi.org/project/Bython/

    nemyx, 11 Марта 2024

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

    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
    import sys
    
    
    def do_govno(govno: str) -> None:
        pass
    
    
    def main() -> int:
        if len(sys.argv) != 2:
            print(f'Usage: {sys.argv[0]} <govno>')
            return EXIT_FAILURE
        
        govno = sys.argv[1]
        do_govno(govno)
        
        return EXIT_SUCCESS
    
    
    if __name__ == '__main__':
        exit_code = main()
        sys.exit(exit_code)

    ISO, 13 Февраля 2024

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