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.)
Ring around the rosy? Comment 3 of 3 |
I will try to see if we can be more efficient by using 
two dimensions. Consider the pieces on the spaces
A,B,C,D,E,F,G,H as indicated. We really just want to
rotate these 180 degrees. Let us move H into the center
and have A-G chase eachother's tails until they are in
thier opposite positions. The free square will now be
H's destination.
Before:
+-+-+-+-+-+
|A|x|B|x|C|
+-+-+-+-+-+
|x|x|x|x|x|
+-+-+-+-+-+
|H|x| |o|D|
+-+-+-+-+-+
|o|o|o|o|o|
+-+-+-+-+-+
|G|o|F|o|E|
+-+-+-+-+-+
After 30 moves:
+-+-+-+-+-+
|E|x|F|x|G|
+-+-+-+-+-+
|x|x|x|x|x|
+-+-+-+-+-+
|D|x| |o|H|
+-+-+-+-+-+
|o|o|o|o|o|
+-+-+-+-+-+
|C|o|B|o|A|
+-+-+-+-+-+
Now rotate I,J,K,L,M,N similarly in 17 moves:
+-+-+-+-+-+
|o|x|o|x|o|
+-+-+-+-+-+
|I|x|J|x|K|
+-+-+-+-+-+
|o|x| |o|x|
+-+-+-+-+-+
|N|o|M|o|L|
+-+-+-+-+-+
|x|o|x|o|x|
+-+-+-+-+-+
Likewise for O,P,Q,R,S,T except before closing off the
loop on the 17th move (64th overall) leave a space open
to rotate the last four:
+-+-+-+-+-+
|o|O|o|P|o|
+-+-+-+-+-+
|o|x|o|x|o|
+-+-+-+-+-+
|o|T| |Q|x|
+-+-+-+-+-+
|x|o|x|o|x|
+-+-+-+-+-+
|x|S|x|R|x|
+-+-+-+-+-+
After 63 moves:
+-+-+-+-+-+
|o|o|o|o|o|
+-+-+-+-+-+
|o|U|o|V|o|
+-+-+-+-+-+
|o|o|T| |x|
+-+-+-+-+-+
|x|W|x|X|x|
+-+-+-+-+-+
|x|x|x|x|x|
+-+-+-+-+-+
Now swap U,V,X,W in nine moves and finish off with T
for a total of 73 moves.

I guess this isn't very efficient as it isn't hard to
do in 48 moves using the direct approach.

Oh well.

Edited on June 8, 2006, 12:51 am

Edited on June 8, 2006, 12:57 am
  Posted by Eric on 2006-06-08 00:49:06

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 (21)
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