Page 1 of 2
Slither Link
Posted: Fri Feb 08, 2013 8:35 pm
by celynwalters
If anyone hasn't played Slither Link (a.k.a. Puzzle Loop) (I'd be surprised if many people have), it's a puzzle where you must create a loop by surrounding the cells with the correct number of lines.
So a box with a 3 in should have three adjacent lines.
Also, when you finish, there should be one complete loop, and one only.
I'm a fan of the game, but computer versions are hard to play (I have a trackpad, so point and click takes too much effort).
The most definitive versions can be found here:
http://www.puzzle-loop.com/
http://kwontomloop.com/
There's a lot i'd like to add, like a timer, highscores, and most importantly, puzzle generation.
But this was really a training exercise, so it might take ages before I finish it.
Mouse = Select cells
WASD = Add a line around selected cell
` = Toggle Debug
l = Toggle line status display
c = Toggle cross status display
o = Toggle loop display
Here you go:
Re: Slither Link
Posted: Sat Feb 09, 2013 2:24 pm
by micha
I am a fan of slither link puzzles. Cool you made this game. Looks like you have put a lot of thoughts into it to provide advanced information for better solving.
Unfortunately, for me the combined mouse+wasd control doesn't work well. From other implementations I am used to clicking the line segments directly, instead of accessing a line by first choosing a cell. To me it is like one unnecessary extra step. I also work a lot with crossing out impossible line segments. In your implementation i have to press the button twice, which for me slows it down.
I like the way it is implemented here:
http://www.chiark.greenend.org.uk/~sgta ... loopy.html.
Also the way of displaying crossed out segments I very well here.
Re: Slither Link
Posted: Sat Feb 09, 2013 6:04 pm
by celynwalters
I see where you're coming from.
We'll have to agree to disagree, though.
Maybe is is much easier with a mouse to point and click.
Plus, I like being able to do two/three lines/crosses at once.
If I was planning to release this/if and I release this, I guess I would have an option to choose between the input modes.
I'm a fan of the point and click method in the link you posted, you don't actually have to click directly on the line
Re: Slither Link
Posted: Mon Feb 11, 2013 6:21 pm
by Ref
Ok! Now come up with the AI to show the shortest path that meets all the criterion.
Re: Slither Link
Posted: Tue Feb 12, 2013 7:22 am
by micha
Ref wrote:Ok! Now come up with the AI to show the shortest path that meets all the criterion.
This is a puzzle game (like sudoku is). If the puzzle are well posed (and the one in this demo is) then there is only one unique solution to the puzzle.
On the AI side, the more challanging problem is to write a program that generates puzzles, that have a unique solution and that are interesting to solve.
Re: Slither Link
Posted: Tue Feb 12, 2013 3:31 pm
by Ref
Guess the first step would be to write a program to solve these puzzles.
Re: Slither Link
Posted: Tue Feb 12, 2013 4:40 pm
by micha
Ref wrote:Guess the first step would be to write a program to solve these puzzles.
That's true.
The puzzle generation codes I know usually put random numbers into the grid and then try to solve the puzzle. If the puzzle has a unique solution, puzzle generation was successful, otherwise, some numbers are changed, until the solution exists and is unique.
Re: Slither Link
Posted: Tue Feb 12, 2013 4:51 pm
by celynwalters
micha wrote:That's true.
The puzzle generation codes I know usually put random numbers into the grid and then try to solve the puzzle. If the puzzle has a unique solution, puzzle generation was successful, otherwise, some numbers are changed, until the solution exists and is unique.
That's a good idea. I was worried that if I did this, then the solution could be too hard to reach humanly, but I suppose to decrease the difficulty, you could just give the player more numbers in the grid initially?
Currently though, if you have a trailing line that isn't part of the loop, it is still allowed... I'd have to sort that out first.
Re: Slither Link
Posted: Tue Feb 12, 2013 10:32 pm
by micha
celynwalters wrote:That's a good idea. I was worried that if I did this, then the solution could be too hard to reach humanly, but I suppose to decrease the difficulty, you could just give the player more numbers in the grid initially?
If you are planing to implement automated puzzle generation, here is how it is done in the software, that I know:
First you make a list (on paper) of techniques for solving the puzzle. Order these techniques by difficulty. One example: One technique is to cross out the four line segments in a zero-square. This is a very simple technique. More advanced techniques might involve counting the number of exits to a certain area of the playing field. I suppose you know these techniques. In the end you should have a list of techniques:
1) technique 1 (easiest)
2) technique 2 (still easy)
...
Then implement these techniques. Write the code in such a way, that you can tell the program, which techniques it is allowed to use. By that you can determine the difficulty of a puzzle. If you have 10 techniques, but the current puzzle can be solved with only techniques 1 & 2, then the puzzle is likely to be easy to solve. If you have to use all 10 techniques, then the puzzle will probably be hard.
Next, write some code that generates solved (!) puzzles. So first draw the loop, and then fill in all(!) numbers. In the next step you remove numbers from this full grid, until you reach a point where you no longer can remove numbers without making the puzzle unsolvable (or having multiple solutions). By specifying which techniques your AI uses, you can control the difficulty of the puzzle that comes out.
I want to add, that even though I know the general procedure, I have not implemented this myself. I suppose the devil is in the details.
One last thing: The source of the "loopy"-slither link implementation, I posted above, is open. So if you are interested you can have a look into the code.
Re: Slither Link
Posted: Mon Aug 05, 2013 12:33 pm
by medlingracia
Hi, your slither link implementation looks cool. I would like to have a look at the code that u've designed. is it possible to provide me the link? I did try opening your "Slitherlink.love", but it does seem to be working... Could you please give me the source code..
Thanx !