ZachMEdwards Posted September 8, 2010 Share Posted September 8, 2010 My (nerd) friend presented me this puzzle today: There are 4 people on 2 sides of a room, with 1 empty spot in the middle (looks like AAAA_BBBB). Your ending goal is to reverse the starting order. So the solution is BBBB_AAAA. Here are the valid moves: Advance: Person moves into blank tile. (AAAA_BBBB -> AAA_ABBBB) Pass: Person hops around another person of opposite type into blank tile. (AAA_ABBBB -> AAABA_BBB) I've been at this for a good time and I still can't figure it out. I mean I guess I could hard write a solution but that'd be for a fixed amount (4 A's and 4 B's). I was think recursion but I'm not sure... Needing help ASAP in order to get my free lunch tomorrow! Quote Link to comment Share on other sites More sharing options...
.josh Posted September 8, 2010 Share Posted September 8, 2010 strrev Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted September 8, 2010 Share Posted September 8, 2010 Wow, that was easy. Quote Link to comment Share on other sites More sharing options...
Alex Posted September 8, 2010 Share Posted September 8, 2010 strrev may produce the correct output, but it doesn't adhere to the rules stated. Quote Link to comment Share on other sites More sharing options...
Alex Posted September 8, 2010 Share Posted September 8, 2010 edit: my solution won't work, I read part of the question wrong. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 8, 2010 Share Posted September 8, 2010 Does this work???? AAAA_BBBB AAA_ABBBB AAABA_BBB AAAB_ABBB AA_BAABBB A_ABAABBB ABA_AABBB ABAA_ABBB ABAABA_BB ABAAB_ABB ABA_BAABB ABAB_AABB AB_BAAABB _BABAAABB B_ABAAABB BBA_AAABB BBAA_AABB BBAAA_ABB BBAAABA_B BBAAABAB_ BBAAAB_BA BBAA_BABA BBA_ABABA BBABA_ABA BBABABA_A BBABAB_AA BBAB_BAAA BB_BABAAA BBB_ABAAA BBBBA_AAA BBBB_AAAA Quote Link to comment Share on other sites More sharing options...
.josh Posted September 8, 2010 Share Posted September 8, 2010 strrev may produce the correct output, but it doesn't adhere to the rules stated. I beg to differ. It's not my fault the rules were vaguely stated. Quote Link to comment Share on other sites More sharing options...
Alex Posted September 8, 2010 Share Posted September 8, 2010 strrev may produce the correct output, but it doesn't adhere to the rules stated. I beg to differ. It's not my fault the rules were vaguely stated. The program is just a representation for the abstract problem. The output itself isn't important, what it represents is. If I created a suitable solution but made it so it outputs the result using 0s and 1s rather than As and Bs there would be no difference because they both represent the same idea. However, your output doesn't represent the idea, so it is therefore meaningless. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.