Space Frack!

April 29, 2014

Here’s a game I put together over the weekend for Ludum Dare 29. The theme for this weekend was “Beneath the Surface” and the idea was to make an outer space fracking game. 

You are controlling the latest in space fracking technology, a little rover with the task of retrieving space resources from a moon or asteroid or whatever. Use your shockwave (spacebar) to frack open the resources, and then drill (shift) to extract the resources for processing. But watch out for enemy rovers sent by rival corporations!

The enemy rovers are a less sophisticated model without cutting-edge fracking technology, but they have been extracting all the available resources for a while and will not hesitate to hit you with a shotgun blast and steal all your newly fracked resources. Avoid them carefully, or use your shockwave to blast them out of the way!

Watch out for the space fracking protesters, too. You don’t want to cause a PR disaster by accidentally running one of them over!

Play the current build here: http://guscost.github.io/

Vote for Space Frack: http://www.ludumdare.com/compo/ludum-dare-29/?action=preview&uid=31734

Translation

January 18, 2014

Words are funny things. I think they function as little encodings of shared cultural experience, as I’m sure I’ve said before. This means that weird stuff happens when we try to translate certain words from one culture to another. In American English land we might enjoy total dominance of teh interwebs, but that doesn’t mean that other cultures haven’t embraced ideas which are much harder for us to understand.

As an example consider the German word “schadenfreude.” Transliterated it could be written as “harm joy” or “misfortune joy” or something like that. However for english speakers that doesn’t adequately convey its meaning. Does it describe some kind of catharsis might accompany bad luck? In fact it does not. Rather it describes the enjoyment one might derive from witnessing another’s misfortune.

These words make interesting case studies especially when studying translation as a discipline. Germans might have adopted this phrase-word-whatever as a witty way to describe something that actually happens rather often, but it takes many more English words to describe the same phenomenon, because we haven’t absorbed the idea to the same extent. Interestingly, I would say that this means most people are wrong when they say a certain word “has no English translation.” It almost always does, though that translation will invariably require many English words!

There is a Portuguese word “saudade” which describes a certain longing or melancholy or nostalgia, usually for something or someone from the past, but also towards the transcendant and abstract. This word has no English equivalent, but the extended definition could be substituted in many cases. This awkwardness results in the phenomenon where meaning is “lost in translation” and it leads to the idea that certain translated works are never as good as the originals.

However we can also just steal these words from their respective languages and use them to denote the foreign concepts in our own language! The Oxford English Dictionary includes both “schadenfreude” and “saudade” and these days they are often used as valid English words in the appropriate context. This is one way that a language evolves to describe new concepts, and it means that there are no words which will never be “said” in some language. What is missing is often any mainstream understanding of the true definition, and the shared cultural experience which it conveys.

I don’t really have a simple point to make here, but the idea that any given language is “missing” certain words is very interesting. If you’d like to broaden your vocabulary in your native language, look to these interesting ideas from other cultures, and find some cool new words to steal!

Bitcoins, Cash and Gold

December 15, 2013

There’s a lot of buzz about Bitcoin and its significance lately. At the time of writing the MtGox price per is around $900 after briefly going above $1000 last month. I’m no economist (or investor – I sold most of mine way too early!) but it seems like the issue here has to do with relative demand for different financial instruments, specifically stores of value and mediums of exchange.

What is called a “store of value” I would describe as a kind of hedge, a financial instrument used to offset the risk associated with some investment. In this sense stores of value are hedges against losses on investment of time spent building wealth. The investor uses them to handle the risk of that wealth losing purchasing power, due to inflation or sociopolitics or whatever. The most famous store of value in history is elemental gold, which is scarce, shiny and useful (and therefore valuable) because of geology and physics and chemistry. This means that no human institution is required for gold to be in demand, and so nations still stockpile massive amounts in places like Fort Knox as a hedge against market disruption. Some citizens have been converting their own wealth into gold, especially since the value of dollars was decoupled from the stockpile in Fort Knox.

More recently, US dollars have served reasonably well as a hedge against instability elsewhere in the world. During the depression in the 1930s, people who trusted banks to store their wealth ended up regretting that decision, and those who kept cash in mattresses and walls made out comparatively well. Since then a culture of stockpiling cash has arisen, and historically the US dollar has been the favorite for its perceived stability. While this store of value provides a great deal of liquidity and quite reasonable portability, it can only be as reliable as the institution of the United States, and because the FDIC guarantees bank deposits there is not much reason to trust paper dollars as a better store of value than a standard US bank account.

