ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1216. Two Pawns and One King

Hints (+)
Послано Dmitry 'Diman_YES' Kovalioff 23 дек 2002 08:41
I've got AC many weeks ago but a lot of people cann't do it.

The task is not so hard as one may think, but it needs this:
1) Before coding you must find out all the tricks on paper (and there
are a lot of tricks)
2) Your program must have a good structure
3) You must code it very accurate, because it'll be very hard to find
a mistake later

So, hints:
I. If your program works on 8*8 board it'll work on every board from
6*6 to 26*26
II. My program's structure is following:
1) if black pawn (BP) stops white pawn (WP) -> BLACK WINS
2) if BP bites WP -> BLACK WINS
3) if WP bites BP (on first move, of course) and saves itself (runs
away from square and black king (BK) can't catch it after that) ->
WHITE WINS
4) if BK is in square (it can catch WP) and BP cann't prevent it
standing initially on BK's way -> BLACK WINS
5) if BP trasforms into other figuge (I considered that it transforms
into queen) and bites WP -> BLACK WINS
otherwise -> WHITE WINS
III. Here are some tests for you on every case described above:
1)
8
a2 a7 h1
BLACK WINS
8
a6 a5 h1
WHITE WINS
2)
8
a3 b6 h1
BLACK WINS
8
a6 b6 h1
WHITE WINS
3)
8
d5 c6 f5
WHITE WINS
8
d5 c6 a5
WHITE WINS
4)
8
b4 d5 e4
WHITE WINS
8
b3 h7 f3
BLACK WINS
8
b2 h7 g2
WHITE WINS
5)
8
b4 b3 h2
BLACK WINS
8
b5 b3 h2
WHITE WINS
8
b5 b2 b3
WHITE WINS
8
a4 g3 h8
BLACK WINS
8
a4 g3 g2
WHITE WINS
8
a4 h3 h8
BLACK WINS
8
a4 h3 g2
WHITE WINS

I hope if you program passes all theese tests it gets AC.
Good luck :)

With respect, Dmitry "Diman_YES" Kovalioff
dimanyes@mail.ru
http://uniteam.narod.ru
its wa tests?
Послано Oleg 24 дек 2002 04:34
8
d5 c6 f5
WHITE WINS

no black wins. put it on the desk and move. Черный король рубит пешку
в любом случае
8 b4 d5 e4
Послано Oleg 24 дек 2002 06:09
********
********
********
*W**K***
***B****
********
********
********

********
********
********
********
*W*BK***
********
********
********

********
********
********
********
***B****
*W*K****
********
********

********
********
********
********
***B****
********
*WK*****
********

********
********
********
********
***B****
********
**K*****
*W******
Black turn: blak king move to b8 Black win.
All tests are correct. Read problem more attentively: "White is supposed to win, when it manages to promote its pawn to the Queen (even in the case when this queen would be immediately beaten by
Послано Dmitry 'Diman_YES' Kovalioff 24 дек 2002 17:14