Super-simple banana ice cream

It really doesn’t get simpler than this. Take some ripe bananas, chop them up into smallish chunks, freeze them, blend them, done.

It’ll have the consistency of soft serve ice cream. Add some peanut butter or whatever for extra flavour. Freeze it after blending if it’s too soft. So easy, so tasty.

Three types of voting problems

Consider an electorate divided solely on some linear issue X. Assume the breakdown is as follows:

Wants more XWants same XWants less X
45%20%35%

Assume also that each position has only two representatives. Pretend you’re a voting system and imagine the ballots these people submit to you. How do you aggregate these votes to best represent the electorate? I’d argue the following is fair:

MoreSameLess
1 winner1 winner
2 winners1 winner1 winner
3 winners1 winner1 winner1 winner
4 winners2 winners1 winner1 winner
5 winners2 winners1 winner2 winners
6 winners2 winners2 winners2 winners

As an aside, note that the result at 6 winners isn’t really proportional to the popular vote, but that we were constrained by the number of running candidates. Had More X another candidate to run, More/More/More/Same/Less/Less would have been a fairer result.

More to the point though, notice the oscillation between the 1 and 2 winner scenarios. Although the electorate is best represented with a single Same X winner, More/Less better represents the electorate than Same/Same. While this holds true when the number of winners is known and fixed, our notion of fair changes when the number of winners is variable.

Consider the scenario where you have one representative, but occasionally need a second. Since the first representative is fixed, you choose your second proportional to the electorate. We’re looking at generating an ordered list of candidates.

Proportional Ranking
First placeSame
Second placeMore
Third placeLess
Fourth placeMore
Fifth placeLess
Sixth placeSame

Note the difference here between a fixed two-winner election (where we chose More/Less) and the proportional ranking (which starts off Same/More). In this different problem space, a fair outcome produces different results.

Lastly, consider the scenario where you only need one winner, but you need a runner up in case the first winner is unable to take the position.

Non-proportional Ranking
First placeSame
Second placeSame
Third placeMore
Fourth placeMore
Fifth placeLess
Sixth placeLess

Where in the first example we provided More/Less as a fairer alternative to Same/Same, the problem space for this third example would dictate Same/Same over More/Less. Again, different results for the same notion of fair.

These three scenarios have produced significantly different results, illustrating fixed-winner allocation, proportional ranking and non-proportional ranking. Hopefully this highlights the need to determine in advance the context in which you’re bringing things to a vote.

The one question I have in all of this is how to distinguish between these two problems:

  • One winner every couple of years (e.g. federal elections) is likely best suited with fixed-winner allocation
  • One winner every hour (e.g. a board game marathon) is likely best suited with proportional ranking

Is the salient difference here that preferences can change over time? That the voters themselves change over time? Or is it that you can opt to take a break during the next board game if you don’t like it, but you can’t quite opt out of being a citizen (at least, not with as much ease). I’m really not sure here.

Dessert sushi

Now that I’ve discovered vegan marshmallows that melt properly, a small but crucial range of desserts have opened up to me. Smores, deluxe hot chocolate, crispy squares. In honour of this occasion, I present the following invention: dessert sushi.

Just make your rice crispy batch as per usual (I’ve opted for Special K as it was on sale and functionally equivalent), then treat it like sushi rice. I’ve opted for a peanut butter mix with a strawberry jam centre and a cocoa dusting nori in this example, but I believe the possibilities to be extensive.

Quickly voting using the Schulze Method

When you’re in a group trying to reach a collective decision by voting, chances are it sounds a little like this.

All those in favour of W?2.
All those in favour of X?7.
All those in favour of Y?5.
All those in favour of Z?6.
X has the most votes. X wins.

The problem here is that the majority might not want X, which only got 35% of the vote.

The Alternative

Next time, try the following. It takes a little longer, but the results will be much fairer.

W vs X.Who prefers W?13.Who prefers X?7.
W vs Y.Who prefers W?8.Who prefers Y?5.
W vs Z.Who prefers W?12.Who prefers Z?3.
W never loses a pairing. W wins.

Bam. Done.

As an aside, you could also infer this information from a set of collected ballots.


The Edge Cases

Disclaimer: Edge cases are exceedingly rare in large elections. What follows is simply for completeness.

In the case where two or more candidates never lose a pairing, that’s a tie. Randomly choose between these candidates.

In the case that all candidates lose a pairing, that’s a Condorcet paradox. The chances of this occurring are asymptotically rare as the number of voters increases, but here’s how to handle it if it comes up.

W vs X.Who prefers W?16.Who prefers X?14.
W vs Y.Who prefers W?17.Who prefers Y?13.
W vs Z.Who prefers W?12.Who prefers Z?18.
X vs Y.Who prefers X?19.Who prefers Y?11.
X vs Z.Who prefers X?9.Who prefers Z?21.
Y vs Z.Who prefers Y?20.Who prefers Z?10.
Each candidate loses a pairing. Let’s draw it out.

The first image shows the tallies. The second shows the cycles that prevented us from finding a simple winner. All subsequent steps are simply removing the weakest edge and any loose candidates.

For more information, see Wikipedia’s criteria analysis. To see it in action, try this mock election out.

Key tradeoffs

Having played around with the hammered duclimer more, I’m finding a few things about it. First, the one-to-one mapping isn’t really an issue. The strings are tuned in such a way as to make specific keys easy to play, albeit at the cost of making others more difficult.

D Major

F Minor

One significant limitation I’ve found myself run into is playing the odd note outside of the key, specifically within semitone scales. This short excerpt from Liquid Spear Waltz

