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

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

    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
    # Теперь нам нужны несколько изображений для выполнения
    # логического вывода. Давайте загрузим их с помощью wget.
    
    urls = [
        "https://mir-s3-cdn-cf.behance.net/project_modules/max_3840/2712bd29493563.55f6ec5e98924.jpg",
        "https://i.pinimg.com/736x/5a/8a/5c/5a8a5c4cd658580ae4719e5c96043541.jpg",
        "https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/4d222729493563.55f6420cd3768.jpg"
    ]
    downloaded_files = []
     
    for index, url in enumerate(urls, start=1):
      os.system(f"wget {url} -O pose-{index}.jpg")
      downloaded_files.append(f"pose-{index}.jpg")

    Датасаентист — не программист, и сегодня ему предстояла трудная ночь...

    https://habr.com/ru/articles/772558/

    ISO, 08 Ноября 2023

    Комментарии (15)
  3. JavaScript / Говнокод #28831

    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
    Events.on(EventType.ClientLoadEvent, () => {
        
        const oneDialog = new BaseDialog(" ");
        oneDialog.cont.add(" ").row();
        oneDialog.cont.button("OK", () => {
            oneDialog.hide();
          
            const twoDialog = new BaseDialog(" ");
            twoDialog.cont.add(" ").row();
            twoDialog.cont.button("OK", () => {
                twoDialog.hide();
              
                const threeDialog = new BaseDialog(" ");
                threeDialog.cont.add(" ").row();
                threeDialog.cont.button("OK", () => {
                    threeDialog.hide();
                  
                    const fourDialog = new BaseDialog(" ");
                    fourDialog.cont.add(" ").row();
                    fourDialog.cont.button("OK", () => {
                        fourDialog.hide();
                      
                        const fiveDialog = new BaseDialog(" ");
                        fiveDialog.cont.add(" ").row();
                        fiveDialog.cont.button("OK", () => {
                            fiveDialog.hide();
                          
                            const sixDialog = new BaseDialog(" ");
                            sixDialog.cont.add(" ").row();
                            sixDialog.cont.button("OK", () => {
                                sixDialog.hide();
                              
                                const sevenDialog = new BaseDialog(" ");
                                sevenDialog.cont.add(" ").row();
                                sevenDialog.cont.button("OK", () => {
                                    sevenDialog.hide();
                                  
                                    const eightDialog = new BaseDialog(" ");
                                    eightDialog.cont.add(" ").row();
                                    eightDialog.cont.button("OK", () => {
                                        eightDialog.hide();
                                      
                                        const nineDialog = new BaseDialog(" ");
                                        nineDialog.cont.add(" ").row();
                                        nineDialog.cont.button("OK", () => {
                                            nineDialog.hide();
                                          
                                            const tenDialog = new BaseDialog(" ");
                                            tenDialog.cont.add(" ").row();
                                            tenDialog.cont.button("OK", () => {
                                                tenDialog.hide();
                                              
                                                const elevenDialog = new BaseDialog(" ");
                                                elevenDialog.cont.add(" ").row();
                                                elevenDialog.cont.button("OK", () => {
                                                elevenDialog.hide();
                                              
                                                    const twelveDialog = new BaseDialog(" ");
                                                    twelveDialog.cont.add(" ").row();
                                                    twelveDialog.cont.button("OK", () => {
                                                    twelveDialog.hide();
                                                    
                                                        const thirteenDialog = new BaseDialog(" ");
                                                        thirteenDialog.cont.add(" ").row();
                                                        thirteenDialog.cont.button("OK", () => {
                                                        thirteenDialog.hide();
                                                        
                                                            const fourteenDialog = new BaseDialog(" ");
                                                            fourteenDialog.cont.add(" ").row();
                                                            fourteenDialog.cont.button("OK", () => {
                                                            fourteenDialog.hide();
                                                              
                                                                const fifteenDialog = new BaseDialog(" ");
                                                                fifteenDialog.cont.add(" ").row();
                                                                fifteenDialog.cont.button("OK", () => {fifteenDialog.hide();if(Core.settings.get("wentdowntherabbithole",false)){
                                                                 const again = new BaseDialog(" ");
    // ...

    https://github.com/camelStyleUser/popup-unforked/blob/main/scripts/main.js

    girixok149, 03 Августа 2023

    Комментарии (15)
  4. Java / Говнокод #28600

    −4

    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
    import java.lang.Math;
    import java.util.Random;
    
    public class MyVector {
    
        public static MyVector[] generateVectors(int N) {
            MyVector[] generated_vectors = new MyVector[N];
            for (int i = 0; i < N; i++) {
                MyVector vec = new MyVector();
                generated_vectors[i] = vec;
            }
            return generated_vectors;
        }
    
        public MyVector(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    
        public MyVector() {
            final Random random = new Random();
            this.x = random.nextInt();
            this.y = random.nextInt();
            this.z = random.nextInt();
        }
    
        public double getX() { return this.x; }
        public void setX(double newX) { this.x = newX; }
    
        public double getY() { return this.y; }
        public void setY(double newY) { this.y = newY; }
    
        public double getZ() { return this.z; }
        public void setZ(double newZ) { this.z = newZ; }
    
        public double getLength() {
            return Math.sqrt(Math.pow(this.x, 2) +
                             Math.pow(this.y, 2) +
                             Math.pow(this.z, 2));
        }
    
        public String toString() {
            StringBuilder representation = new StringBuilder();
            representation.
                append(" { ").
                append(this.x).
                append(" ; ").
                append(this.y).
                append(" ; ").
                append(this.z).
                append(" } ");
            return representation.toString();
        }
    
        public double scalarProduct(MyVector vec) {
            return (this.getX() * vec.getX() +
                    this.getY() * vec.getY() +
                    this.getZ() * vec.getZ());
        }
    
        public MyVector vectorProduct(MyVector vec) {
            MyVector result = new MyVector();
            result.setX(this.getY() * vec.getZ() -
                        this.getZ() * vec.getY());
            result.setY(this.getZ() * vec.getX() -
                        this.getX() * vec.getZ());
            result.setZ(this.getX() * vec.getY() -
                        this.getY() * vec.getX());
            return result;
        }
    
        public MyVector substract(MyVector vec) {
            MyVector result = new MyVector();
            result.setX(this.getX() - vec.getX());
            result.setY(this.getY() - vec.getY());
            result.setZ(this.getZ() - vec.getZ());
            return result;
        }
    
        public MyVector add(MyVector vec) {
            MyVector result = new MyVector();
            result.setX(this.getX() + vec.getX());
            result.setY(this.getY() + vec.getY());
            result.setZ(this.getZ() + vec.getZ());
            return result;
        }
    
        private double x;
        private double y;
        private double z;
    }

    Что здесь не так?

    JloJle4Ka, 13 Февраля 2023

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

    +1

    1. 1
    СТРЗАМЕНИТЬ(СОКРЛ(СТРЗАМЕНИТЬ(уатПутевойЛист.Номер, "0", " ")), " ", "0") КАК НомерПЛ,

    Удаляет нули в номере документа для вывода на печатную форму

    serving12, 18 Августа 2022

    Комментарии (15)
  6. Assembler / Говнокод #28099

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    .org 80h
    src: db "++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+."
    table:
    	db 0h db 3Eh dw @i1
    	db 0h db 3Ch dw @i2
    	db 0h db 2Bh dw @i3
    	db 0h db 2Dh dw @i4
    	db 0h db 5Dh dw @i5
    	db 0h db 2Eh dw @i6
    	db 0h db 5Bh dw @i7
    start: ; %a iptr %b dptr ;
    	.loop:
    		mov %cl [%a + @src]
    		cmp %cl 0h
    		je @.loop.break
    		mov %si 0h
    		.tloop:
    			mov %ch [4h * %si + {@table + 1h}]
    			cmp %cl %ch
    			jne @.tloop.continue
    				push @.tloop.break
    				mov %ip [4h * %si + {@table + 2h}]
    			.tloop.continue:
    			inc %si
    			cmp %si 8h
    			jl @.tloop
    			.tloop.break:
    		inc %a
    		jmp @.loop
    		.loop.break: 
    	int 0h
    i1: ; > ; 
    	inc %b ret
    i2: ; < ; 
    	dec %b ret
    i3: ; + ;
    	push %el
    	mov %el [%b + @data]
    	inc %el
    	mov [%b + @data] %el
    	pop %el
    	ret
    i4: ; - ;
    	push %el
    	mov %el [%b + @data]
    	dec %el
    	mov [%b + @data] %el
    	pop %el
    	ret
    i5: ; ] ;
    	push %c
    	mov %cl [%b + @data]
    	cmp %cl 0h
    	je @.loop.break
    	mov %c 0h
    	dec %a
    	.loop:
    		cmpb [%a + @src] 5Dh ; ']' ;
    		jne @.loop.1
    			inc %c
    		.loop.1:
    		cmpb [%a + @src] 5Bh ; '[' ;
    		jne @.loop.2
    			cmp %c 0h
    			jz @.loop.break
    			dec %c
    		.loop.2:
    		loop %a @.loop
    	.loop.break:
    	pop %c
    	ret
    i6: ; . ;
    	push %cl
    	outb E9h [%b + @data]
    	.wait:
    		inb %cl E9h
    		cmp %cl 0h
    		jne @.wait
    	pop %cl
    	ret
    i7: ; [ ;
    	push %c
    	mov %c [%b + @data]
    	cmp %c 0h
    	jne @.loop.break
    	mov %c 0h
    	.loop:
    		cmpb [%a + @src] 5Bh ; '[' ;
    		jne @.loop.1
    			inc %c
    		.loop.1:
    		cmpb [%a + @src] 5Dh ; ']' ;
    		jne @.loop.2
    			cmp %c 0h
    			jz @.loop.break
    				dec %c
    		.loop.2:
    		inc %a
    		jmp @.loop
    	.loop.break: pop %c ret

    Hello World!

    kcalbCube, 31 Марта 2022

    Комментарии (15)
  7. Куча / Говнокод #27759

    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
    Let's count a number of rules that can be built in GoL-like automatas. Rule is the matrix that maps some condition of cells to new state.
    Cell itself could be alive or dead. And cell could have 0-8 neighbors. So, there are 2^(2*9) = 262144 different rules. Well known, that
    the majority of them are primitive and produces some pure pattern or just dies in finite number of generations / infinitely fills the world
    with alive cells. We also know that some rules are symmetric to each other as if we just rename (swap colors of) alive and dead cells.
    
    Conway found the most interesting rule from entropy point of view.
    
    2^18 is not so much. Let's take a look at 2D automata known as Rule 110. State 100 keeps cell dead:
    
    100 -> 0
    
    While state 001 makes cell alive:
    
    001 -> 1
    
    In terms of neighborhood, this two rules are indifferent: both means one live neighbor next to dead cell. But in Rule 110 not only a /number/
    of neighbors is meaningful, but the /position/ of separate neighbor.
    
    Let's imagine the GoL-like rule with the same property: we will look not only at number of neighbors, but at their position. What if to have one
    neighbor at north-west gives not the same result as if neighbor were at south-east.
    
    This change gives us much more different rules. If each neighbor is meaningful, then we have 2 ^ 8 different states of neighborhood, and cell
    could be still alive or dead. If I'm not wrong there must be 2 ^ (2 * (2 ^ 8)) = 2 ^ 512 different rules.
    
    Obviously, this space includes Conway's Game of Life and all different rules from that 262144, and gives billions of new ones. Obviously,
    the majority of them are trivial too. But there may be some interesting entropy-like rules different from the Conway's one.
    
    This space is too huge to be discovered manually, and even with bruteforce algorithms too. But evolution algorithms could be used to find rules
    with some special properties.
    
    So, I have two questions:
    
    1) Does this space has a given name, anybody researched that?
    
    2) I will be glad to hear any ideas on how to make this space simpler by excluding symmetric states etc. to save the time for discovering.

    Any cellular nerds here?

    vistefan, 20 Октября 2021

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

    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
    #include <functional>
    #include <string>
    
    void rooster(uint32_t number)
    {
    
    }
    
    void rooster(std::string& str)
    {
    
    }
    
    int main()
    {
        //не осилил ни один компилятор
        std::function<void(std::string&)> f = std::bind(&rooster, std::placeholders::_1);
        //осилил gcc6.1+, но не может осилить clang 13.0
        std::function<void(std::string&)> f2 = std::bind<void(std::string&)>(&rooster, std::placeholders::_1);
    
        return 0;
    }

    Почему компиляторы крестов не могут сами разрулить ситуацию?

    mvngr, 08 Октября 2021

    Комментарии (15)
  9. Куча / Говнокод #27455

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Ltac solveInstr :=
      unfold mov, ldr,
      str, cmp,
      jnz, jmp, halt, fail,
      hvc, run, yield, share, lend, donate,
      retrieve, relinquish, reclaim, send, wait,
      option_state_unpack, unpack_hvc_result_normal, unpack_hvc_result_yield,
      get_reg, update_reg, update_incr_PC, get_memory, update_memory;
      repeat case_match;
      subst; eauto.

    Hijikata, 05 Июня 2021

    Комментарии (15)
  10. Си / Говнокод #27407

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    // https://github.com/sergev/bkunix/blob/master/src/bin/pwd.c
    void
    cat(name)
    	char *name;
    {
    	register int i, j;
    
    	i = -1;
    	while (name[++i] != 0);
    	if ((off+i+2) > 511) {
    		write(2, "pwd: too long path\n", 19);
    		exit(1);
    	}
    	for (j=off+1; j>=0; --j)
    		path[j+i+1] = path[j];
    	off=i+off+1;
    	path[i] = '/';
    	for (--i; i>=0; --i)
    		path[i] = name[i];
    }
    
    char * ckroot(dev, ino)
    int dev, ino;
    {
    	DIR * dir;
    	struct stat st;
    	register struct dirent * d;
    	chdir("/");
    	dir = opendir("/");
    	do {
    		d = readdir(dir);
    		if (! d) {
    			return "[mount point]";
    		}
    		stat(d->d_name, &st);
    	} while (st.st_dev != dev || st.st_ino != ino);
    	closedir(dir);
    	return d->d_name;
    }
    
    int
    main()
    {
    	int rdev, rino;
    	DIR *dir;
    	struct stat dot, dotdot;
    	register struct dirent *d;
    
    	stat("/", &dot);
    	rdev = dot.st_dev;
    	rino = dot.st_ino;
    /*printf ("/ dev=%d ino=%d\n", rdev, (int) rino);*/
    	for (;;) {
    		stat(".", &dot);
    /*printf (". dev=%d ino=%d\n", (int) dot.st_dev, (int) dot.st_ino);*/
    		if (dot.st_ino == rino && dot.st_dev == rdev)
    			break;
    		dir = opendir("..");
    		if (! dir) {
    			write(2, "pwd: cannot open ..\n", 20);
    			return 1;
    		}
    		stat("..", &dotdot);
    /*printf (".. dev=%d ino=%d\n", (int) dotdot.st_dev, (int) dotdot.st_ino);*/
    		chdir("..");
    		if (dot.st_dev == dotdot.st_dev) {
    			if (dot.st_ino == dotdot.st_ino) {
    				cat(ckroot(dot.st_dev, dot.st_ino));
    				break;
    			}
    			do {
    				d = readdir(dir);
    				if (! d) {
    					write(2, "read error in ..\n", 17);
    					return 1;
    				}
    			} while (d->d_ino != dot.st_ino);
    		} else {
    			do {
    				d = readdir(dir);
    				if (! d) {
    					write(2, "read error in ..\n", 17);
    					return 1;
    				}
    				stat(d->d_name, &dotdot);
    /*printf ("%.14s dev=%d ino=%d\n", d->d_name, (int) dotdot.st_dev, (int) dotdot.st_ino);*/
    			} while (dotdot.st_ino != dot.st_ino ||
    				dotdot.st_dev != dot.st_dev);
    		}
    		closedir(dir);
    		cat(d->d_name);
    /*path[off] = 0; printf ("pwd %s\n", path);*/
    	}
    	write(1, "/", 1);
    	if (off < 0)
    		off = 0;
    	path[off] = '\n';
    	write(1, path, off + 1);
    	return 0;
    }

    какой pwd )))

    j123123, 09 Мая 2021

    Комментарии (15)
  11. Си / Говнокод #27393

    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
    //glsl vertex shader
    attribute float mass;
    uniform vec3 center;
    
    #define RAD 10.0
    const float D = RAD * 2.0;
    
    ///////////////////THIS///////////////////
    float repeat(float x, float z) {
      float dx = distance(x, z);
      while(dx > RAD) {
        if (x > z) {
          x -= D;
        } else {
          x += D;
        }
        dx = distance(x, z);
      }
      return x;
    }
    ///////////////////////////////////////////
    
    vec3 repeat(vec3 x, vec3 y) {
      return vec3(dr(x.x, y.x), dr(x.y, y.y), dr(x.z, y.z));
    }
    
    void main() {
      vec3 pos = position;
      pos.z += time;
      pos = repeat(pos, center);
      
      vec4 mvPosition = modelViewMatrix * vec4(pos, 1.0);
      gl_PointSize = 70.0 * mass;
      gl_Position = projectionMatrix * mvPosition;
    }

    По сути функция repeat должна повторять текстуру (как background-repeat: repeat в css) в зависимости от положения точки центра, короче: двигается центр, двигается и текстура за ним. Мне даже ума не хватает описать это, поэтому формулу сам искал, хватило ума только на это говно. Спустя несколько недель додумался до следующего говна, уже без цикла:
    float repeat(float x, float z) {
    float mp = x > z ? -1.0 : 1.0;
    z += RAD * mp;
    float dx = distance(x, z);
    float n = floor(dx / D) * D;
    x += n*mp;
    return x;
    }
    Тяжело не знать математики. Может местные шизы подскажут как называется такое поведение и как нормальную формулу?

    sobakapavlova, 06 Мая 2021

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