Skip to content

Instantly share code, notes, and snippets.

@davisp
davisp / a.md
Last active August 23, 2021 20:49
Solving Ruzzle™ with Machine Vision

Solving Ruzzle™ with Machine Vision

Have you ever found yourself being spanked repeatedly by your spouse's coworker at a free iOS game and thought to yourself, "You know, I could probably write a program to solve this...", but then realized you have better things to do with your time? This is that, except for the second half.

Due to a confluence of events, I've recently found myself in position of having a copious amount of free time. As such, when I had the initial thought of being petty enough to spend a few days writing a program just to beat a whipper snapper nearly fifteen years my junior, there was nothing in real life that prevented me from just laughing at the idea. So here we are. After a couple weeks of tinkering I've managed to write a fully automated solver for [Ruzzle™][1].

Ruzzle™ - The Gameplay

For those not familiar, Ruzzle™ is simple word game that is a bit of a mashup of [Boggle][2] gameplay and [Scrabble][3] scoring.

>> {
"select": "@",
"from": {
"file": "data/emojis.jsonl"
}}
{
"results": [
{
"img": "https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png?v8",
"name": "+1"
>> {"select": "@", "from": {"file": "data/emojis.jsonl"}, "where": "contains(@.name, 'woman') && contains(@.name, 'zombie')"}
{
"results": [
{
"img": "https://github.githubassets.com/images/icons/emoji/unicode/1f9df-2640.png?v8",
"name": "zombie_woman"
}
]
}
$ ./target/debug/examples/basic
>> {"select": "@", "from": {"json": [{"_id": "bar", "value": 1}, {"_id": "foo", "value": 2}]}}
{
"results": [
{
"_id": "bar",
"value": 1.0
},
{
"_id": "foo",
Ok(Object({Expr { expr: from }: Object({Expr { expr: json }: Array([Object({Expr { expr: id }: String(Expr { expr: foo }), Expr { expr: value }: String(Expr { expr: bar })}), Object({Expr { expr: id }: String(Expr { expr: baz }), Expr { expr: value }: String(Expr { expr: bam })})])}), Expr { expr: select }: String(Expr { expr: @ })}))

Smoking a Brisket.

  • A short story by Paul J. Davis

So you want to smoke your first brisket. This is a quick introduction on how you might accomplish that.

Step 1: What is a brisket?

apps_dirs:
- "src/*"
include_dirs:
- "src/"
- "src/*"
- "src/**/include"
- "src/**/test"
diagnostics:
disabled:
- dialyzer
otp_path: "/path/to/otp/lib/erlang"
apps_dirs:
- "src/*"
include_dirs:
- "src/"
- "src/*"
diagnostics:
disabled:
- dialyzer
- elvis
diff --git a/Syntaxes/Erlang.xml b/Syntaxes/Erlang.xml
index 2cf39d8..097c205 100644
--- a/Syntaxes/Erlang.xml
+++ b/Syntaxes/Erlang.xml
@@ -256,6 +256,7 @@
<include syntax="self" collection="keyword" />
<include syntax="self" collection="textual-operator" />
<include syntax="self" collection="function-call" />
+ <include syntax="self" collection="map" />
<include syntax="self" collection="tuple" />
<?xml version="1.0" encoding="UTF-8"?>
<syntax name="lisp">
<meta>
<name>Lisp</name>
<type>script</type>
<preferred-file-extension>lisp</preferred-file-extension>
</meta>
<detectors>
<extension priority="1.0">cl</extension>