1. Куча / Говнокод #27374

    0

    1. 1
    Пиздец-оффтоп #18

    #1: https://govnokod.ru/26503 https://govnokod.xyz/_26503
    #2: https://govnokod.ru/26541 https://govnokod.xyz/_26541
    #3: https://govnokod.ru/26583 https://govnokod.xyz/_26583
    #4: https://govnokod.ru/26689 https://govnokod.xyz/_26689
    #5: https://govnokod.ru/26784 https://govnokod.xyz/_26784
    #5: https://govnokod.ru/26839 https://govnokod.xyz/_26839
    #6: https://govnokod.ru/26986 https://govnokod.xyz/_26986
    #7: https://govnokod.ru/27007 https://govnokod.xyz/_27007
    #8: https://govnokod.ru/27023 https://govnokod.xyz/_27023
    #9: https://govnokod.ru/27098 https://govnokod.xyz/_27098
    #10: https://govnokod.ru/27125 https://govnokod.xyz/_27125
    #11: https://govnokod.ru/27129 https://govnokod.xyz/_27129
    #12: https://govnokod.ru/27184 https://govnokod.xyz/_27184
    #13: https://govnokod.ru/27286 https://govnokod.xyz/_27286
    #14: https://govnokod.ru/27298 https://govnokod.xyz/_27298
    #15: https://govnokod.ru/27322 https://govnokod.xyz/_27322
    #16: https://govnokod.ru/27328 https://govnokod.xyz/_27328
    #17: https://govnokod.ru/27346 https://govnokod.xyz/_27346

    nepeKamHblu_nemyx, 24 Апреля 2021

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

    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
    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
    def generate_words(sample, phonemes, num=10): 
        global words, yd
        gen = True
        parens = 0
        r = random.random()
        word = ""
        i = 0
        while i < int(num):
            for j in range(0, len(sample)):
                if sample[j] == '(':
                    if gen:
                        gen = (random.randint(0,1) == 0)
                    if not gen:
                        parens += 1
                elif sample[j] == ')':
                    if not gen:
                        parens -= 1
                    if parens == 0:
                        gen = True
                elif sample[j] in phonemes.keys():
                    for n, phtype in enumerate(phonemes.keys()):
                        if gen and phtype == sample[j]:
                            #k = random.choice(phonemes[phtype])
                            n = yd.randomGen(phonemeRanks[phtype])
                            k = phonemes[phtype][n]
                            word += k
                elif gen:
                    word += sample[j]
                        
            if (not word in words) and (not isExceptional(word)):
                words.append(word)
    
            i += 1
            word = ""
    
    # ...
    
    """parsing sound changes rule with the notation X>Y/Z, where X is a set of source phonemes
    Y - a set of resulting phonemes, Z - a positional condition (optional)"""
    def parsePhNotation(inline):
        rule = inline.split('>')
        if (not len(rule) == 2):
            return []
    
        source = rule[0].split(',')
        final = rule[1].split('/')
    
        result = final[0].split(',')
        posCond = []
        rule = []
        if (len(final) > 2):
            return False
        elif (len(final) == 2):
            posCond = final[1].split('_')
            if (not len(posCond) == 2):
                return []
            posCond[0] = posCond[0].split('#')
            posCond[1] = posCond[1].split('#')
    
    
            
            if (len(posCond[0]) == 2) and len(posCond[0][0]) > 0:
                return []
            elif len(posCond[0]) == 2:
                rule.append(" "+posCond[0][1])
            else:
                rule.append(posCond[0][0])
    
            if (len(posCond[1]) == 2) and len(posCond[1][1]) > 0:
                return []
    
            rule.append(posCond[1][0])
            if len(posCond[1]) == 2:
                rule[1] += " "
            
            rule[0] = rule[0].split(",")
            rule[1] = rule[1].split(",")
    
        final = []
        if len(source) > len(result):
            for i in range(len(result)-1, len(source)-1):
                result.append("")
        elif len(source) < len(result):
            for i in range(len(source)-1, len(result)-1):
                source.append("")
    
        final.append(source)
        final.append(result)
        if (len(rule)>0):
            final.append(rule)
        return final

    Рекурсивный спуск, автомат с магазинной памятью, top-down parsing, bottom-up parsing? Не, не слышал. В свое время время делал вот такие самопальные алгоритмы для рандомной генерации слов по фонетическим шаблонам (типа "CV(C)", "VC" и т.д.) и фонетического преобразования слов и при попытке починить чета наступал на новые баги, т.к. не до конца понимал как вообще парсятся компьютерные языки.

    JaneBurt, 24 Апреля 2021

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

    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
    -export([parse_transform/2, abstract/2]).
    
    parse_transform(Forms, _Options) ->
      normal(Forms).
    
    normal({call, _Line, {atom, _, '$$'}, [Outer]}) ->
      case Outer of
        {'fun', _, {clauses, Quoted}} ->
          %% Remove outer `fun' and only leave its clauses:
          ok;
        Quoted ->
          %% A plain term has been quoted, leave it as is:
          ok
      end,
      Result = abstract(Quoted),
      %% io:format("Quoted block ~p~n", [Result]),
      Result;
    normal(L) when is_list(L) ->
      lists:map(fun normal/1, L);
    normal(T) when is_tuple(T) ->
      list_to_tuple(lists:map(fun normal/1, tuple_to_list(T)));
    normal(T) ->
      T.
    
    -define(line, 0).
    
    %% @doc Create AST of the AST
    abstract({call, _Line, {atom, _, '$'}, [Splice]}) ->
      normal(Splice);
    abstract(Orig = {var, Line, VarName}) ->
      case lists:suffix("__AST", atom_to_list(VarName)) of
        true ->
          Orig;
        false ->
          {tuple, ?line, [ {atom, ?line, var}
                         , {integer, ?line, Line}
                         , {atom, ?line, VarName}
                         ]}
      end;
    abstract(T) when is_tuple(T) ->
      {tuple, ?line, lists:map(fun abstract/1, tuple_to_list(T))};
    abstract([]) ->
      {nil, ?line};
    abstract([Hd|Tail]) ->
      {cons, ?line, abstract(Hd), abstract(Tail)};
    abstract(A) when is_atom(A) ->
      {atom, ?line, A};
    abstract(I) when is_integer(I) ->
      {integer, ?line, I}.

    Мета-метушня, убогое подобие лисповского квотирования.

    CHayT, 23 Апреля 2021

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

    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
    #include <iostream>
    #include <fstream>
    using namespace std;
    //ifstream in("C://Users//Илья//Desktop//calc.exe", ios::binary);
    ifstream in("C://Users//Илья//Desktop//kernel32.dll", ios::binary );
    ofstream out("D:\\hello.txt");
    void printhex(int position, int size) 
    {
        int *A = new int[size];
        int n = 0;
        in.seekg(position);
        for (int i = 0; i < size; i++)
        {
            n = in.get();
            A[i] = n;
        }
        for (int i = (size-1); i >= 0; i--)
        {
            printf("%02X", A[i]);
        }
        cout << endl;
    }
    
    int printdec(int position, int size)
    {
        int* A = new int[size];
        int n = 0;
        int result = 0;
        in.seekg(position);
        for (int i = 0; i < size; i++)
        {
            n = in.get();
            A[i] = n;
        }
        for (int i = (size-1); i >= 0; i--)
        {
            result = result * 16 * 16 + A[i];
        }
        return result;
    }
    
    int main()
    {
        char c;
        int n;
        unsigned int n1 = 0;
        in.seekg(60); //положение байта, содержащего значение смещения;
        n1 = in.get();
        printf("%02X", n1); //вывод смещения;
        cout << endl;
        in.seekg(n1); //положение подписи (PE);
        for (int i = 0; i < 4; i++) 
        {
            c = in.get();
            cout << c; //вывод подписи (PE)
        }
        cout << endl;
        int numb_of_sect = printdec(n1 + 6, 2);
        cout << numb_of_sect << endl;
        printhex(n1 + 24, 2);
        printhex(n1 + 24 + 28, 4);
        printhex(n1 + 24 + 28 + 68, 4);
        int adr = printdec(n1 + 24 + 28 + 68, 4);
        cout << "-----------------" << endl;
        if(adr==0) //проверка наличия таблицы экспортов;
        {
            cout << "The export table is missing." << endl;
        } 
    }

    MyLogin1, 22 Апреля 2021

    Комментарии (34)
  5. Си / Говнокод #27370

    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
    #define l '!'
    main(int I){int _[]={[0]=01740,[10]=010[_
    ]>>4,[010]=0xf00,[0x10]=0,[011]=_[7]/0x10
    ,[013]=_[0011]/16,[13]=7,[014]=016,[14]=_
    [7]>>12,[15]=001,[01]=0x03fFC,[2]=0x781F,
    [3]=0x6E003,[4]=49152,[5]=_[04],['\a']=_[
    6]>>1,['\''-l]=074000,};for(I=0;I<l*17-l/
    2;++I,putchar((I%l<l/2)&&(_[I/(l)]&1<<15-
    (I%l))?0x23:(I%l>(l/2))&&((I/(l))[_]&1<<(
    15-((l-1)-(I%l))))?l|2:I*2==(((l/2)*_[13]
    +3)*4)>>!!1?(((!l)["Fuck you!"])*(_[0x0f]
    ))>>1:!(I^((l/2)*9+004))?042+1:I-(l/2)*30
    +02==!l?0x24^13[_]:!((I|((l/2)*32-1))^I)?
    35:I+(l/2)*34==I<<1?l+_[14]-(_[4]/5[_]):!
    !!!I*040),(I+1)%l==0?putchar(012):l+!l);}

    Я покакал

    Narsharab, 22 Апреля 2021

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

    −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
    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
    const connectToServerEpic = (
      action$,
    ) => (
      action$
      .pipe(
        ofType(CONNECT_TO_SERVER),
        switchMap(({
          hostname,
          port,
          protocol,
          protocolVersion,
          reconnectionTimeout,
        }) => (
          action$
          .pipe(
            ofType(RECONNECT_TO_SERVER),
            takeUntil(
              action$
              .pipe(
                ofType(DISCONNECT_FROM_SERVER),
              )
            ),
            startWith(null),
            map(() => (
              webSocket({
                protocol: protocolVersion,
                url: (
                  protocol
                  .concat('://')
                  .concat(hostname)
                  .concat(':')
                  .concat(port)
                ),
                WebSocketCtor: WebSocket,
              })
            )),
            switchMap((
              webSocketConnection$,
            ) => (
              webSocketConnection$
              .pipe(
                takeUntil(
                  action$
                  .pipe(
                    ofType(
                      RECONNECT_TO_SERVER,
                      DISCONNECT_FROM_SERVER,
                    ),
                  )
                ),
                catchError(() => (
                  timer(
                    reconnectionTimeout,
                  )
                  .pipe(
                    takeUntil(
                      action$
                      .pipe(
                        ofType(
                          RECONNECT_TO_SERVER,
                          DISCONNECT_FROM_SERVER,
                        ),
                      )
                    ),
                    mapTo(reconnectToServer()),
                  )
                )),
                map(receivedWebSocketMessage),
                startWith(
                  connectionReady(
                    webSocketConnection$,
                  )
                ),
              )),
            )),
          )
        )),
      )
    )

    https://itnext.io/simplifying-websockets-in-rxjs-a177b887f3b8

    DypHuu_niBEHb, 21 Апреля 2021

    Комментарии (39)
  7. JavaScript / Говнокод #27368

    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
    function main()
    {
    	const ac = [1, 2, 3];
    	let a = ac;
    	print(ac[0]);
    	print(ac[1]);
    	print(ac[2]);
    	print(a[0]);
    	print(a[1]);
    	print(a[2]);
    
    	const ac2 = [1.0, 2.0, 3.0];
    	let a2 = ac2;
    	print(ac2[0]);
    	print(ac2[1]);
    	print(ac2[2]);
    
    	print(a2[0]);
    	print(a2[1]);
    	print(a2[2]);
    
    	const ac3 = ["item 1", "item 2", "item 3"];
    	let a3 = ac3;
    	print(ac3[0]);
    	print(ac3[1]);
    	print(ac3[2]);
    
    	print(a3[0]);
    	print(a3[1]);
    	print(a3[2]);
    }
    
    // LLVM output
    
    ; ModuleID = 'LLVMDialectModule'
    source_filename = "LLVMDialectModule"
    target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-pc-windows-msvc"
    
    @frmt_11120820245497078329 = internal constant [4 x i8] c"%s\0A\00"
    @s_13298922352840505641 = internal constant [8 x i8] c"item 3\00\00"
    @s_13297965777724151296 = internal constant [8 x i8] c"item 2\00\00"
    @s_13300835503073214331 = internal constant [8 x i8] c"item 1\00\00"
    @a_14124738666956595718 = internal constant [3 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13300835503073214331, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13297965777724151296, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13298922352840505641, i64 0, i64 0)]
    @frmt_11108397963124010376 = internal constant [4 x i8] c"%f\0A\00"
    @a_17125214420326958200 = internal constant [3 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00]
    @frmt_11106471618751763154 = internal constant [4 x i8] c"%d\0A\00"
    @a_2366260266165782651 = internal constant [3 x i32] [i32 1, i32 2, i32 3]
    
    declare i8* @malloc(i64)
    
    declare void @free(i8*)
    
    declare i32 @printf(i8*, ...)
    
    define void @main() !dbg !3 {
      %1 = alloca i32*, align 8, !dbg !7
      store i32* getelementptr inbounds ([3 x i32], [3 x i32]* @a_2366260266165782651, i64 0, i64 0), i32** %1, align 8, !dbg !7
      %2 = load i32*, i32** %1, align 8, !dbg !7
      %3 = alloca i32*, align 8, !dbg !9
      store i32* %2, i32** %3, align 8, !dbg !9
      %4 = load i32*, i32** %1, align 8, !dbg !7
      %5 = getelementptr i32, i32* %4, i32 0, !dbg !10
      %6 = load i32, i32* %5, align 4, !dbg !10
      %7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %6), !dbg !11
      %8 = load i32*, i32** %1, align 8, !dbg !7
      %9 = getelementptr i32, i32* %8, i32 1, !dbg !12
      %10 = load i32, i32* %9, align 4, !dbg !12
      %11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %10), !dbg !13
      %12 = load i32*, i32** %1, align 8, !dbg !7
      %13 = getelementptr i32, i32* %12, i32 2, !dbg !14
      %14 = load i32, i32* %13, align 4, !dbg !14
      %15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %14), !dbg !15
      %16 = load i32*, i32** %3, align 8, !dbg !9
      %17 = getelementptr i32, i32* %16, i32 0, !dbg !16
      %18 = load i32, i32* %17, align 4, !dbg !16
      %19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %18), !dbg !17
      %20 = load i32*, i32** %3, align 8, !dbg !9
      %21 = getelementptr i32, i32* %20, i32 1, !dbg !18
      %22 = load i32, i32* %21, align 4, !dbg !18
      %23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %22), !dbg !19
      %24 = load i32*, i32** %3, align 8, !dbg !9
      %25 = getelementptr i32, i32* %24, i32 2, !dbg !20
      %26 = load i32, i32* %25, align 4, !dbg !20
      %27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %26), !dbg !21
      %28 = alloca float*, align 8, !dbg !22
      store float* getelementptr inbounds ([3 x float], [3 x float]* @a_17125214420326958200, i64 0, i64 0), float** %28, align 8, !dbg !22
      %29 = load float*, float** %28, align 8, !dbg !22
      %30 = alloca float*, align 8, !dbg !23
      store float* %29, float** %30, align 8, !dbg !23
      %31 = load float*, float** %28, align 8, !dbg !22
      %32 = getelementptr float, float* %31, i32 0, !dbg !24
      %33 = load float, float* %32, align 4, !dbg !24
      %34 = fpext float %33 to double, !dbg !25
      %35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11108397963124010376, i64 0, i64 0), double %34), !dbg !25
      %36 = load float*, float** %28, align 8, !dbg !22
      %37 = getelementptr float, float* %36, i32 1, !dbg !26
      %38 = load float, float* %37, align 4, !dbg !26
      %39 = fpext float %38 to double, !dbg !27
      %40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11108397963124010376, i64 0, i64 0), double %39), !dbg !27

    продолжаем нашу е..блю с компилятором а ля "C" но только используя синтакс TypeScript

    дальше это гвно при запуска tsc.exe --emit=llvm c:\1.ts

    получаем равернутую раскладку го-в-на которе можно перевести в Obj файл

    а если запустим EXE получим такую Х типа "1 2 3 1 2 3 1.0 2.0 3.0 1.0 2.0 3.0 item 1 item 2 item 3 item 1 item 2 item 3"

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

    ASD_77, 20 Апреля 2021

    Комментарии (44)
  8. Java / Говнокод #27367

    +1

    1. 1
    there are java.io.FileNotFoundException and java.nio.file.NoSuchFileException . Both are subclasses of IOException, neither of them is a subclass of the opposite.

    DypHuu_niBEHb, 20 Апреля 2021

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

    +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
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    private List<CellControl[]> ComposeLines(List<CellControl[]> vertical, List<CellControl[]> horizontal)
            {
                List<CellControl[]> result = new List<CellControl[]>();
    
                foreach (var vLine in vertical)
                {
                    var cellsCount = vLine.Length;
                    List<CellControl[]> linesToCompose = new List<CellControl[]>();
                    foreach (var vCell in vLine)
                    {
                        foreach (var hLine in horizontal)
                        {
                            foreach (var hCell in hLine)
                            {
                                if (hCell.X == vCell.X && hCell.Y == vCell.Y)
                                {
                                    linesToCompose.Add(hLine);
                                    cellsCount += hLine.Length;
                                    break;
                                }
                            }
    
                            if (linesToCompose.Count == 0)
                            {
                                result.Add(hLine);
                            }
                        }
                    }
    
                    if (linesToCompose.Count == 0)
                    {
                        result.Add(vLine);
                    }
                    else
                    {
                        linesToCompose.Add(vLine);
                        var newLine = new CellControl[cellsCount];
                        var i = 0;
                        foreach (var line in linesToCompose)
                        {
                            foreach (var cellControl in line)
                            {
                                newLine[i] = cellControl;
    
                                cellControl.Selected = true;
                                i++;
                            }
                        }
                        
                        result.Add(newLine);
                    }
                }
                
                return result;
            }

    mdd-inbox, 20 Апреля 2021

    Комментарии (2)
  10. Куча / Говнокод #27365

    −1

    1. 1
    Чепига снова начинает остопяздывать.

    rotoeb, 19 Апреля 2021

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