All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Trading Places 2D (Posted on 2006-06-07) Difficulty: 3 of 5
Markers can move forward one square, or can jump over a marker of either colour if there is an empty square to land on.
Markers are not removed from the board if jumped.
You DO NOT have to alternate moving black and white markers.
The x's move E or S and o's move N or W and the goal is to make the x's and o's change places in these two board positions and in the general case.
Easy:

+-+-+-+    N
|x|x|x|  W + E
+-+-+-+    S
|x| |o|
+-+-+-+
|o|o|o|
+-+-+-+


Medium:

+-+-+-+-+-+
|x|x|x|x|x|
+-+-+-+-+-+
|x|x|x|x|x|
+-+-+-+-+-+
|x|x| |o|o|
+-+-+-+-+-+
|o|o|o|o|o|
+-+-+-+-+-+
|o|o|o|o|o|
+-+-+-+-+-+

No Solution Yet Submitted by Sir Percivale    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution general solution | Comment 1 of 3
Consider the middle row as empty. Every column can be solved as with the one-dimensional "trading places" problem, and in the end the middle row would be empty again.

So, a straightforward solution is: solve the middle row, and whenever the empty space is in an unsolved column, solve the column before continuing the middle-row-solution. As every square in the middle row will become empty at some time during the solution, in the end all columns and the middle row are solved.

  Posted by Robby Goetschalckx on 2006-06-07 11:54:11
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information