init_arr %hod (1) 331, 137 1529398 // кнопка хода init_arr %LevVerh (1) 323, 184 // левая верхняя картинка // имя стоимость цвет init_arr %imya (1) Череп 6 10013920 init_arr %imya (2) Красный 5 196690 init_arr %imya (3) Жёлтый 3 41690 init_arr %imya (4) Зелёный 1 95004 init_arr %imya (5) Крест 1 8886946 set #wait 500 // время, в течении которого, камни не должны смещаться 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 5 5 5 5 wait 200 left #x2 #y2 5 5 5 5 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 // создание сетки 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 // повторное создание сетки wait #wait set #resultat 0 set #a1 findcolor (#startX #startY #endX #endY #stepX #stepY (%imya [1 3] %imya [2 3] %imya [3 3] %imya [4 3] %imya [5 3]) %arr1 #handle) //save_array %arr C:\Users\abc\Desktop\Setkafind1.txt if #a1 > 0 set #z 0 for #i 1 6 for #j 1 6 set #z #z + 1 switch %arr1 [#z 3] case %imya [1 3]: set %a1 [#i #j] 1 // череп break case %imya [2 3]: set %a1 [#i #j] 2 // красный break case %imya [3 3]: set %a1 [#i #j] 3 // жёлтый break case %imya [4 3]: set %a1 [#i #j] 4 // крест break case %imya [5 3]: set %a1 [#i #j] 5 // зелёный end_switch end_for end_for //save_array %a1 C:\Users\abc\Desktop\Setka1.txt //массив сетка end_if // сравнение сеток for #i 1 6 set #z 0 for #j 1 6 set #z #z + 1 if %a [#i #j] != %a1 [#i #j] set #resultat 1 break 2 end_if end_for end_for if #resultat = 1 goto poisk 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 log clear set timer 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