Wires: rotate the tiles so they are all connected

The objective is to connect all the tiles by rotating them, see screenshot.

http://www.student.dtu.dk/~s021864/wires/wires-screenshot.png

The class files and source code can be found in this executable jar file:
http://www.student.dtu.dk/~s021864/wires/wires.jar

Right now you use either the keyboard or the mouse (if you have a scroll wheel, that is). If anyone has suggestions then they are very much welcome.

Very cool game. Quite addictive.

Clever game!

Plane: 16x10 in 688 seconds; and I would have done it quicker if I realized they all had to be connected. For some reason I thought that you just couldn’t have any loose ends.

EDIT: maybe not, my next try was 636; I demand you create a high score table for each variation

I really like that game! With time you get better and better… I just did a 10x16 in 350 seconds…

Wow, thanks for the comments. As much as I would like to, I cannot take credit for inventing the game. There are some rather similar games out there. There are quite a few tricks one can use under specialized circumstances, regarding e.g. multiple L-shaped tiles in a row. Part of the fun is to discover all these tricks. This is mostly relevant when you really get stuck, which is more likely when using wrapping or flipping topologies.

For the reference, I just completed 16x10 plane in 114 seconds.

Ok, I got 318, but 144 is just crazy … again I demand a high score table!

Now I’m getting my time down … 214 at the moment

too addictive ::slight_smile:

Very addictive. Managed 159sec once at 16x10.

I have a feature request. Sometime, I just can’t seem to find the problem on larger boards. So a solve or hint or both would be helpful.

Thanks for the suggestion, CaptainJester. I may implement it at some time, assuming I do have time.

In the meantime, you can get the solution to the puzzle currently played by disabling the “shuffle” checkbox, enabling “custom seed” and then creating, since the value in the spinner is the seed of the current game. Of course, if you wanted to look at both boards simultaneously, then you would have to copy-paste the seed to another instance of the game, which is admittedly quite inconvenient.

By the way, I will recommend trying some of the more complicated topologies. The planar topology provides a large number of hints since no connections can touch the edges. But it can be quite a challenge to solve the entire thing without those - then one will have to discover all the interesting tricks, the existence of which I have hinted at previously. Of course I may have include an option to disfavour the generation of tetravalent tiles, to make things really difficult.

That’s great. I like it, and my partner likes it too! Well done.

I’d just echo the comments of those who asked for a high score table - I think my other half wants to show off (she’s so competitive!) =)

Do you use a maze generation algorithm to create the grid? I would be very interested in seeing the code, if you are willing to share.

Woo-hoo 115 seconds for 16x10 plane.

Just had to brag. ;D

CaptainJester

One second faster and I would have to play 16x10 plane all over again, just to reinstate order in the universe :slight_smile:

The source is included in the jar (in one big jumble. But it was the way Netbeans liked it, and I didn’t feel like messing around. And I didn’t write proper comments. And the gui code is a mess. I’ll have to get it sorted out sometime. Enough with the excuses). The game is under GPL, so you are free to tinker with it as long as long as modified versions use the same license.

I use the simplest generation algorithm I could conceive.

Generation
An edge candidate is a potential connection from one tile to one if its neighbours. Each tile thus has four edge candidates which are shared among tile neighbours (so candidate count = 2 * tile count).

Make one big list of all possible edge candidates, then shuffle that list.

For each edge candidate in the shuffled list, connect the two corresponding neighbouring tiles, UNLESS that connection would be “illegal”.

Illegal means that the tiles are already connected somehow. Of course this means that we’ll have to keep track of connected tiles, which we’ll consider now.

Connectedness
Every tile is assigned a number, called its index. Whenever a tile is connected to another tile during map generation, the indices of both tiles is set to the lower of the two tile indices. Actually this is done by means of a recursive flood fill through all the thus interconnected tiles, so any body of connected tiles has the same index at all times. The criterion of not connecting tiles that are already interconnected is thus enforced by requiring that the two tiles have different index.

This always results in the lowest possible connection count, namely n vertices connected with n-1 edges. So not only does the generated map have no closed loops, there is indeed no solution at all with any closed loops, which can be quite a powerful criterion when solving difficult games. Also it is, not surprisingly, impossible to find any solution with any loose tile connections.

Just had to post this, to upset the balance of the universe. :wink:

http://www.myjavaserver.com/~captainjester/wires.png

I have played probably a thousand rounds already, so this took a while.

http://img250.imageshack.us/img250/1116/200708232332mf3.jpg

I’m getting there!

123!

Balance restored!

http://www.student.dtu.dk/~s021864/opendir/wires-quick.png

(of course, cheating would be indescribably easy. But we all trust each other here)

Damn. Don’t think I can get that low. ;D

Well if you practise without the hint for a couple of hours, you’ll get used to storing your positive assertions a lot better. 100 seconds can be beaten!