mkonicek / scala-99-problems Goto Github PK
View Code? Open in Web Editor NEWSolutions of some of the Ninety-Nine Scala problems
Solutions of some of the Ninety-Nine Scala problems
Solution of the Problem 99 from http://aperiodic.net/phil/scala/s-99/ The algorithm is backtracking with a simple observation: - for some segments, there is only one option (one word of suitable length) -> place it immediately - when there are more options, try the segments with least options first Such heuristic is enough for the algorithm to solve the sample problems almost without backtracking. Try running "crosswordsolver input/p99d.dat -debug" to see the progress of the algorithm. There are quite a few opportunities for optimization (searching more branches in parallel would be fun!), but even this solves all the sample problems under 60ms on my laptop. Overview: The representation of the crossword is the following: - Each 'dot' in the crossword is represented by one Cell. - Each line to put a word in is represented by a Segment. - A Segment has Intersections which tell with which other Segments it intersects (useful for Solver). - Crossword is: - a collection of Segments - a collection of input words - a 2d matrix of Cells holding the layout of the crossword (for printing) Loader builds the Crossword from the input file. Solver gets an empty crossword and returns a Solution containing filled crossword, or None if there is no solution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.