Perhaps for this reason, Bitcoin has grown from a cryptography experiment into the hot new digital alternative to gold. Like gold it relies on mathematics and computer science rather than the authority of a government, but unlike gold it requires the existence of an information network like the Internet, and leverages that technology to enable much higher liquidity. In the long-term view it seems to function as a hedge against the marginalization of existing institutions and material goods caused by Internet and new technology.

I’m focusing on stores of value with medium to high liquidity, but there are certainly other options. Collectible goods like art and vintage instruments are popular, as is real estate. The value of these investments is necessarily non-zero (at the very least they can be used to build a fire) and determined by market demand. Still, no investment is risk-free and every one of these examples could lose value dramatically in the right situation. America recently went through a boom-bust cycle in real estate and many investors went bankrupt. Wealthy Chinese have been pouring their wealth into real estate for decades, the result being a market where not enough people can afford the hugely inflated housing prices and the bottom could fall out at any time. A non-trivial amount of that wealth is now moving into Bitcoin, which is probably the dominant cause of the recent spike.

In the case of cash, the primary risk is that the government will destabilize and/or the Fed will “ease” all the value out of those mattress dollars. As that risk was discovered commodities rose in value, most notably gold. It is still unclear exactly how much of the trend is due to devaluation of the currency and how much is due to speculation and fear.

In the case of gold, the practical applications might prove less useful than the price can justify, which would adversely affect its market value. In the extreme case, mass-produced alchemic gold could even end its reign as the definitive precious metal. That seems far-fetched right now, but I can’t honestly say it is entirely outside the realm of possibility. The technology to manufacture diamonds is orders of magnitude less sophisticated, but it did not exist a century ago.

In the case of Bitcoin, the most threatening eventuality is that the Internet goes dark and the blockchain ends. This might be even less likely, but many of the gold investors are also stockpiling guns and food so they are evidently thinking along those lines. If SHA-256 is broken the implications on digital security and the Bitcoin economy would be devastating as well. A less threatening situation might involve the lack of adoption by legitimate businesses and/or banning by governments. This would push the Bitcoin market further into illegal territory, but where there is money there will be money laundering so it wouldn’t necessarily shut down the market.

In summary, the best way to store value is never known and can only be determined in retrospect. It might involve more than one method, since bitcoins can function as a traditional hedge for dollars and vice-versa. Personally, most of my (modest) capital is stored in manufactured goods, with a bit of old-fashioned mutual funds and a tiny slice of other investments. If I sold these assets tomorrow they would raise much less value than the equivalent amount invested into gold bullion (or bitcoins), but I hope that won’t be necessary. Not having to provide for a family at the moment is convenient.

However, by far the most valuable things I have acquired are my skills. It seems like a decent market position to be in these days, but of course there is still the risk of being paralyzed in a car crash. I recently bought a new set of tires to mitigate the risk, so we’ll see how that works out.

BTC donations: 1LF6NC8wC8s3E77QSFqCJY3BMhSVuH4JEV

National Debt

October 16, 2013

If you’re listening to the news lately, you could be forgiven for thinking that America “needs” to extend its line of credit by raising the debt ceiling again. This is an absolute mockery of economic planning. Does anyone still think it will actually improve our situation?

The most astonishing part is the fact that pundits are talking about raising the debt ceiling in units of time! It used to be described as an increase of however many billions of dollars. This latest plan will raise the ceiling until “February” or thereabouts, whatever that is supposed to mean. Do you realize the dollar figure isn’t mentioned anymore because it has become so embarrassing that people don’t want to acknowledge it?

I can’t get over how ridiculous the whole thing has become. It’s like if a drug addict was asking me to borrow money and saying, “With this I should be good until Tuesday.” How can a person not conclude that they will in fact be wasting it on more drugs? Yet we keep handing over cash for the next fix like a bunch of ashamed tourists.

Unfortunately, the only rational thing to do is to go cold turkey as soon as possible. Banks are now basically being paid to sit on over $1.8 trillion in “excess reserves” provided by our national borrowing binge. However many more fixes these junkies can score, when equilibrium is finally restored the withdrawal is going to be pretty intense.

What a stupid, pointless debate.

UPDATE: It turns out that the “February” language is not just a media euphemism, it’s actually the letter of the law! America has effectively deemed itself worthy of unlimited credit until the provision expires early next year.

Hardware Hacking

August 19, 2013

One of the nicest things about living in 2013 is the fact that computer hardware is cheap. Cheap enough that buying an extra computer to sit next to your TV or toaster or up in a weather balloon isn’t much of an expense to the average consumer. The Raspberry Pi is among the most popular and dramatic examples of this revolution, but compelling alternatives like the Beaglebone Black have been arriving on the market recently.

