LightsOut Solution using Linear Algebra

LightsOut is an electronic single player game manufactured by Tiger Toys in 1995. In the original version, 25 lights are arranged in a 5 by 5 lattice. Each of these lights can either be on or off and its state can be inverted with a button related to that light. Additionally, all four horizontally and vertically adjacent lights - forming a cross - get inverted as well when a single light gets pressed. The goal is to turn all lights out, starting with a random pattern of lights, although we will see that not every pattern has a solution.

How to plot a covariance error ellipse

A typical way to visualize two-dimensional gaussian distributed data is plotting a confidence ellipse. Lets assume we have data \(D\sim\mathcal{N}(\mu, \Sigma)\) and want to plot an ellipse representing the confidence \(p\) by calculating the radii of the ellipse, its center and rotation. The following plot shows randomly drawn data and the ellipses for \(p\in\{0.9, 0.95, 0.99\}\):

Create a circle out of three points

A circle is a set of infinite points in two dimensions. However, a circle is clearly described by three of such points. The opposite direction is also correct as long as not all three points are on a straight line.

Make a Fair Coin from a Biased Coin

If we have a biased coin, i.e. a coin that comes up heads with a probability not equal to \(\frac{1}{2}\), how can we simulate a fair coin? The naive way would be throwing the coin 100 times and if the coin came up heads 60 times, the bias would be 0.6. We could then conduct an experiment to cope with this bias.

Mathematics of a roller chain animation

Given two circular sprockets \(C_1(M_1, r_1)\) and \(C_2(M_2, r_2)\) with their midpoint and radius, we want to find a way to put a chain around them and animate the links like this:

Operate a Syma S107G Remote Control Helicopter with an Arduino

Some time ago I saw people reverse engineering the infrared protocol of the Syma S107G toy helicopter and I wanted to get my hands on it as well. It is a coaxial helicopter, which means that it doesn't require a torque cancelling tail rotor. Yaw is controlled by using the speed difference to a second rotor underneath the main rotor, which spins in the opposite direction. It's really astonishing what good quality you get for just 20 bucks. It crashed quite often and it still flies like new.

How to map a Square to a Circle

When you work with a game controller, you would expect the joystick coordinates to be circular. In reality, you get the information from two seperated axis, which spans a rectangular coordinate-frame. I was thinking about how to derive a way of mapping a rectangular grid to a circular space like so (use your mouse):

Using Gamepads in JavaScript via node.js

I needed game controller support in node.js for a bigger JavaScript robotics project I'm currently working on. There are a few libraries already but none of them were sufficient for this job, so I wrote an own library called gamecontroller myself.