Pawn battle

Discuss about the puzzles, but without giving the solutions please !!!

Pawn battle

Postby admin » Fri Oct 07, 2011 9:33 am

The goal of this puzzle is to determine if from a position in a pawn battle game you can make a move that garantees a win in the future if you always play perfectly.


User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Pawn battle

Postby demo » Mon Oct 24, 2011 6:57 pm

a few questions.
1. "we will assume that all positions are given are happening some time after each player made its first move." I don't understand it, I think there's solecism.
2. what does "G2" mean in the output?
3. Does white always plays first?
User avatar
demo
 
Posts: 11
Joined: Mon Jan 17, 2011 7:18 pm

Re: Pawn battle

Postby admin » Tue Oct 25, 2011 12:22 am

1. It should be only "are happening". What we mean here is you can move by any number of empty cases (not limited to 3 cases as in the first move).

2. It means the player for which it is the turn to play has a winning move by moving his pawn to row G, on column 2. In the example, it was the second test case, so it was white's turn to play. Note that columns start from 1, not from 0.

3. White always plays the first move in the game, however it is not relevant in this puzzle since you are given which player's turn it is to play (see input specifications 2.a)

Good luck !
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Pawn battle

Postby Moises Lopez » Tue Oct 25, 2011 6:30 am

I have the same problem as allways :-(
My program gives the correct answer in the first and last test but fails in the rest. So ther ie a tiny error that only happens in same cases. ¿Any idea for testing that cases?
User avatar
Moises Lopez
 
Posts: 5
Joined: Fri Jul 01, 2011 11:50 pm

Re: Pawn battle

Postby code_excalibur » Tue Oct 25, 2011 9:19 am

What do we mean by the move garantees a win in the future if you always play perfectly. Moreover when does a player win??
User avatar
code_excalibur
 
Posts: 2
Joined: Mon Oct 24, 2011 8:31 am

Re: Pawn battle

Postby random.johnnyh » Tue Oct 25, 2011 4:37 pm

What does "Pawns cannot only move vertically (in both directions)" mean?
User avatar
random.johnnyh
 
Posts: 15
Joined: Wed Apr 20, 2011 6:04 pm

Re: Pawn battle

Postby hellocopter » Tue Oct 25, 2011 4:48 pm

should be "Pawns can only move vertically (in both directions)"
User avatar
hellocopter
 
Posts: 10
Joined: Sat Jan 22, 2011 1:32 pm

Re: Pawn battle

Postby admin » Tue Oct 25, 2011 9:05 pm

@random.johnnyh, @hellocopter
Thanks typo fixed.

@code_excalibur
A player wins when the other player cannot move anymore (e.g. all his pawns are pinned to the row where they started from). A move can guarantee a win in this game, since it can be proven that if you play perfectly (keep on doing winning moves) from a winning position then you will win.

For example, if you play the little game on the puzzle page with 4 columns and start with color black, you can always win by
1. always moving forward (towards the opponent)
2. maintaining the exact same distance between the pawns on columns 1 and 2 and independently maintaining the same distance on columns 3 and 4. (e.g. if the A.I. moves 2 cases down on column 1, you move 2 cases up on column 2, and so on).
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Pawn battle

Postby Shotaro Yamazoe » Tue Nov 01, 2011 1:09 am

If I have black pawns and there is a winning strategy, then what should I print?
My winning move depend on opponent's first move.

Please clarify.
User avatar
Shotaro Yamazoe
 
Posts: 2
Joined: Tue Jan 18, 2011 2:26 am

Re: Pawn battle

Postby admin » Tue Nov 01, 2011 1:59 am

Shotaro Yamazoe wrote:If I have black pawns and there is a winning strategy, then what should I print?
My winning move depend on opponent's first move.

Please clarify.


You are given an in-game position, and you are also given what player turn it is to play. In any case, it's always your turn to play, either as black or white.

For example in the test case, below, the first test you are playing as black and it is your turn to play, for the second test you are playing as white and it is your turn to play.
Code: Select all
2
B 3
W ACB
B CEC
W 3
W AAF
B CHH


Hope it clarifies !
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Next

Return to Puzzles

Who is online

Users browsing this forum: No registered users and 1 guest

cron