When given an n by n matrix, the goal of the n-queens problem is to place n queens on the board such that none of them are attacking each other (under the rules of chess for queen movement). The rules are a queen can move any number of cells, in one of the 8 directions, so long as it doesn’t jump another piece. Pretty simple — right?

an n-queens solution

Given my solution for solving 8-puzzle, my initial inclination was to build out the entire search space as a graph moving, attaching edges for each potential move. 8-puzzle had 9 pick 9 permutations…


Previously, I wrote about implementing a stream cipher in JavaScript. I ignored the complex issue of generating a stream of bits used to encrypt the plain text. Having sat on it for a week, I felt like I needed to explore the area of randomness to complete the thought cycle on Stream Ciphers.

An easy algorithm to implement is the Linear Feedback Shift Registers (LFSR) as it has simple solutions in hardware and software. …


There are many models for capturing functional requirements and many less for non-functional requirements. We need to adapt those that exist for non-functional requirements into our agile frameworks. The misuse case is a great model for capturing the attackers intent — but how does that fit in Agile, or how can we make an equivalent fit in Agile.

Those in software are well aware of the use case, a tool specifying required behavior and features in product development effort. A use case is useful in specifying a set of actors (systems or objects) and actions (or interactions) between those actors…


There is a growing community of strongly typed scripting languages that transpile into JavaScript, with Typescript leading the way. The temptation of catching type issues in a compile phase is sometimes strong enough that we reach of a more type safe tool. But we can get type safety (or certainty) through an alternative technique — guarding your functions. There are a few tutorials around the concept of guarding your functions, many years ago I found this blog by Mike Stay (which eventually dives into category theory).

Becoming familiar with the evolving JavaScript library ecosystem is an enormous task. Sanctuary is…


digital key

Symmetric Cryptography, in particular encryption, has a requirement that a message is both encrypted and decrypted with the same key. Under this umbrella we find Stream and Block ciphers. Stream Ciphers work on bits one at a time while Block Ciphers work on blocks (or groups) of bits. There is plenty written regarding Symmetric Cryptography as well as Stream and Block ciphers. This article is an exercise in implementing a Stream Cipher with modern JavaScript. The focus is on implementing a simple cipher and readability of the code — not speed nor secrecy. It is worth mentioning: if you need…


I am deepening my understanding of cryptography. While I probably should have started this 20 years ago (or even in 2014 as Bit Coin started making noise), there is no time like the present to continue learning. One of the texts I have selected to start with is Understanding Cryptography. The plan is to get my hands dirty and code along with the text (to prove to myself a minimal competency). My weapon of choice (over the past three years) is JavaScript — and while it was up to the task of the first cipher it wasn’t without challenges.

The…


In my prior post, I laid out the problem of the eight-puzzle.

In this post, I want to examine finding a solution from a starting point leveraging search techniques. As a reminder, the solution space is a graph of puzzle states and moves to subsequent states, for example:

Each state is a pair of an ID (or key) and its value an array of what tile is in which puzzle spot. The graph contains 362,880 nodes and 967,680 edges. Brute force search is capable but really not an optimal technique. …


I am starting my journey into AI and it seems like a study of search is a primary requisite for the space. The initial coming of age problem looks to be a simple puzzle, Eight Puzzle. I was introduced to the puzzle as child, and was reminded of that as I returned 40 yrs later.

8-puzzle cat image

My first puzzle was not too unlike the cat puzzle to the left. Instead of consisting of a 4x4 with 15 moving pieces, my toy was 3x3 with 8 moving pieces (oh, and it was a train moving down some tracks). The game allows you…


Over recent years I have managed a team that implements digital analytics solutions by integrating third party tooling within the browser. Historically this approach requires in-browser code for every analytic you want to report on. The solution worked, in that it provided the reports our analysts required, but it felt off to me. We were not collecting the raw events, and therefore potential data science use cases could not be satisfied. If an Issue occurred with the deployment of these in-browser solutions the result was incorrect and unrecoverable data. …


Two popular languages for lightweight services are Java versus JavaScript. The choice is a debate or battleground. I have seen many engineers look at their preferred language with the sense of nostalgia and comfort they place in their favorite home cooked meals. Perhaps blinded by the Paul Grahams blub paradox:

…I’m going to use a hypothetical language called Blub. Blub falls right in the middle of the abstractness continuum. It is not the most powerful language, but it is more powerful than Cobol or machine language [or Visual Basic]. And in fact, our hypothetical Blub programmer wouldn’t use either of…

Todd Brown

A 25 year software industry veteran with a passion for functional programming, architecture, mentoring / team development, xp/agile and doing the right thing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store