This is a solver for LYNE game. It can also gradually show the connections, which is a helpful way to get a hint without showing the entire solution.
The solver is written in JavaScript and HTML+CSS+SVG. It should work on any modern browser, desktop or mobile. It has been tested on Google Chrome 43 and Mozilla Firefox 38.
Open the solver online, in your browser!
Write the puzzle description as text in the main text box. Click Solve it!
to find a solution. Drag the slider to gradually reveal random lines until the full solution is shown.
The puzzle description is plain text formed by the following characters:
- Lower-case
t
,s
,d
,p
,h
letters denote shapes. - Upper-case
T
,S
,D
,P
,H
letters denote terminator nodes (shapes that are white inside). Paths will always start and end in a terminator node. - Numbers
1
,2
,3
,4
denote gray shapes that have 1, 2, 3 or 4 paths passing through them. - Space character denotes an empty space.
- Alternatively, the
0
(zero) character also denotes an empty space.
Note that the original LYNE game only contains 3 shapes and does not have all 4 types of gray nodes.
This solver can be downloaded and used offline. However, running it from the local filesystem on Google Chrome will not work due to "same origin" security restrictions. Read more about it, or follow issue 47416. Firefox seems to be able to run it from the local filesystem without any issue.
LYNE is a puzzle game written by Thomas Bowker using Unity. It is available on digital distribution platforms: Google Play, Amazon App Store, iTunes, Steam, Humble Bundle Store, itch.io. It is also available DRM-free.
This solver was written by Denilson Sá using modern web technologies. The list below contains some highlights of the underlying code:
- The gray diamond shape in the background was written using pure CSS, with a combination of
linear-gradient()
andbackground-size
, inspired by CSS3 Patterns Gallery. - The layout is done using
flex
and viewport-relative units, which means it is responsive and should adapt to any screen size. Some scrolling might be required if the display is not wide enough, and this was a deliberate choice. - The slider is HTML5
<input type="range">
. - Pure JavaScript code without using any additional library.
- Event-handling through
oninput
event, which fires as soon as the text or the slider changes their value. This gives a faster feedback thanonchange
and is much better than usingonkeydown
/onkeyup
/onkeypress
events, because it will work even if the value is changed by the mouse, and it won't run the even handler if the user just presses keys without changing the content (e.g. arrow keys). - Graphics built using SVG. Each shape is defined once using
<defs>
and<symbol>
, and later used as many times as needed with<use>
. - Dynamically-generated SVG content. For some reason, browsers do not allow modifying
viewBox
attribute in<svg>
element, nor modifying any of the relevant attributes of<use>
element. For this reason, the entire SVG source-code is rewritten into a string and then added to the document (usinginnerHTML
). - The solver is implemented as a simple recursive backtracking algorithm.
- The algorithm runs in a background thread using Web Workers.
- Many LYNE puzzles have multiple solutions. The solver finds one arbitrary solution. It is possible to adapt the code to find all solutions, but it would also require additional code to remove duplicate solutions.
- There is function to output a plain text representation of the solution, but there is no UI for it. It was implemented as a way to check if the algorithm worked, before the SVG-building function was written.