I’m interested in these little gadgets because they make electrical engineering and embedded systems a lot of fun. The possibilities are mind-boggling with the available cheap hardware, and working on random electronics projects is teaching me more about electricity than school ever did. Current is just like the amount of water flowing through a pipe, and voltage is like the pressure difference between two sections! Resistance is the diameter of the pipe or something like that. I never liked all the confusing homework problems with those abstract circuit diagrams because it seemed arbitrarily complicated. Now I’m actually learning how to read and write the language because knowing circuit design is necessary in order to build things.

A major in electrical engineering would probably involve quite a lot of lab work, but the mandatory textbook material makes it less accessible than it could otherwise be. I don’t mean to say that there is no use for a rigorous course of education – it obviously minimizes the inevitable gaps in domain knowledge. Still, unless you’re intending to find a salaried job in the field, it’s a lot cheaper and a lot more fun to just order a good soldering iron and pick something to build.

Bar Trivia

July 21, 2013

Trivia night is all the rage at local bars, and I’ve been enjoying the challenge. It’s about as much fun as people who are old enough to drink legally but are not working on a postgraduate degree until their eyes bleed can have on a weeknight. Plus, it’s a chance to win free beer, and therefore not end up spending disposable income on alcohol! Perhaps not a great chance, but a chance nevertheless.

This framing device isn’t arbitrary – the bar trivia fad is a great example of the things that people of my generation are doing with their college knowledge. Our great-grandparents designed bridges, uncovered the secrets of atomic physics, and argued for a universal declaration of human rights. We can write down Avogadro’s number and come up with vulgar team names to offend any sensibility.

Ha ha! Of course I’m exaggerating. Everyone knows that only the better aspects of popular culture are remembered. Fans of Classic Rock don’t talk about all the rest of the crap that Yes and Rush recorded. Still, it’s kind of funny that a bachelor’s degree in the humanities used to mean a real opportunity to find a good job and earn a good salary. These days, if you pay attention in class, you might win a free pitcher of ale.

NSA Snoops

June 27, 2013

This whole NSA melodrama is rather interesting. Once again a disgruntled government employee has leaked juicy top secret documents, and the fallout has divided politicians roughly along that quirky libertarian/authoritarian axis. Meanwhile, the public is freaking out because privacy online is an illusion, and Big Brother has been watching all along. George Orwell was right! We didn’t listen!

Along with several other people, I’m not exactly surprised by this revelation. What does the NSA even do if not this? How else does a company like Palantir make money? Are people actually surprised that planning crimes on Facebook is not a solid business plan?

Less obviously, why would anyone expect an ad-supported media company to stand up for privacy rights or whatever the libertarians want? People are acting like this is the cyberspace equivalent of strong-arming banks in order to search everyone’s safety deposit boxes. I’d suggest that it’s closer to reading people’s mail and rooting through their garbage. If someone invented a cheap stealth robot to do exactly that, do you really think the NSA wouldn’t be their top customer?

Signals intelligence is a sketchy business, whether or not you agree with the tactics. Most contractors who are not fleeing the country probably figured that out a long time ago.

Thrift Shops

June 15, 2013

Secondhand markets combine several great aspects of capitalism. Unlike much of that feel-good environmentalist nonsense, reusing manufactured products actually saves energy. Plus the revenue goes to enterprising resellers and charitable causes.

The problem is that this trend has turned into a mainstream fashion movement, which I suppose must please some people to no end. How could it be a problem? Well, the secondhand market obeys the laws of supply and demand just like any other market, so with increased demand either the price of goods will go up or the supply will dwindle. If you’re shopping for exclusive secondhand deals to stick it to corporations and show solidarity with the lower classes, somehow I can see that plan backfiring.

It’s fair to argue that if the secondhand store is run by a charity, increased business will divert more capital to a worthy cause. However, direct charity is not the only service that these organizations provide. And buying unnecessary new clothes does nothing for society beyond indulging our need to stand out or fit in, no matter where the transaction happens. Still, that is not necessarily a bad thing.

Look, if you’re all about the whole anti-consumerist underpaid Starbucks employee thing, there’s nothing wrong with getting a good deal on clothes. But taking your parents’ money to Goodwill so that you can buy beer and cigarettes with the change is a whole different story. If you’re not even going to donate some overpriced khakis or whatever, you’re actually making life that much harder for many of the unglamorous poor.

I’m getting awfully tired of products dubiously marketed as pre-packaged ethics, but that’s a topic for another time.

Fractals

May 24, 2013

