Поиск хода в Небеса : уникальная игра !

Материал из UoPilot
Перейти к навигации Перейти к поиску

Описание

Видео-инструкция настройки скрипта при помощи дополнительного скрипта (указан после основного скрипта).
Пилот запускать от администратора.

Версия

3.0
Внесённые изменения:
1. В лог выводятся все варианты хода.
2. Добавлен расчёт стоимости хода.

// имя стоимость цвет
init_arr %imya (1) Череп 6 11988223
init_arr %imya (2) Красный 5 196688
init_arr %imya (3) Жёлтый 3 171991
init_arr %imya (4) Зелёный 1 393204
init_arr %imya (5) Крест 1 7834774

Череп стоит 6, красный 5. Т. е. если будет найдено 3 черепа и 3 красных будет сделан ход черепа, т. к. 3 (черепа)* 6 (стоимость) = 18, больше чем 3 (красных) * 5 (стоимость) = 15. Стоимость можно менять в зависимости от того что приоритетнее. Указывать число от 1 и выше.
3. Ходы где будет составлено 2 ряда тоже просчитываются. Т .е . если найдены ходы: 3 черепа и 3 красных + 3 жёлтых, то будет сделан ход с красным и жёлтым, т. к. 3 черепа это 18 очков, а красный с жёлтым это 24 (3*5 + 3*3).
4. Ход из 5 в ряд всегда в приоритете. Если такой ход возможен, то он будет сделан независимо от стоимости других ходов.

Минимальная версия UOPilot

2.38

Скрипт

Поиск хода

// Небеса поиск хода
init_arr %hod (1) 849, 204 936748    // кнопка хода
init_arr %LevVerh (1) 848, 259      // левая верхняя картинка

// имя стоимость цвет
init_arr %imya (1) Череп 6 11988223
init_arr %imya (2) Красный 5 196688
init_arr %imya (3) Жёлтый 3 171991
init_arr %imya (4) Зелёный 1 393204
init_arr %imya (5) Крест 1 7834774

set #workwin 0   // 0 - в активном окне, 1- в перекрытом


if  #workwin = 0
    set #handle 2
    init_arr %workwindow (1) 0 0             // не изменять!!
else
    init_arr %workwindow (1) 0 0           // смещение между родительским и дочерним окном
    set #handle findwindow (Небеса)
end_if

gosub begin

:start
gosub poisk                   // поиск картинок
call line6 %a $regexp6 0      // поиск ряд из 6
call line6 %b $regexp6 1      // столбец из 6
call line5 %a $regexp5 0      // ряд из 5
call line5 %b $regexp5 1      // столбец из 5
call line4 %a $regexp4 0      // ряд из 4
call line4 %b $regexp4 1      // столбец из 4
gosub line3                   // ряд из 3, стодбец из 3
gosub showresult              // вывод в лог результатов
gosub hod                     // просчёт хода

// ход
left #x1 #y1
wait 200
left #x2 #y2
wait 100
left 133, 575 20 20 20 20     // клик в любое место, чтобы курсор не оставался над картинками
wait 1000
goto start
End_script

:begin
set linedelay 0
if  workwindow = 0
    log Не указано рабочее окно
    End_script
end_if
log open
wait 100
set windowpos 0 0 500 400 loghandle
log clear
log mode compact
set $regexp6 "(\d)\1\1\d\1\1|(\d)\2\d\2\2\2|(\d)\d\3\3\3\3|(\d)\4\4\4\4\d|(\d)\5\5\5\d\5|\d(\d)\6\6\6\6"
set %reg [1 1] "(\d)\1\1\1\d\d|(\d)\d\2\2\2\2|(\d)\3\3\3\d\3|\d(\d)\4\4\4\d|\d\d(\d)\5\5\5|(\d)\d\6\6\6\d|"
set %reg [1 2] "(\d)\7\d\7\7\d|(\d)\8\8\d\8\d|\d(\d)\9\d\9\9|\d(?<10>\d)\k<10>\k<10>\d\k<10>|\d(?<11>\d)\d\k<11>\k<11>\k<11>"
set $regexp5 %reg [1]
set $regexp4 "(\d)\1\1|(\d)\2\d\2|(\d)\d\3\3|(\d)\4\4(\d)\5\5"
set $regexp3_1 "(\d)\1"
set $regexp3_2 "(\d)\d\1"

set #startX %LevVerh [1 1] + %workwindow [1 1]
set #startY %LevVerh [1 2] + %workwindow [1 2]
set #stepX 41
set #stepY 41
set #endX #startX + #stepX * 5
set #endY #startY + #stepY * 5
set #hodx %hod [1 1] + %workwindow [1 1]
set #hody %hod [1 2] + %workwindow [1 2]
return

:poisk
set size(%left)
set size(%left2)
set #result 0
if  #workwin = 0
    while_not #hodx #hody %hod [1 3]    // ждать появление кнопки хода
        wait 100
    end_while
