Здравствуйте, гость ( Вход | Регистрация )

 
Ответить в эту темуОткрыть новую тему
> анти сапёр, дело было вечером, делать было нечего..
BSW_rama
сообщение 27.1.2014, 13:15
Сообщение #1


****

Apprentice
Сообщений: 188
Регистрация: 28.1.2013
Группа: Пользователи
Наличность: 0
Пользователь №: 15.728
Возраст: 32



в эту прексраную пятницу какой-то злосный противник инета рубанул кабель, заранее зная что в пятницу никто не приедет, а в субботу воскресение у техов выходные, и в понедельник не факт что будет кто-т вообще... кароче 3-5 дней в заднице гарантировано.
в скрипте 2 блока
1) сканирует поле
2) ищет мины.
из-за ошибок первого, ошибается и второй... но ошибки редкие и по сути работает сносно... текущий скрипт расчитан на поле 30х16. для вин 7. исключить ошибки можно через картинки, но мне лень.. поэтому сканил через диапазоны (IMG:style_emoticons/default/smile.gif), да и быстрее так помоему (IMG:style_emoticons/default/smile.gif)..
Код

for #a 1 30 1
for #b 1 16 1
set %pol[#a #b] n
set %min[#a #b] 0
end_for
end_for
kleft 15, 15
//-------------------------блок скана--------------------------------------
:reload
set #z 0
set #s1 findcolor(47 41 281 311 18 18 (R(206-239)G(211-245)B(221-250)) %s1 2)
if #s1 > 0
for #c 1 #s1 1
set #a (%s1[#c 1] - 47) / 18 + 1
set #b (%s1[#c 2] - 41) / 18 + 1
set %pol[#a #b] s
end_for
end_if
set #s2 findcolor(300 41 570 311 18 18 (R(206-239)G(211-245)B(221-250)) %s2 2)
if #s2 > 0
for #c 1 #s2 1
set #a (%s2[#c 1] - 47) / 18 + 1
set #b (%s2[#c 2] - 41) / 18 + 1
set %pol[#a #b] s
end_for
end_if
set #p11 findcolor(39 35 291 305 18 18 (R(59-60)G(80)B(185-193)) %p11 2)
if #p11 > 0
for #c 1 #p11 1
set #a (%p11[#c 1] - 39) / 18 + 1
set #b (%p11[#c 2] - 35) / 18 + 1
set %pol[#a #b] 1
end_for
end_if
set #p12 findcolor(310 35 562 305 18 18 (R(59-60)G(80)B(185-193)) %p12 2)
if #p12 > 0
for #c 1 #p12 1
set #a (%p12[#c 1] - 39) / 18 + 1
set #b (%p12[#c 2] - 35) / 18 + 1
set %pol[#a #b] 1
end_for
end_if
set #p21 findcolor(39 43 291 313 18 18 (R(33-86)G(108-1270)B(13-81)) %p21 2)
if #p21 > 0
for #c 1 #p21 1
set #a (%p21[#c 1] - 39) / 18 + 1
set #b (%p21[#c 2] - 43) / 18 + 1
set %pol[#a #b] 2
end_for
end_if
set #p22 findcolor(310 43 562 313 18 18 (R(33-86)G(108-1270)B(13-81)) %p22 2)
if #p22 > 0
for #c 1 #p22 1
set #a (%p22[#c 1] - 39) / 18 + 1
set #b (%p22[#c 2] - 43) / 18 + 1
set %pol[#a #b] 2
end_for
end_if
set #p31 findcolor(42 42 294 312 18 18 (R(169-176)G(4-7)B(4-12)) %p31 2)
if #p31 > 0
for #c 1 #p31 1
set #a (%p31[#c 1] - 42) / 18 + 1
set #b (%p31[#c 2] - 42) / 18 + 1
set %pol[#a #b] 3
end_for
end_if
set #p32 findcolor(313 42 565 312 18 18 (R(169-176)G(4-7)B(4-12)) %p32 2)
if #p32 > 0
for #c 1 #p32 1
set #a (%p32[#c 1] - 42) / 18 + 1
set #b (%p32[#c 2] - 42) / 18 + 1
set %pol[#a #b] 3
end_for
end_if
set #p41 findcolor(39 42 291 312 18 18 (R(0-3)G(0-3)B(125-135)) %p41 2)
if #p41 > 0
for #c 1 #p41 1
set #a (%p41[#c 1] - 39) / 18 + 1
set #b (%p41[#c 2] - 42) / 18 + 1
set %pol[#a #b] 4
end_for
end_if
set #p42 findcolor(310 42 562 312 18 18 (R(0-3)G(0-3)B(125-135)) %p42 2)
if #p42 > 0
for #c 1 #p42 1
set #a (%p42[#c 1] - 39) / 18 + 1
set #b (%p42[#c 2] - 42) / 18 + 1
set %pol[#a #b] 4
end_for
end_if
set #p51 findcolor(42 42 294 312 18 18 (R(122-127)G(0-7)B(0-10)) %p51 2)
if #p51 > 0
for #c 1 #p51 1
set #a (%p51[#c 1] - 42) / 18 + 1
set #b (%p51[#c 2] - 42) / 18 + 1
set %pol[#a #b] 5
end_for
end_if
set #p52 findcolor(313 42 565 312 18 18 (R(122-127)G(0-7)B(0-10)) %p52 2)
if #p52 > 0
for #c 1 #p52 1
set #a (%p52[#c 1] - 42) / 18 + 1
set #b (%p52[#c 2] - 42) / 18 + 1
set %pol[#a #b] 5
end_for
end_if
set #p61 findcolor(39 39 291 309 18 18 (R(46-50)G(140-150)B(149-160)) %p61 2)
if #p61 > 0
for #c 1 #p61 1
set #a (%p61[#c 1] - 39) / 18 + 1
set #b (%p61[#c 2] - 39) / 18 + 1
set %pol[#a #b] 6
end_for
end_if
set #p62 findcolor(310 39 562 309 18 18 (R(46-50)G(140-150)B(149-160)) %p62 2)
if #p62 > 0
for #c 1 #p62 1
set #a (%p62[#c 1] - 39) / 18 + 1
set #b (%p62[#c 2] - 39) / 18 + 1
set %pol[#a #b] 6
end_for
end_if
set #m findcolor(38 35 570 315 18 18 (R(249-253)G(0-18)B(0-10)) %m 2)
if #m > 0
for #c 1 #m 1
set #a (%m[#c 1] - 38) / 18 + 1
set #b (%m[#c 2] - 35) / 18 + 1
set %pol[#a #b] m
set %min[#a #b] 1
end_for
end_if
set #c 1
set #d 1
//---------------------------------------------блок математики-------------------------
:findmine
if %ns[#c #d] = 1
goto endfind
end_if
if %pol[#c #d] > 0 and %pol[#c #d] < 9
set #i 0
set #j 0
  for #f -1 1 1
  set #h #d + #f
   for #e -1 1 1
   set #g #c + #e
    if #h > 0 and #h < 17 and #g > 0 and #g < 31
    set #i %min[#g #h] + #i
     if %pol[#g #h] = n
     set #j #j + 1
     end_if
    end_if
   end_for
  end_for
  if %pol[#c #d] = #i
  set %ns[#c #d] 1
   for #f -1 1 1
   set #b #d + #f
    for #e -1 1 1
    set #a #c + #e
     if #b > 0 and #b < 17 and #a > 0 and #a < 31
      if %pol[#a #b] = n
      set #x 39 + 18 * (#a - 1)
      set #y 34 + 18 * (#b - 1)
      kleft #x, #y
      set #z 1
      move 15 15
      end_if
     end_if  
    end_for
   end_for
  end_if
  set #k #j + #i
  if %pol[#c #d] = #k
   for #f -1 1 1
   set #b #d + #f
    for #e -1 1 1
    set #a #c + #e
     if #b > 0 and #b < 17 and #a > 0 and #a < 31
      if %pol[#a #b] = n
      set #x 39 + 18 * (#a - 1)
      set #y 34 + 18 * (#b - 1)
      kright #x, #y
      set #z 1
      move 15 15
      set %min[#a #b] 1
      end_if
     end_if
    end_for
   end_for
  end_if
end_if
:endfind
set #c #c + 1
if #c > 30
set #c 1
set #d #d + 1
if #d > 16
if #z = 1
set #c 1
set #d 1
wait 200
goto reload
end_if
alarm
end_script
end_if
goto findmine
end_if
goto findmine
end_script
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения

Ответить в эту темуОткрыть новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 

- Текстовая версия | Версия для КПК Сейчас: 19.4.2024, 16:27
Designed by Nickostyle