Minesweeper in Clojure
sneakycode.net
sneakycode.net
#:minesweeper{:size [w h]
:bombs #{[x y] ...}
:flags #{[x y] ...}
:guesses ([x y] ...)}For anything more complex, I immediately reach for DataScript as a client-side Datalog DB.
https://github.com/Lokeh/lilac.town/blob/master/src/lilactow...
Btw, really great write up - I think you did a great job explaining the process of solving problems in Clojure.
Also, you probably want to stop clicks on marked squares from exploding the mine.
edit: [Shift] + Click to flag.
The easiest thing to do is to write a solver which will iteratively mark squares it knows to contain a mine, or knows don’t contain a mine. If the solver can find all the mines the board is solvable. Only present the user with boards that your solver can solve.
https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/min...
https://www.chiark.greenend.org.uk/~sgtatham/puzzles/
They're all open source and I believe available on iOS as well as android for free for mobile users too.
And there's also Typed Clojure, but that might not be the best experience starting out.
https://sdegutis.com/blog/2015-02-10-haskell
And some of the cons of Haskell in that article may be addressed by these extensions:
wat? is this really true?
http://www.lispworks.com/documentation/lw50/CLHS/Body/m_dest...
Don't know if Rich first got the idea from Lisp or not, but it seems likely since he did a bunch of development in Common Lisp (generating C++, of all things :-D ) ages ago.
I don't remember if I heard him talk about that in the "Expert to Expert" video ( https://www.youtube.com/watch?v=wASCH_gPnDw ), or in "Simple Made Easy" ( https://www.youtube.com/watch?v=34_L7t7fD_U ). I think it was the former, but both of those are worth watching multiple times. It's also entirely possible that it was in an entirely different video of his -- but it was him.
I've yet to be disappointed in any of his talks, so if I'm wrong about the exact one, just keep watching any of his talks on YouTube till you find it. xD
Then, I recommend Common Lisp over Clojure, because that has a lot of things that are uncommon even decades after standardization.
Finally, for a practical, day-to-day driver language, Clojure is really good. It's a personal go-to for any server side coding I have to do. (I rarely do front end work and have no preferences there beyond Unity if it is a game.)
Haskell primarily tries to answer the question, “What are static type systems capable of, and what new relationships can we achieve between code representation and code execution?”
Clojure primarily tries to answer the question, “How can we write programs more efficiently in the (relatively) short term?”
The answer is, pretty damn far.