Code optimization

eulerscheZahl
Posts: 58
Joined: Thu Nov 29, 2012 7:45 pm
Location: Germany

Post by eulerscheZahl »

Every field might affect every other field.
So, for this level you have a 12x12 matrix (you might want to remove the walls for performance, but that's not necessary). Entry m_ij is 1, if clicking field i swaps field j.
Additionally you need the initial value of the fields in the equation system.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

eulerscheZahl thanks
And what size at the last level?
What time has you at the last level?
eulerscheZahl
Posts: 58
Joined: Thu Nov 29, 2012 7:45 pm
Location: Germany

Post by eulerscheZahl »

The last level has a size of 300*300.
It took my solver 30 minutes. After solving it I had an idea how I could reduce the time - but never implemented it.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

At such approach have we always the optimal solution (by steps quantity)?
eulerscheZahl
Posts: 58
Joined: Thu Nov 29, 2012 7:45 pm
Location: Germany

Post by eulerscheZahl »

No. This gives a solution but not the one with the minimum number of steps.
For codeeval I had to modify my code.
I doubt that it is possible to solve it with minimum number of steps in reasonable time.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

codeeval :) And I have used it for projecteuler
eulerscheZahl
Posts: 58
Joined: Thu Nov 29, 2012 7:45 pm
Location: Germany

Post by eulerscheZahl »

Right, projecteuler. That's how I got my nickname.
Friendkey: 288286_1f4835abc87ad033bf91098892ecc81d

Unfortunately I'm stuck there (and here at hacker.org as well).
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

eulerscheZahl wrote:The last level has a size of 300*300.
How the solution will be sent if coordinates in answer are up to FFh (255)?
eulerscheZahl
Posts: 58
Joined: Thu Nov 29, 2012 7:45 pm
Location: Germany

Post by eulerscheZahl »

I used a format like 0010101101010...
1 means, that you have to click the field. Go from left to right and then from top to bottom.
As the answer will get quite large, you have to send it via POST instead of GET.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

tails wrote:Hi, it took 18 seconds for me to solve the last level.
I think we can do much quicker if we use a better algorithm and a better computer.
When I finish, can you teach me? :wink: it would be very informative and very interesting!
Around the 500th my time about 10 min., it isn't pleasant to me and I don't know that it is still possible to optimize :cry:
Why for games we have no topic for solved, where it would be possible to share experience and to learn?
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Isaev wrote: Why for games we have no topic for solved, where it would be possible to share experience and to learn?
Well, what do you consider as "solved"? At some points in the past, new levels had been added to some of the Puzzles if I am not mistaken. So where to draw the line?
Hckr
Posts: 27
Joined: Thu Mar 25, 2010 2:16 pm

Post by Hckr »

Right.

One could simply add more levels to Crossflip and would hereby create a new level of mastery for the competing hacker community. After all, that's all we want, right? :-)
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

AMindForeverVoyaging wrote:
Isaev wrote: Well, what do you consider as "solved"? At some points in the past, new levels had been added to some of the Puzzles if I am not mistaken. So where to draw the line?
Yes, you are right. But it is all the same deprives of valuable communication with the purpose of exchange of experience. It is better to do probably new minigames, than to infinitely update old. Well or to make at once enough that obviously nobody has reached the end.
Post Reply