demonstrates the issue. well enough. There’s no way I can move my hands fast enough for that. Practice, I suppose, but I don’t think it’s doable.

One-to-many mapping on the hammered dulcimer


Consider the opening phrase of Oh Susanna. Consider how you’d play this on your instrument of choice. When presented with a specific note, where on your instrument do you play it? The question doesn’t make sense for some instruments (e.g. the piano) as there’s only one way to produce each sound. On others (e.g. the guitar) it depends largely on where your hands are at the moment.

I’m having a difficult time applying that concept to the hammered dulcimer. Like the guitar, many notes can be played in different locations. However, some have only one string for their respective octaves. Take G# for example. That note has only one location for each of the three octaves, whereas an octave of A is represented three times.

So when learning a new piece of music, I’m left wondering where the best place to play it is. This one-to-many mapping across a wide space is inhibiting muscle memory. Grumble grumble.

Alternate BSG No Sympathizer Variant

Fantasy Flight Games provides a No Sympathizer Variant for Battlestar Galactica. Unfortunately, it takes away from one of the key elements: mystery. This was partially revised in the Pegasus expansion by giving the sympathetic Cylon an agenda that might be friendly or hostile. The downside to this revision is that the agenda cards all largely involve screwing the humans over.

We were discussing this today and propose the following alternate no sympathizer variant. Construct the first loyalty deck as per usual. For the second, forgo adding the sympathizer card. At the half-way point, build a third deck composed of three You are a Cylon cards and one You are not a Cylon card. For each resource is in the red, reduce the number of You are a Cylon by one. Randomly add one of these cards into the second loyalty deck before dealing it out.

This variant ensures that there’s an element of uncertainty in the later game; Not knowing if there are 2 or 3 Cylons keeps the suspicion fueled. Furthermore, the decision to intentionally drop one resource into the red is less clear-cut as it only marginally decreases the chances of a third Cylon (from 75% to 66%).

Paragon vs Renegade

Take a few minutes and watch Extra Credits’ discussion on the morality system embedded into Mass Effect 2.

One of the points raised is that assigning an arbitrary “paragon” or “renegade” label to a moral dilemma cheapens the introspection that it otherwise carries. Perhaps we could expand the one-dimensional character barometer such that there’s no clear good and evil, just as pen and paper RPGs have been doing for decades with alignment.

Instead of paragon and renegade, we could have three new meters: Individualist vs Collectivist, Violent vs Peaceful, Chaotic vs Orderly. I don’t mean for these to be the best options, just to illustrate the idea of opposing viewpoints. I’m not even sure what meter one would use to cover the example given in the above video; How does one enumerate the preference for genocide over the elimination of free will? Would that count as +1 to individualist, +1 to violent and no change to chaos/order? It might not be possible to categorize solutions to moral dilemmas (a la Donnie Darko’s lifeline exercise).

At the end of the day, the designers for Mass Effect might have opted for the simplicity of a single meter as an explicit design choice; Littering a screen with 20 character dimensions would be overkill. Still, 2 or 3 might do just fine and provide a little more depth to character choices and consequences.

PHP’s array_walk_recursive

The description says “If funcname needs to be working with the actual values of the array, specify the first parameter of funcname as a reference.” This isn’t necessarily helpful as the function you’re calling might be built in (e.g. trim or strip_tags). One option would be to create a version of these like so.


function trim_by_reference(&$string) {
    $string = trim($string);
}

The downside to this approach is that you need to create a wrapper function for each function you might want to call. Instead, we can use PHP 5.3′s inline function syntax to create a new version of array_walk_recursive.


/**
 * This function acts exactly like array_walk_recursive, except
 * that it pretends that the function its calling replaces the
 * value with its result.
 *
 * @param $array The first value of the array will be passed
 *               into $function as the primary argument
 * @param $function The function to be called on each element
 *               in the array, recursively
 * @param $parameters An optional array of the additional
 *                parameters to be appeneded to the function
 *
 * Example to alter $array to get a short slice of each value
 *    array_walk_recursive_by_reference(
 *        $array, "substr", array("1","3")
 *    );
 */
function array_walk_recursive_by_reference(
        &$array, $function, $parameters = array()) {
    $reference_function = function(&$value, $key, $data) {
        $parameters = array_merge(array($value), $data[1]);
        $value = call_user_func_array($data[0], $parameters);
    };
    array_walk_recursive(
        $array,
        $reference_function,
        array($function, $parameters)
    );
}

The advantage here is that we only explicitly define one wrapper function instead of potentially dozens.

Portable cheesecake

Following up on the pie in a jar notion, I’ve extended the same idea to cheesecakes. The following recipe is from La Dolce Vegan with minor modifications for convenience.

Filling

  • 300g silken tofu
  • 2 cups tofutti “cream cheese”
  • ¾ cup sugar
  • 1 tbsp vanilla extract (I also added one vanilla bean)
  • 1 tbsp lemon juice (I think I put in 1½)
  • 1 tsp lemon rind, finely grated
  • ½ tsp salt
  • ¼ cup flour

Glaze

  • 1 cup jam
  • 1 tbsp corn starch
  • ¼ cup water

Method

  1. Using a premade graham cracker crust (much faster), ground it up and split it between 8 jars.
  2. Blend the filling in a food processor (wets first, drys second) and pour into the jars on top of the crust.
  3. Cover and leave overnight in the fridge.
  4. The next day, bring the glaze to a boil and simmer for 5 minutes, stirring constantly (make sure to mix the water and cornstarch first to avoid clumps).
  5. Split the glaze between the 8 jars and refrigerate again for an hour.