Pawn battle

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

Re: Pawn battle

Postby Shotaro Yamazoe » Tue Nov 01, 2011 3:27 am

@admin
Thank you for your reply. I understand :)
User avatar
Shotaro Yamazoe
 
Posts: 2
Joined: Tue Jan 18, 2011 2:26 am

Re: Pawn battle

Postby David McCloskey » Wed Nov 02, 2011 1:14 pm

To those who were able to get high scores, what was your approach. The only thing I could come up with was to say that if you are adjacent to your opponents pawns and it's your turn, then you lose. Then by recursing, you could see if there was a winning set of moves from the current position. I had correctness, but iterating over all possible paths was no good in some corner cases which made my algorithm take too long for more than 5 columns.
User avatar
David McCloskey
 
Posts: 2
Joined: Thu Sep 08, 2011 11:46 am

Re: Pawn battle

Postby hellocopter » Thu Nov 03, 2011 12:06 pm

Without trying to give away the solution, I'll suggest that you take a look at combinatorial game theory. With a bit of poking around, you'll find everything you need to solve this efficiently (plus a lot of other fun things along the way).

Related resources:

Wikipedia: http://en.wikipedia.org/wiki/Combinatorial_game_theory
TopCoder article on CGT: http://community.topcoder.com/tc?module ... rithmGames
Sample puzzle on SPOJ: http://www.spoj.pl/problems/CLK/
User avatar
hellocopter
 
Posts: 10
Joined: Sat Jan 22, 2011 1:32 pm

Re: Pawn battle

Postby David McCloskey » Sun Nov 06, 2011 12:57 pm



Thanks for these. I wish description said "combinatorial game theory" instead of "game theory" which appears to be something completely different from what was actually required for the puzzle.
User avatar
David McCloskey
 
Posts: 2
Joined: Thu Sep 08, 2011 11:46 am

Re: Pawn battle

Postby davidb » Sun Nov 06, 2011 1:23 pm

David McCloskey wrote:Thanks for these. I wish description said "combinatorial game theory" instead of "game theory" which appears to be something completely different from what was actually required for the puzzle.


Actually game theory is the right term, combinatorial game theory is a subset of it.
http://en.wikipedia.org/wiki/Game_theor ... rial_games

Giving the most specific term would be giving away the solution, that's why the terms used are more general.
User avatar
davidb
 
Posts: 24
Joined: Thu Dec 23, 2010 1:55 am

Previous

Return to Puzzles

Who is online

Users browsing this forum: No registered users and 3 guests

cron