Last time we plotted a Mandelbrot set using a small Python script. This set is interesting because an unexpectedly large amount of detail emerges from the iteration of a relatively simple function. Even more interesting is the fact that this detail is not limited to any particular resolution. The Mandelbrot set exhibits fractal geometry, meaning that tiny areas of the set share features with the whole thing. If we zoom in, smaller details are visible no matter how far we choose to zoom.

But you don’t have to believe me – let’s modify our Python script and see what happens. Basically we have to map 600 pixels in each direction to arbitrary sections of the real and imaginary axes. We can have our script read in the desired ranges and calculate appropriate mappings. First, store the inputs in decimal variables:

def get_decimal(m):
    while True:
        try:
            x = float(input(m))
            return x
        except ValueError:
            print('Enter a decimal number.')

loX = get_decimal('Minimum X: ')
hiX = get_decimal('Maximum X: ')
loY = get_decimal('Minimum Y: ')
hiY = get_decimal('Maximum Y: ')

Divide 600 by the range in each direction to compute scale coefficients:

scaleX = 600.0/(hiX - loX)
scaleY = 600.0/(hiY - loY)

Now modify the drawing code to use our designated ranges:

for x in range(0,600):
    real = loX + x / scaleX
    for y in range(0, 600):
        imag = loY + y / scaleY
    c = complex(real, imag)
    p = mandel(c)
    w.create_line(x, 600-y, x+1, 601-y, fill=colors[p])
    w.pack()

With these changes we can zoom in and see some interesting features. Try using -0.15, -0.05, 0.9, and 1.0 as input values. More detail is visible, but it looks like some of the boundaries are smoothing out! Interestingly, that’s because our mandel() function only checks whether each candidate c escapes within 20 iterations. Points close to the boundary often take more than 20 iterations to escape, but they don’t actually belong in the set. Therefore, as the zoom level increases we have to test each candidate c for more iterations in order to maintain an accurate image. This is left as an exercise for the reader.

The Mandelbrot Set

April 17, 2013

Last year we considered complex numbers, quantities with two degrees of freedom. These numbers have many important applications in engineering, but can we immediately use them to do something interesting?

Well, we can draw the Mandelbrot set with a computer and a bit of ingenuity. This set includes every complex number for which the following recurrence equation never produces a result with an absolute value (distance from the complex origin) greater than two:

mandelbrotequation

For any complex number, we start with z = 0, square it, add our complex candidate c, then repeat the process with z equal to the new (complex) value. As long as z stays close to the origin after many iterations, our candidate is probably in the Mandelbrot set. Since complex numbers behave like points in a 2D plane, we can draw an image where each pixel is colored by testing a candidate c related to its horizontal and vertical position.

So let’s make a drawing! This program is based on Prez Jordan’s Python code, but we’ll add a gradient to show how many iterations each candidate takes to escape. First we set up a 600×600 canvas with Tkinter:

from Tkinter import Tk, Canvas, mainloop

tk = Tk()
w = Canvas(tk, width=600, height=600)

Next we define our mandel() function which takes a complex number and tests whether it escapes in twenty iterations. If so the function returns the last iteration number, otherwise it returns 99:

def mandel(c):
    z = 0
    i = 0
    for h in range(0,20):
        z = z*z + c
        if abs(z) > 2:
            break
        else:
            i+=1
    if abs(z) >= 2:
        return i
    else:
        return 99

In order to draw a gradient, let’s use a dictionary to map iterations to colors. We’ll need entries for keys 0-20 and 99:

colors = {
    0: 'white',
    1: 'white',
    2: 'light yellow',
    3: 'light yellow',
    4: 'lemon chiffon',
    5: 'lemon chiffon',
    6: 'yellow',
    7: 'yellow',
    8: 'gold',
    9: 'gold',
    10: 'orange',
    11: 'orange',
    12: 'orange red',
    13: 'orange red',
    14: 'red',
    15: 'red',
    16: 'red',
    17: 'dark red',
    18: 'dark red',
    19: 'dark red',
    20: 'dark red',
    99: 'black'
}

Finally we loop over each pixel, convert its x and y coordinates to a complex number, test that number by passing it to the mandel() function, and use the returned key to look up the appropriate color in our dictionary:

print "Drawing..."

for x in range(0,600):
    real = x / 200.0 - 2.2
    for y in range(0, 600):
        imag = y / 200.0 - 1.5
        c = complex(real, imag)
        p = mandel(c)
        w.create_line(x, 600-y, x+1, 601-y, fill=colors[p])
        w.pack()

print "Complete!"
mainloop()

Run this code in your Python interpreter and see a picture of the Mandelbrot set!

Follow

Get every new post delivered to your Inbox.