e meio.

quinta-feira, setembro 20, 2012

big jet plane - as a big fan of puzzles, I gotta say that I was quite eager to get The Curse since it was announced earlier this year. not because I expected to find some different puzzles, as the first idea that comes to mind when you check the app's screenshots is Professor Layton, but because it is always good to have a good collection of classic puzzles wrapped up in a nice story -- which is definitely the case.

getting all the way to the end of the game might be a too long journey for some people, though. personally, 100+ puzzles for U$0,99 (at the beginning of its sale) is a steal; yet, it might be kind of heavy (for both regular and non-regular puzzle player) to go through all the game if you are faced with

1) timed/reflex puzzles, which seem to me a test of dexterity rather than logic;
2) repeated puzzles, as it might be a pain to those who does not like a special kind of puzzle (that's me and sliding blocks and tangram, which make up to ~15% of game).

that said, there is still lots to see in the game, and it feels great to find a puzzle that looks impossible at first, but you can rationally figure your way out of it. that's what happened to me and "Puzzle #90, Circular Picture", which I'll explain how to solve it over the next lines.

this is neither a great programming piece, nor a miraculous hard math problem (i loved seeing people solving sliding blocks with other programming pieces :); yet, if you didn't figure it out for yourself you might find the explanation interesting!

(should you just need the answer, I provide an excel file at the end of the post. it is 2MB, but gets up to 10MB when unzipped)

Puzzle #90, Circular Picture

composed of 1 central fixed circle and 3 rings around it, your task is to rotate the rings in such an order to make mannequin's (the game's main character) face correct. this was supposed to be easy, should the rotation of any of them did not affect the rotation of the other two... getting this puzzle solved without some thinking takes a considerable amount of luck, if you're not aware of its mechanics. there are some details of it, though, that once known make it easily breakable (a lot easier than programming answers for sliding blocks, for instance) if you know some math and have some free time.

defining the puzzle with words would probably sound like: "considering the inicial position of each of the three rings, how many times should I turn each of them in order to put them in the correct position, considering that they affect each other?"

should we write it with some math (I'll try to be as clear as possible - I'm not a professional, sorry), things will look a bit different, but also will show us where to look for the solution. 

considering the functions:
I(x) - inicial position of ring x
N(x) - # of turns made directly to ring x
E(x,y) - # of indirect turns on ring x due to turns made directly on ring y
F(x) - final position of ring x

therefore, our first attempt on defining the problem is:
I(1) + N(1) +             N(2)*E(1,2) + N(3)*E(1,3) = F(1)
I(2) + N(1)*E(2,1) + N(2) +             N(3)*E(2,3) = F(2)
I(3) + N(1)*E(3,1) + N(2)*E(3,2) + N(3)             = F(3)

let's start understanding the influence between rings - E(x,y). some quick tests on the puzzle will make you notice that, for example, if you turn the rings one space forward and then back, the image will remain the same, so the influence of moving them clockwise or counterclockwise is symmetric. from that, we can then determine that, for every normal rotation move, the other two rings always move 2 or 3 spaces in the opposite position. jayisgames' walkthrough is quite straight-forward on that (let's consider ring 1 to be the inner ring, ring 2 to be the middle one and ring 3, the outer ring)
Moving Ring 1 one space also turns Ring 2 three spaces in the opposite direction and Ring 3 two spaces in the opposite direction.
Moving Ring 2 turns Ring 1 two spaces in the opposite direction and Ring 3 three spaces in the opposite direction.
Moving Ring 3 turns Ring 1 three spaces in the opposite direction and Ring 2 two spaces in the opposite direction.
but how does that work in our solution space? how many positions are possible for every ring to be and how to define each possible position? though it may not look, there are 36 possible positions for each ring (which in theory would make possible for the puzzle to have 46656 different positions, but 1) it is actually less than it due to the relation between the rings and 2) is the kind of info that definitely doesn't help us solving the puzzle).

from this, we are now capable of defining 1) what is the inicial position and 2) what must be the final position of each ring by creating some kind of coordinate system. we can use any kind of reference but, for the sake of making it easier for us, let's use the space where the neck of mannequin should be at the end as reference (F, in our equations) and call it 0 for all positions; all the other positions will then be numbered clockwise based on the zero, being 35 the last position before it turns to 0 once again.

Our reference system

the particularity of solving a circular puzzle makes us add something to our initial math definition. since after 35 comes 0, we must include a math system called modulus, so we can adapt our problem for numbers to "wrap around" upon reaching a certain number -- that is, 36.

the last thing missing is the initial position of the rings in the puzzle. move each of the rings all the way to their supposed final (~ correct) position and count how many spaces you moved it all the way back to their initial position. on our example, I(1) = 20, I(2) = 24 and I(3) = 24.

a good way to check if you have picked correctly the initial position of the rings is to sum all three positions - if it is a multiple of 4 (*), good news; if it isn't, check again if you put the ring exactly back at the initial position, if you went all the way to the correct position or if you counted correctly on the way of doing it

notice that this is actually the ONLY real input you need in order to solve the problem (and to use the excel file I made), so use this pictutre (once again from jayisgames) to check what it should look like at the end.

by now, our equations have become:

mod36 ( 20 + N(1)         + N(2)*(-3) + N(3)*(-2) ) = 0
mod36 ( 24 + N(1)*(-2) + N(2)         + N(3)*(-3) ) = 0
mod36 ( 24 + N(1)*(-3) + N(2)*(-2) + N(3)         ) = 0

should we just change notation to make things clearer and use N(1) = x, N(2) = y and N(3) = z...

mod36 ( 20 + x - 3y - 2z ) = 0
mod36 ( 24 - 2x + y - 3z ) = 0
mod36 ( 24 - 3x - 2y + z ) = 0

and we are now down to system with three variables and three independent equations that can be solved for natural numbers. should you want to solve the problem for yourself from now on, just change the initial positions (20, 24, 24) on those equations and go for it. you can follow lots of different paths!

I chose to go for a brute force method -- detailing every possible combination of moves of all the rings, that means, the combination of moving ring 1, 2 and 3, from 1 to 18 times, in both directions. feel free to use this excel file (sorry, could not find another working file sharing service that required no sign up) if you like -- just input the initial position of the rings as described above, and it will provide you the shortest number of turns required (and direction) to solve the puzzle.

(*) this is an easy, but "cute" finding -- the sum of the position of the three rings is 0+0+0 = 0, and every move adds 1 move in one direction and 5 (-2 on one ring and -3 on the other) in the opposite direction, then we get that any change to the puzzle will make the sum of the positions of the rings to be a multiple of 4.

12:41 PM.



/// comentários [0]

Postar um comentário || Home

gpf, by billy.