4 ms·
Another fun way to solve this is using Logic programming, e.g. http://baptiste-wicht.com/posts/2010/09/solve-einsteins-riddle-using-prolog.html http://baptiste-
by osense 10y ago
Another fun way to solve this is using Logic programming, e.g. http://baptiste-wicht.com/posts/2010/09/solve-einsteins-riddle-using-prolog.html http://baptiste-wicht.com/posts/2010/09/solve-einsteins-ridd...
- kriro 10y agoIndeed anything with constraints is usually a great use case for Prolog. I particularly like this version in ECLiPSe which is specialized on constraint programming with Prolog: https://gist.github.com/JuanitoFatas/2227711 https://gist.github.com/JuanitoFatas/2227711 I haven't benchmarked it but it is pretty intuitive to read which is very important for these types of problems.