else
    while_not color (#hodx #hody #handle) = %hod [1 3]    // для перекрытого окна
        wait 100
    end_while
end_if
wait 300
log clear
set timer

// создание сетки
set #a findcolor (#startX #startY #endX #endY #stepX #stepY (%imya [1 3] %imya [2 3] %imya [3 3] %imya [4 3] %imya [5 3]) %arr #handle)
//save_array %arr C:\Users\abc\Desktop\Setkafind.txt
if  #a > 0
    set #z 0
    for #i 1 6
        for #j 1 6
            set #z #z + 1
            switch %arr [#z 3]
                case %imya [1 3]: set %a [#i #j] 1       // череп
                    break
                case %imya [2 3]: set %a [#i #j] 2         // красный
                    break
                case %imya [3 3]: set %a [#i #j] 3         // жёлтый
                    break
                case %imya [4 3]: set %a [#i #j] 4       // крест
                    break
                case %imya [5 3]: set %a [#i #j] 5          // зелёный
            end_switch
        end_for
    end_for
    //save_array %a C:\Users\abc\Desktop\Setka.txt    //массив сетка
else
    goto start
end_if

for #i 1 size(%a)
    init_arr %b (#i)  %a[1 #i] %a[2 #i] %a[3 #i] %a[4 #i] %a[5 #i] %a[6 #i]
end_for
return



:line3
for #i 1 size(%a)
    set $string %a [#i]
    call line3_1 %a #i $string $string 0 $regexp3_1 0
    call line3_2 %a #i $string $string 0 $regexp3_2 0
end_for
set %a %b
for #i 1 size(%a)
    set $string %a [#i]
    call line3_1 %a #i $string $string 0 $regexp3_1 1
    call line3_2 %a #i $string $string 0 $regexp3_2 1
end_for
return

:showresult
if  size(%left) > 0
    for #i 1 size(%left)
        log Поменять местами %left [#i 2] %left [#i 1] и %left [#i 4] %left [#i 3]    Ряд из %left [#i 6]    %left [#i 7]
    end_for
else
    log Варианты не найдены
end_if
sort_array %left 6 dec
//save_array %left C:\Users\abc\Desktop\Resultleft.txt
return

:hod
if  %left [1 6] > 4
    set #summa1 %left [1 6] * %imya [%left [1 5] 2]
    log
    log Ход: %left [1 2] %left [1 1] и %left [1 4] %left [1 3]    Ряд из %left [1 6] %left [1 7]    Сумма: #summa1
    init_arr %xy (1) %left [1 2] %left [1 1] %left [1 4] %left [1 3]
else
    for #i 1 eval (size(%left) - 1)
        set #hod1 %left[#i 2]%left[#i 1]%left[#i 4]%left[#i 3]
        set #jj #i + 1
        for #j #jj eval (size(%left) - 1)
            set #hod2 %left[#j 4]%left[#j 3]%left[#j 2]%left[#j 1]
            if  #hod1 = #hod2
                set #zz #zz + 1
                set #summa %left [#i 6] * %imya [%left [#i 5] 2] + %left [#j 6] * %imya [%left [#j 5] 2]
                init_arr %left2 (#zz) %left[#i 2] %left[#i 1] %left[#i 4] %left[#i 3] %left[#i 6] %imya[%left[#i 5] 1] %left[#j 6] %imya[%left[#j 5] 1] #summa
            end_if
        end_for
    end_for
    for #k 1 size(%left)
        set #summa2 %left [#k 6] * %imya [%left [#k 5] 2]
        set %left [#k 8] #summa2
    end_for
    sort_array %left 8 dec
    sort_array %left2 5 dec
    if  #zz > 0
        if  %left [1 8] < %left2 [1 9]
            log
            log Ход: %left2 [1 1] %left2 [1 2] и %left2 [1 3] %left2 [1 4]    Ряд из %left2 [1 5] %left2 [1 6] и %left2 [1 7] %left2 [1 8]    Сумма: %left2 [1 9]
            init_arr %xy (1) %left2 [1 1] %left2 [1 2] %left2 [1 3] %left2 [1 4]
        else
            log
            log Ход: %left [1 2] %left [1 1] и %left [1 4] %left [1 3]    Ряд из %left [1 6] %left [1 7]    Сумма: %left [1 8]
            init_arr %xy (1) %left [1 2] %left [1 1] %left [1 4] %left [1 3]
        end_if
    else
        log
        log Ход: %left [1 2] %left [1 1] и %left [1 4] %left [1 3]    Ряд из %left [1 6] %left [1 7]    Сумма: %left [1 8]
        init_arr %xy (1) %left [1 2] %left [1 1] %left [1 4] %left [1 3]
    end_if
end_if
set #x1 (#startX + %xy [1 2] * #stepX) - #stepX - %workwindow [1 1]
set #y1 (#startY + %xy [1 1] * #stepY) - #stepY - %workwindow [1 2]
set #x2 (#startX + %xy [1 4] * #stepX) - #stepX - %workwindow [1 1]
set #y2 (#startY + %xy [1 3] * #stepY) - #stepY - %workwindow [1 2]
log
log На поиск хода затрачено: timer мсек
return

proc colrow #col1 #row1 #col2 #row2 #flagcolrow #number #cur #z
    set #result.#cur 1
    log mode compact
    if  #flagcolrow = 0
        set #size size(%left.#cur)
        set #size #size + 1
        set %left.#cur [#size 1] #row1
        set %left.#cur [#size 2] #col1
        set %left.#cur [#size 3] #row2
        set %left.#cur [#size 4] #col2
        set %left.#cur [#size 5] #z
        set %left.#cur [#size 6] #number
        set %left.#cur [#size 7] %imya.#cur [#z 1]
    else
        set #size size(%left.#cur)
        set #size #size + 1
        set %left.#cur [#size 1] #col1
        set %left.#cur [#size 2] #row1
        set %left.#cur [#size 3] #col2
        set %left.#cur [#size 4] #row2
        set %left.#cur [#size 5] #z
        set %left.#cur [#size 6] #number
        set %left.#cur [#size 7] %imya.#cur [#z 1]
    end_if
end_proc

// поиск 111110 011111 101111 110111 111011 111101 (проверка на 6 в ряд)
proc line6 %c $regexp #flagcolrow
    for #i 1 size(%c)
        set #n regexp (#pos $str %c[#i] $regexp)
        if  #n > 0
            if  #i < 6
                set #col #i + 1
                set #n regexp (#pos1 $str1 %c[#i] (\d)\1\1\1\1)
                if  #n > 0
                    if  #pos1 = 1
                        set #z copy($str1 1 1)
                        if  %c [#col 6] = #z
                            call colrow #i 6 #col 6 #flagcolrow 6 current_script #z
                        end_if
                    else
                        set #z copy($str1 5 1)
                        if  %c [#col 1] = #z
                            call colrow #i 1 #col 1 #flagcolrow 6 current_script #z
                        end_if
                    end_if
                else
                    set #n regexp (#position $strnew %c[#i] (?<=(\d))(?!\1)\d)
                    if  #n > 0
                        set #str %c[#i]
                        if  #position = 2
                            set #z copy($str 3 1)
                        else
                            set #z copy($str 2 1)
                        end_if
                        if  %c [#col #position] = #z
                            call colrow #i #position #col #position #flagcolrow 6 current_script #z
                        end_if
                    end_if
                end_if
            end_if
            if  #i > 1
                set #col #i - 1
                set #n regexp (#pos1 $str1 %c[#i] (\d)\1\1\1\1)
                if  #n > 0
                    if  #pos1 = 1
                        set #z copy($str1 1 1)
                        if  %c [#col 6] = #z
                            call colrow #i 6 #col 6 #flagcolrow 6 current_script #z
                        end_if
                    else
                        set #z copy($str1 5 1)
                        if  %c [#col 1] = #z
                            call colrow #i 1 #col 1 #flagcolrow 6 current_script #z
                        end_if
                    end_if
                else
                    set #n regexp (#position $strnew %c[#i] (?<=(\d))(?!\1)\d)
                    if  #n > 0
                        set #str %c[#i]
                        if  #position = 2
                            set #z copy($str 3 1)
                        else
                            set #z copy($str 2 1)
                        end_if
                        if  %c [#col #position] = #z
                            call colrow #i #position #col #position #flagcolrow 6 current_script #z
                        end_if
                    end_if
                end_if
            end_if
        end_if
    end_for
end_proc

// поиск 111100 011110 001111   101111 111101

proc line5 %c $regexp #flagcolrow
    for #i 1 size(%c)
        set #n regexp (#pos $str %c[#i] $regexp)
        if  #n > 0
            set #z copy($str 1 1)
            set #n2 regexp (#pos3 $str3 %c[#i] (\d)\1\1\1\1)  // проверка что не 11111
            if  #n2 = 0
                set #n1 regexp (#pos2 $str2 %c[#i] (\d)\d\1\1\1\1|(\d)\2\2\2\d\2)
                if  #n1 = 0         // если 111100 011110 001111
                    set #n regexp (#pos $str %c[#i] (\d)\1\1\1)
                    if  #n > 0
                        set #z copy($str 1 1)
                        if  #i < 6
                            set #col #i + 1
                            switch #pos
                                case 1:
                                    if  %c [#col 5] = #z
                                        call colrow #i 5 #col 5 #flagcolrow 5 current_script #z
                                    end_if
                                    break
                                case 2:
                                    if  %c [#col 1] = #z
                                        call colrow #i 1 #col 1 #flagcolrow 5 current_script #z
                                    end_if
                                    if  %c [#col 6] = #z
                                        call colrow #i 6 #col 6 #flagcolrow 5 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [#col 2] = #z
                                        call colrow #i 2 #col 2 #flagcolrow 5 current_script #z
                                    end_if
                            end_switch
                            if  #i > 1
                                set #col #i - 1
                                switch #pos
                                    case 1:
                                        if  %c [#col 5] = #z
                                            call colrow #i 5 #col 5 #flagcolrow 5 current_script #z
                                        end_if
                                        break
                                    case 2:
                                        if  %c [#col 1] = #z
                                            call colrow #i 1 #col 1 #flagcolrow 5 current_script #z
                                        end_if
                                        if  %c [#col 6] = #z
                                            call colrow #i 6 #col 6 #flagcolrow 5 current_script #z
                                        end_if
                                        break
                                    case 3:
                                        if  %c [#col 2] = #z
                                            call colrow #i 2 #col 2 #flagcolrow 5 current_script #z
                                        end_if
                                end_switch
                            end_if
                        end_if
                    end_if
                else
                    // 111101    101111
                    set #n regexp (#pos $str %c[#i] (\d)\1\1\1)
                    if  #n > 0
                        set #col1 #i + 1
                        set #col2 #i - 1
                        switch #i
                            case 1:
                                if  #pos = 1
                                    if  %c [#i 6] = #z and %c [#col1 5] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 5 current_script #z
                                    end_if
                                else
                                    if  %c [#i 1] = #z and %c [#col1 2] != #z
                                        call colrow #i 1 #i 2 #flagcolrow 5 current_script #z
                                    end_if
                                end_if
                                break
                            case 2:
                            case 3:
                            case 4:
                            case 5:
                                if  #pos = 1
                                    if  %c [#i 6] = #z and %c [#col1 5] != #z and %c [#col2 5] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 5 current_script #z
                                    end_if
                                else
                                    if  %c [#i 1] = #z and %c [#col1 2] != #z and %c [#col2 2] != #z
                                        call colrow #i 1 #i 2 #flagcolrow 5 current_script #z
                                    end_if
                                end_if
                                break
                            case 6:
                                if  #pos = 1
                                    if  %c [#i 6] = #z and %c [#col2 5] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 5 current_script #z
                                    end_if
                                else
                                    if  %c [#i 1] = #z and %c [#col2 2] != #z
                                        call colrow #i 1 #i 2 #flagcolrow 5 current_script #z
                                    end_if
                                end_if
                        end_switch
                    end_if
                end_if
                //  111010  011101       101110  010111       110110   011011
                set #n regexp (#pos1 $str1 %c[#i] (\d)\1\1\1\1)    // проверка что не 5 одинаковых чисел
                if  #n = 0
                    set #n regexp (#pos1 $str1 %c[#i] (\d)\d\1\1\1\d|(\d)\2\d\2\2\d|(\d)\3\3\d\3\d|\d(\d)\4\d\4\4|\d(\d)\d\5\5\5|\d(\d)\6\6\d\6)
                    if  #n > 0
                        set #n1 regexp (#pos1 $str1 %c[#i] (\d)\1\1)    //  111010  011101       101110  010111
                        set #n2 regexp (#pos3 $str3 %c[#i] (\d)\1\d\1\1)    // 110110   011011
                        switch #i
                            case 1:
                                if  #n1 > 0
                                    set #z copy($str1 1 1)
                                    switch #pos1       // позиция 111
                                        case 1:
                                            if  %c [2 4] = #z and %c [#i 6] != #z
                                                call colrow #i 4 2 4 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 2:
                                            if  %c [2 5] = #z and %c [#i 1] != #z
                                                call colrow #i 5 2 5 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 3:
                                            if  %c [2 2] = #z and %c [#i 6] != #z
                                                call colrow #i 2 2 2 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 4:
                                            if  %c [2 3] = #z and %c [#i 1] != #z
                                                call colrow #i 3 2 3 #flagcolrow 5 current_script #z
                                            end_if
                                    end_switch
                                end_if
                                // 110110   011011
                                if  #n2 > 0
                                    if  #pos3 = 1
                                        if  %c [2 3] = #z and %c [#i 6] != #z
                                            call colrow #i 3 2 3 #flagcolrow 5 current_script #z
                                        end_if
                                    end_if
                                    if  #pos3 = 2
                                        set #z copy($str3 1 1)
                                        if  %c [2 4] = #z and %c [#i 1] != #z
                                            call colrow #i 4 2 4 #flagcolrow 5 current_script #z
                                        end_if
                                    end_if
                                end_if
                                set #flagbreak 1
                                break
                            case 2:
                            case 3:
                            case 4:
                            case 5:
                                set #col1 #i + 1
                                set #col2 #i - 1
                                if  #n1 > 0
                                    set #z copy($str1 1 1)
                                    switch #pos1       // позиция 111
                                            //  111010  011101       101110  010111
                                        case 1:
                                            if  %c [#i 6] != #z
                                                if  %c [#col1 4] = #z
                                                    call colrow #i 4 #col1 4 #flagcolrow 5 current_script #z
                                                end_if
                                                if  %c [#col2 4] = #z
                                                    call colrow #i 4 #col2 4 #flagcolrow 5 current_script #z
                                                end_if
                                            end_if
                                            break
                                        case 2:
                                            if  %c [#i 1] != #z
                                                if  %c [#col1 5] = #z
                                                    call colrow #i 5 #col1 5 #flagcolrow 5 current_script #z
                                                end_if
                                                if  %c [#col2 5] = #z
                                                    call colrow #i 5 #col2 5 #flagcolrow 5 current_script #z
                                                end_if
                                            end_if
                                            break
                                        case 3:
                                            if  %c [#i 6] != #z
                                                if  %c [#col1 2] = #z
                                                    call colrow #i 2 #col1 2 #flagcolrow 5 current_script #z
                                                end_if
                                                if  %c [#col2 2] = #z
                                                    call colrow #i 2 #col2 2 #flagcolrow 5 current_script #z
                                                end_if
                                            end_if
                                            break
                                        case 4:
                                            if  %c [#i 1] != #z
                                                if  %c [#col1 3] = #z
                                                    call colrow #i 3 #col1 3 #flagcolrow 5 current_script #z
                                                end_if
                                                if  %c [#col2 3] = #z
                                                    call colrow #i 3 #col2 3 #flagcolrow 5 current_script #z
                                                end_if
                                            end_if
                                    end_switch

                                    if  #flagbreak = 1
                                        break
                                    end_if
                                end_if
                                // 110110   011011
                                if  #n2 > 0
                                    if  #pos3 = 1
                                        set #z copy($str3 1 1)
                                        if  %c [#i 6] != #z
                                            if  %c [#col1 3] = #z
                                                call colrow #i 3 #col1 3 #flagcolrow 5 current_script #z
                                            end_if
                                            if  %c [#col2 3] = #z
                                                call colrow #i 3 #col2 3 #flagcolrow 5 current_script #z
                                            end_if
                                        end_if
                                    end_if
                                    if  #pos3 = 2
                                        set #z copy($str3 1 1)
                                        if  %c [#i 1] != #z
                                            if  %c [#col1 4] = #z
                                                call colrow #i 4 #col1 4 #flagcolrow 5 current_script #z
                                            end_if
                                            if  %c [#col2 4] = #z
                                                call colrow #i 4 #col2 4 #flagcolrow 5 current_script #z
                                            end_if
                                        end_if
                                    end_if
                                end_if
                                break
                            case 6:
                                // 110110   011011
                                if  #n2 > 0
                                    if  #pos3 = 1
                                        if  %c [5 3] = #z and %c [#i 6] != #z
                                            call colrow #i 3 5 3 #flagcolrow 5 current_script #z
                                        end_if
                                    end_if
                                    if  #pos3 = 2
                                        set #z copy($str3 1 1)
                                        if  %c [5 4] = #z and %c [#i 1] != #z
                                            call colrow #i 4 5 4 #flagcolrow 5 current_script #z
                                        end_if
                                    end_if
                                end_if
                                //  111010  011101       101110  010111
                                if  #n1 > 0
                                    set #z copy($str1 1 1)
                                    switch #pos1
                                        case 1:
                                            if  %c [5 4] = #z and %c [#i 6] != #z
                                                call colrow #i 4 5 4 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 2:
                                            if  %c [5 5] = #z and %c [#i 1] != #z
                                                call colrow #i 5 5 5 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 3:
                                            if  %c [5 2] = #z and %c [#i 6] != #z
                                                call colrow #i 2 5 2 #flagcolrow 5 current_script #z
                                            end_if
                                            break
                                        case 4:
                                            if  %c [5 3] = #z and %c [#i 1] != #z
                                                call colrow #i 3 5 3 #flagcolrow 5 current_script #z
                                            end_if
                                    end_switch
                                end_if
                        end_switch
                    end_if
                end_if
            end_if
        end_if
    end_for
end_proc

proc line4 %c $regexp #flagcolrow
    for #i 1 size(%c)
        set #n regexp (#pos $str %c[#i] $regexp)
        if  #n > 0
            set #flagbreak 0
            switch #i
                case 1:
                    //111000
                    set #n1 regexp (#pos1 $str1 %c[#i] (\d)\1\1(\d)\2\2)
                    if  #n1 > 0
                        set #z copy($str1 4 1)
                        if  %c [2 3] = #z and %c [#i 2] != #z
                            call colrow #i 3 2 3 #flagcolrow 4 current_script #z
                        end_if
                    end_if
                    //  110100 011010 001101
                    set #n2 regexp (#pos2 $str2 %c[#i] (\d)\1\d\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n2 > 0
                            set #z copy($str2 1 1)
                            switch #pos2
                                case 1:
                                    if  %c [2 3] = #z and %c [#i 5] != #z
                                        call colrow #i 3 2 3 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 2:
                                    if  %c [2 4] = #z and %c [#i 1] != #z and %c [#i 6] != #z
                                        call colrow #i 4 2 4 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [2 5] = #z and %c [#i 2] != #z
                                        call colrow #i 5 2 5 #flagcolrow 4 current_script #z
                                    end_if
                            end_switch
                        end_if
                    end_if
                    // 101100 010110 001011
                    set #n3 regexp (#pos3 $str3 %c[#i] (\d)\d\1\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n3 > 0
                            set #z copy($str3 1 1)
                            switch #pos3
                                case 1:
                                    if  %c [2 2] = #z and %c [#i 5] != #z
                                        call colrow #i 2 2 2 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 2:
                                    if  %c [2 3] = #z and %c [#i 1] != #z and %c [#i 6] != #z
                                        call colrow #i 3 2 3 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [2 4] = #z and %c [#i 2] != #z
                                        call colrow #i 4 2 4 #flagcolrow 4 current_script #z
                                    end_if
                            end_switch
                        end_if
                    end_if
                    //  111010 011101   101110 010111
                    set #n4 regexp (#pos4 $str4 %c[#i] (\d)\1\1)
                    if  #n4 > 0
                        set #n5 regexp (#pos5 $str5 %c[#i] (\d)\1\1\1)
                        if  #n5 = 0
                            set #z copy($str4 1 1)
                            switch #pos4
                                case 1:
                                    if  %c [2 4] != #z and %c [1 5] = #z
                                        call colrow #i 4 #i 5 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [1 5] = #z and %c [2 4] != #z
                                            call colrow #i 4 2 4 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 2:
                                    if  %c [2 5] != #z and %c [1 6] = #z and %c [1 1] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [1 6] != #z and %c [1 1] != #z
                                            call colrow #i 5 2 5 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    if  %c [1 5] != #z and %c [2 1] = #z
                                        call colrow #i 1 2 1 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [2 2] != #z and %c [1 1] = #z
                                        call colrow #i 1 #i 2 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [1 6] != #z and %c [1 1] != #z and %c [2 2] = #z
                                            call colrow #i 2 2 2 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    if  %c [1 2] != #z and %c [1 6] != #z and %c [2 6] = #z
                                        call colrow #i 6 2 6 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 4:
                                    if  %c [2 3] != #z and %c [1 2] = #z
                                        call colrow #i 2 #i 3 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [1 2] != #z and %c [2 3] = #z
                                            call colrow #i 3 2 3 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                            end_switch
                        end_if
                    end_if
                    set #flagbreak 1
                    break
                case 2:
                case 3:
                case 4:
                case 5:
                    //111000
                    set #col1 #i + 1
                    set #col2 #i - 1
                    set #n1 regexp (#pos1 $str1 %c[#i] (\d)\1\1(\d)\2\2)
                    if  #n1 > 0
                        set #z copy($str1 4 1)
                        if  %c [#i 2] != #z
                            if  %c [#col1 3] = #z
                                call colrow #i 3 #col1 3 #flagcolrow 4 current_script #z
                            end_if
                            if  %c [#col2 3] = #z
                                call colrow #i 3 #col2 3 #flagcolrow 4 current_script #z
                            end_if
                        end_if
                    end_if
                    //  110100 011010 001101
                    set #n2 regexp (#pos2 $str2 %c[#i] (\d)\1\d\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n2 > 0
                            set #col1 #i + 1
                            set #col2 #i - 1
                            set #z copy($str2 1 1)
                            switch #pos2
                                case 1:
                                    if  %c [#i 5] != #z
                                        if  %c [#col1 3] = #z
                                            call colrow #i 3 #col1 3 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 3] = #z
                                            call colrow #i 3 #col2 3 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 2:
                                    if  %c [#i 6] != #z and %c [#i 1] != #z
                                        if  %c [#col1 4] = #z
                                            call colrow #i 4 #col1 4 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 4] = #z
                                            call colrow #i 4 #col2 4 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 3:
                                    if  %c [#i 2] != #z
                                        if  %c [#col1 5] = #z
                                            call colrow #i 5 #col1 5 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 5] = #z
                                            call colrow #i 5 #col2 5 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                            end_switch
                        end_if
                    end_if
                    if  #flagbreak = 1
                        break
                    end_if
                    // 101100 010110 001011
                    set #n3 regexp (#pos3 $str3 %c[#i] (\d)\d\1\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n3 > 0
                            set #col1 #i + 1
                            set #col2 #i - 1
                            set #z copy($str3 1 1)
                            switch #pos3
                                case 1:
                                    if  %c [#i 5] != #z
                                        if  %c [#col1 2] = #z
                                            call colrow #i 2 #col1 2 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 2] = #z
                                            call colrow #i 2 #col2 2 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 2:
                                    if  %c [#i 6] != #z and %c [#i 1] != #z
                                        if  %c [#col1 3] = #z
                                            call colrow #i 3 #col1 3 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 3] = #z
                                            call colrow #i 3 #col2 3 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 3:
                                    if  %c [#i 2] != #z
                                        if  %c [#col1 4] = #z
                                            call colrow #i 4 #col1 4 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 4] = #z
                                            call colrow #i 4 #col2 4 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                            end_switch
                        end_if
                    end_if
                    if  #flagbreak = 1
                        break
                    end_if
                    //   111010 011101 101110 010111
                    set #n4 regexp (#pos4 $str4 %c[#i] (\d)\1\1)
                    if  #n4 > 0
                        set #n5 regexp (#pos5 $str5 %c[#i] (\d)\1\1\1)
                        if  #n5 = 0
                            set #col1 #i + 1
                            set #col2 #i - 1
                            set #z copy($str4 1 1)
                            switch #pos4
                                case 1:
                                    if  %c [#i 5] = #z
                                        if  %c [#col1 4] != #z and %c [#col2 4] != #z
                                            call colrow #i 4 #i 5 #flagcolrow 4 current_script #z
                                        end_if
                                    else
                                        if  %c [#i 5] != #z
                                            if  %c [#col1 4] = #z
                                                call colrow #i 4 #col1 4 #flagcolrow 4 current_script #z
                                            end_if
                                            if  %c [#col2 4] = #z
                                                call colrow #i 4 #col2 4 #flagcolrow 4 current_script #z
                                            end_if
                                        end_if
                                    end_if
                                    set #flagbreak 1
                                    break
                                    // 011101
                                case 2:
                                    if  %c [#i 6] = #z and %c [#col1 5] != #z and %c [#col2 5] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [#i 6] != #z
                                            if  %c [#col1 5] = #z
                                                call colrow #i 5 #col1 5 #flagcolrow 4 current_script #z
                                            end_if
                                            if  %c [#col2 5] = #z
                                                call colrow #i 5 #col2 5 #flagcolrow 4 current_script #z
                                            end_if
                                        end_if
                                    end_if
                                    if  %c [#i 5] != #z
                                        if  %c [#col1 1] = #z
                                            call colrow #i 1 #col1 1 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 1] = #z
                                            call colrow #i 1 #col2 1 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    set #flagbreak 1
                                    break
                                    // 101110 010111
                                case 3:
                                    if  %c [#i 1] = #z and %c [#col1 2] != #z and %c [#col2 2] != #z
                                        call colrow #i 1 #i 2 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [#i 1] != #z
                                            if  %c [#col1 2] = #z
                                                call colrow #i 2 #col1 2 #flagcolrow 4 current_script #z
                                            end_if
                                            if  %c [#col2 2] = #z
                                                call colrow #i 2 #col2 2 #flagcolrow 4 current_script #z
                                            end_if
                                        end_if
                                    end_if
                                    if  %c [#i 2] != #z
                                        if  %c [#col1 6] = #z
                                            call colrow #i 6 #col1 6 #flagcolrow 4 current_script #z
                                        end_if
                                        if  %c [#col2 6] = #z
                                            call colrow #i 6 #col2 6 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    set #flagbreak 1
                                    break
                                    // 010111
                                case 4:
                                    if  %c [#i 2] = #z and %c [#col1 3] != #z and %c [#col2 3] != #z
                                        call colrow #i 2 #i 3 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [#i 2] != #z
                                            if  %c [#col1 3] = #z
                                                call colrow #i 3 #col1 3 #flagcolrow 4 current_script #z
                                            end_if
                                            if  %c [#col2 3] = #z
                                                call colrow #i 3 #col2 3 #flagcolrow 4 current_script #z
                                            end_if
                                        end_if
                                    end_if
                            end_switch
                        end_if
                    end_if
                    set #flagbreak 1
                    break
                case 6:
                    //  111010 011101   101110 010111 просто 3 числа 111
                    set #n4 regexp (#pos4 $str4 %c[#i] (\d)\1\1)
                    if  #n4 > 0
                        set #n5 regexp (#pos5 $str5 %c[#i] (\d)\1\1\1)
                        if  #n5 = 0
                            set #z copy($str4 1 1)
                            switch #pos4
                                case 1:
                                    if  %c [6 5] = #z and %c [5 4] != #z
                                        call colrow #i 4 #i 5 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [5 4] = #z and %c [6 5] != #z
                                            call colrow #i 4 5 4 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    break
                                case 2:
                                    if  %c [6 6] = #z and %c [5 5] != #z
                                        call colrow #i 5 #i 6 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [5 5] = #z and %c [#i 6] != #z
                                            call colrow #i 5 5 5 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    if  %c [5 1] = #z and %c [#i 5] != #z
                                        call colrow #i 1 5 1 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                    // 101110 010111
                                case 3:
                                    if  %c [6 1] = #z and %c [5 2] != #z
                                        call colrow #i 1 #i 2 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [5 2] = #z and %c [#i 1] != #z
                                            call colrow #i 2 5 2 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                                    if  %c [5 6] = #z and %c [#i 2] != #z
                                        call colrow #i 6 5 6 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 4:
                                    if  %c [6 2] = #z and %c [5 3] != #z
                                        call colrow #i 2 #i 3 #flagcolrow 4 current_script #z
                                    else
                                        if  %c [5 3] = #z and %c [6 2] != #z
                                            call colrow #i 3 5 3 #flagcolrow 4 current_script #z
                                        end_if
                                    end_if
                            end_switch
                        end_if
                    end_if
                    if  #flagbreak = 1
                        break
                    end_if
                    //111000
                    set #n1 regexp (#pos1 $str1 %c[#i] (\d)\1\1(\d)\2\2)
                    if  #n1 > 0
                        set #z copy($str1 4 1)
                        if  %c [5 3] = #z and %c [#i 2] != #z
                            call colrow #i 3 5 3 #flagcolrow 4 current_script #z
                        end_if
                    end_if
                    //  110100 011010 001101
                    set #n2 regexp (#pos2 $str2 %c[#i] (\d)\1\d\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n2 > 0
                            set #z copy($str2 1 1)
                            switch #pos2
                                case 1:
                                    if  %c [5 3] = #z and %c [#i 5] != #z
                                        call colrow #i 3 5 3 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 2:
                                    if  %c [5 4] = #z and %c [#i 6] != #z and %c [#i 1] != #z
                                        call colrow #i 4 5 4 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [5 5] = #z and %c [#i 2] != #z
                                        call colrow #i 5 5 5 #flagcolrow 4 current_script #z
                                    end_if
                            end_switch
                        end_if
                        if  #flagbreak = 1
                            break
                        end_if
                    end_if
                    // 101100 010110 001011
                    set #n3 regexp (#pos3 $str3 %c[#i] (\d)\d\1\1)
                    set #n6 regexp (#pos6 $str6 %c[#i] (\d)\1\1\1)
                    if  #n6 = 0
                        if  #n3 > 0
                            set #z copy($str3 1 1)
                            switch #pos3
                                case 1:
                                    if  %c [5 2] = #z and %c [#i 5] != #z
                                        call colrow #i 2 5 2 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 2:
                                    if  %c [5 3] = #z and %c [#i 6] != #z and %c [#i 1] != #z
                                        call colrow #i 3 5 3 #flagcolrow 4 current_script #z
                                    end_if
                                    break
                                case 3:
                                    if  %c [5 4] = #z and %c [#i 2] != #z
                                        call colrow #i 4 5 4 #flagcolrow 4 current_script #z
                                    end_if
                            end_switch
                        end_if
                    end_if
            end_switch
        end_if
    end_for
end_proc

proc line3_1 %a #i $string $newstring #del $regexp #flagcolrow
    set #n regexp (#pos $str $newstring $regexp)
    if  #n > 0
        set #pos #pos + #del
        if  #pos < 5
            set #del #pos + 1
            set $newstring delete($newstring 1 2)
            if  #flagcolrow = 0
                call line3_1 %a #i $string $newstring #del (\d)\1 0
            else
                call line3_1 %a #i $string $newstring #del (\d)\1 1
            end_if
        end_if
    end_if
    if  #n > 0
        set #z copy($str 1 1)
        switch #i
            case 1:
                switch #pos
                    case 1:
                        if  %a [1 3] != #z
                            if  %a [2 3] = #z and %a [1 4] != #z
                                call colrow #i 3 2 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 4] = #z and %a [2 3] != #z
                                call colrow #i 3 1 4 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 2:
                        if  %a [1 1] != #z and %a [1 4] != #z
                            if  %a [2 1] = #z
                                call colrow #i 1 2 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [2 4] = #z and %a [1 5] != #z
                                call colrow #i 4 2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 5] = #z and %a [2 4] != #z
                                call colrow #i 4 1 5 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 3:
                        if  %a [1 2] != #z and %a [1 5] != #z
                            if  %a [2 2] = #z and %a [1 1] != #z
                                call colrow #i 2 2 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 1] = #z and %a [2 2] != #z
                                call colrow #i 2 1 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [2 5] = #z and %a [1 6] != #z
                                call colrow #i 5 2 5 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 6] = #z and %a [2 5] != #z
                                call colrow #i 5 1 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 4:
                        if  %a [1 3] != #z and %a [1 6] != #z
                            if  %a [2 3] = #z and %a [1 2] != #z
                                call colrow #i 3 2 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 2] = #z and %a [2 3] != #z
                                call colrow #i 3 1 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [2 6] = #z and %a [1 6] != #z
                                call colrow #i 6 2 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 5:
                        if  %a [1 4] != #z
                            if  %a [2 4] = #z and %a [1 3] != #z
                                call colrow #i 4 2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 3] = #z and %a [2 4] != #z
                                call colrow #i 4 1 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 6:
                        if  %a [1 4] != #z
                            if  %a [2 4] = #z and %a [1 3] != #z
                                call colrow #i 4 2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [1 3] = #z and %a [2 4] != #z
                                call colrow #i 4 1 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                end_switch
                break
            case 2:
            case 3:
            case 4:
            case 5:
                set #col1 #i + 1
                set #col2 #i - 1
                switch #pos
                    case 1:
                        if  %a [#i 3] != #z
                            if  %a [#col1 3] = #z and %a [#i 4] != #z
                                call colrow #i 3 #col1 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 3] = #z and %a [#i 4] != #z
                                call colrow #i 3 #col2 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 4] = #z and %a [#col1 3] != #z and %a [#col2 3] != #z
                                call colrow #i 3 #i 4 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 2:
                        if  %a [#i 1] != #z and %a [#i 4] != #z
                            if  %a [#col1 1] = #z
                                call colrow #i 1 #col1 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 1] = #z
                                call colrow #i 1 #col2 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col1 4] = #z and %a [#i 5] != #z
                                call colrow #i 4 #col1 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 4] = #z and %a [#i 5] != #z
                                call colrow #i 4 #col2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 5] = #z and %a [#col1 4] != #z and %a [#col2 4] != #z
                                call colrow #i 4 #i 5 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 3:
                        if  %a [#i 2] != #z and %a [#i 5] != #z
                            if  %a [#col1 2] = #z and %a [#i 1] != #z
                                call colrow #i 2 #col1 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 2] = #z and %a [#i 1] != #z
                                call colrow #i 2 #col2 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 1] = #z and %a [#col1 2] != #z and %a [#col2 2] != #z
                                call colrow #i 2 #i 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col1 5] = #z and %a [#i 6] != #z
                                call colrow #i 5 #col1 5 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 5] = #z and %a [#i 6] != #z
                                call colrow #i 5 #col2 5 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 6] = #z and %a [#col1 5] != #z and %a [#col2 5] != #z
                                call colrow #i 5 #i 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 4:
                        if  %a [#i 3] != #z and %a [#i 6] != #z
                            if  %a [#col1 3] = #z and %a [#i 2] != #z
                                call colrow #i 3 #col1 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 3] = #z and %a [#i 2] != #z
                                call colrow #i 3 #col2 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 2] = #z and %a [#col1 3] != #z and %a [#col2 3] != #z
                                call colrow #i 3 #i 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col1 6] = #z
                                call colrow #i 6 #col1 6 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 6] = #z
                                call colrow #i 6 #col2 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 5:
                        if  %a [#i 4] != #z
                            if  %a [#col1 4] = #z and %a [#i 3] != #z
                                call colrow #i 4 #col1 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 4] = #z and %a [#i 3] != #z
                                call colrow #i 4 #col2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 3] = #z and %a [#col1 4] != #z and %a [#col2 4] != #z
                                call colrow #i 4 #i 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 6:
                        if  %a [#i 4] != #z
                            if  %a [#col1 4] = #z and %a [#i 3] != #z
                                call colrow #i 4 #col1 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 4] = #z and %a [#i 3] != #z
                                call colrow #i 4 #col2 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#i 3] = #z and %a [#col1 4] != #z and %a [#col2 4] != #z
                                call colrow #i 4 #i 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                end_switch
                break
            case 6:
                switch #pos
                    case 1:
                        if  %a [6 3] != #z
                            if  %a [5 3] = #z and  %a [6 4] != #z
                                call colrow #i 3 5 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 4] = #z and  %a [5 3] != #z
                                call colrow #i 3 6 4 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break

                    case 2:
                        if  %a [6 1] != #z and %a [6 4] != #z
                            if  %a [5 1] = #z
                                call colrow #i 1 5 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [5 4] = #z and %a [6 5] != #z
                                call colrow #i 4 5 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 5] = #z and %a [5 4] != #z
                                call colrow #i 4 6 5 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 3:
                        if  %a [6 2] != #z and  %a [6 5] != #z
                            if  %a [5 2] = #z and %a [6 1] != #z
                                call colrow #i 2 5 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 1] = #z and %a [5 2] != #z
                                call colrow #i 2 6 1 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [5 5] = #z and %a [6 6] != #z
                                call colrow #i 5 5 5 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 6] = #z and %a [5 5] != #z
                                call colrow #i 5 6 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 4:
                        if  %a [6 3] != #z and %a [6 6] != #z
                            if  %a [5 3] = #z and %a [6 2] != #z
                                call colrow #i 3 5 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 2] = #z and %a [5 3] != #z
                                call colrow #i 3 6 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [5 6] = #z
                                call colrow #i 6 5 6 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 5:
                        if  %a [6 4] != #z
                            if  %a [5 4] = #z and %a [6 3] != #z
                                call colrow #i 4 5 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 3] = #z and %a [5 4] != #z
                                call colrow #i 4 6 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 6:
                        if  %a [6 4] != #z
                            if  %a [5 4] = #z and %a [6 3] != #z
                                call colrow #i 4 5 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [6 3] = #z and %a [5 4] != #z
                                call colrow #i 4 6 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                end_switch
        end_switch
    end_if
end_proc


proc line3_2 %a #i $string $newstring #del $regexp #flagcolrow
    set #n regexp (#pos $str $newstring $regexp)
    if  #n > 0
        set #pos #pos + #del
        if  #pos < 4
            set #del #pos
            set $newstring delete($string 1 #pos)
            if  #flagcolrow = 0
                call line3_2 %a #i $string $newstring #del (\d)\d\1 0
            else
                call line3_2 %a #i $string $newstring #del (\d)\d\1 1
            end_if
        end_if
    end_if
    if  #n > 0
        set #z copy($str 1 1)
        switch #i
            case 1:
                switch #pos
                    case 1:
                        if  %a [1 2] != #z and %a [2 2] = #z and  %a [1 4] != #z
                            call colrow #i 2 2 2 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 2:
                        if  %a [1 3] != #z and %a [2 3] = #z and  %a [1 5] != #z and  %a [1 1] != #z
                            call colrow #i 3 2 3 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 3:
                        if  %a [1 4] != #z and %a [2 4] = #z and %a [1 2] != #z and  %a [1 6] != #z
                            call colrow #i 4 2 4 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 4:
                        if  %a [1 5] != #z and %a [2 5] = #z and  %a [1 3] != #z
                            call colrow #i 5 2 5 #flagcolrow 3 current_script #z
                        end_if
                        break
                end_switch
                break
            case 2:
            case 3:
            case 4:
            case 5:
                set #col1 #i + 1
                set #col2 #i - 1
                switch #pos
                    case 1:
                        if  %a [#i 2] != #z and %a [#i 4] != #z
                            if  %a [#col1 2] = #z
                                call colrow #i 2 #col1 2 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 2] = #z
                                call colrow #i 2 #col2 2 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 2:
                        if  %a [#i 3] != #z and %a [#i 1] != #z and %a [#i 5] != #z
                            if  %a [#col1 3] = #z
                                call colrow #i 3 #col1 3 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 3] = #z
                                call colrow #i 3 #col2 3 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 3:
                        if  %a [#i 4] != #z and %a [#i 2] != #z and %a [#i 6] != #z
                            if  %a [#col1 4] = #z
                                call colrow #i 4 #col1 4 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 4] = #z
                                call colrow #i 4 #col2 4 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                    case 4:
                        if  %a [#i 5] != #z and %a [#i 3] != #z
                            if  %a [#col1 5] = #z
                                call colrow #i 5 #col1 5 #flagcolrow 3 current_script #z
                            end_if
                            if  %a [#col2 5] = #z
                                call colrow #i 5 #col2 5 #flagcolrow 3 current_script #z
                            end_if
                        end_if
                        break
                end_switch
                break
            case 6:
                switch #pos
                    case 1:
                        if  %a [6 2] != #z and %a [5 2] = #z and  %a [6 4] != #z
                            call colrow #i 2 5 2 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 2:
                        if  %a [6 3] != #z and %a [5 3] = #z and %a [6 1] != #z and %a [6 5] != #z
                            call colrow #i 3 5 3 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 3:
                        if  %a [6 4] != #z and %a [5 4] = #z and %a [6 2] != #z and %a [6 6] != #z
                            call colrow #i 4 5 4 #flagcolrow 3 current_script #z
                        end_if
                        break
                    case 4:
                        if  %a [6 5] != #z and %a [5 5] = #z and %a [6 3] != #z
                            call colrow #i 5 5 5 #flagcolrow 3 current_script #z
                        end_if
                        break
                end_switch
        end_switch
    end_if
end_proc

Настройка

// скрипт для настройки
init_arr %hod (1) 848, 203 1265456     // кнопка хода
init_arr %LevVerh (1) 849, 260    // левая верхняя картинка


set linedelay 0
set #handle workwindow
log mode compact
log open
wait 200
set windowpos 0 0 500 400 loghandle
log clear
log close
set workwindow windowhandle
set windowpos 0 400
set workwindow #handle
set #startX %LevVerh [1 1]
set #startY %LevVerh [1 2]
set #stepX 41
set #stepY 41
set #endX #startX + #stepX * 5
set #endY #startY + #stepY * 5

:start
set size(%output)
while_not %hod [1 1] %hod [1 2] %hod [1 3]    // ждать появление кнопки хода
    wait 100
end_while
wait 300
log clear
set timer


set #a findcolor (#startX #startY #endX #endY #stepX #stepY (0-16777215) %arr)
//save_array %arr C:\Users\abc\Desktop\ColorInput.txt
if  size(%arr) > 0
    set #sizeInput size (%arr)
    set #sizeOutput 0
    set size(%output)
    for #i 1 #sizeInput  1 // Перебираем исходный массив.
        set #duplicat 0 // Обнуляем состояние флага, что строка является дубликатом.
        for #n 1 #sizeOutput 1          // Перебираем итоговый массив.
            if  %arr[#i 3] = %output[#n]  // Сравниваем есть ли уже такие значение в итоговом массиве.
                set #duplicat 1         // Если есть, то ставим флаг дубля.
                break            // прерываем перебор итогового массива.
            end_if
        end_for
        if  #duplicat = 0 // Проверяем чем закончился поиск дубля.
            set #sizeOutput #sizeOutput  + 1 // Увеличиваем размер итогового массива.
            set %output[#sizeOutput ] %arr[#i 3] // Если значение не является дублем, то дописываем его.
        end_if
    end_for
end_if

if  size(%output) != 5
    goto start
end_if
printscreen 0 0 0 0 0 C:\Nebesa.jpg
for #i 1 6
for #j 1 6
set #z #z + 1
    set %setka [#i #j] %arr [#z 3]
end_for
end_for
save_array %setka C:\SetkaNebesa.txt

log Открыть файл C:\Nebesa.jpg
log Открыть файл C:\SetkaNebesa.txt
End_script

Смотрите также

Смещение между окнами

Первоисточник

Форум UOPilot