Tuesday, April 28, 2009

Hypercapitalism

'Hypercapitalism' is so poorly defined that the first google search result isn't a wikipedia page. That's sad, so I'm going to put a solid word out there.

My new definition: The idea that the purpose of capitalism is to supply goods and services to the net benefit of society, and that business is a vehicle to apportion those goods fairly. (See also: corporate responsibility, conscious capitalism)

Dio Games, an indie software venture operating out of Romania, has a very novel game called Orbital Trader that has an excellent and intentional bent towards the hypercapitalistic. You see, in the present, one amasses great wealth by supplying goods and services. In the future, it's really much more profitable to do that in a way that helps people. Commerce is no longer a chimera that beats people into the ground; nor does a ruling class decide how to wreck things for society. No, now the economy and all the players in it are scrambling to fill needs, invest in the greater good, and be proper stewards of the markets they're in.

Give it a try, it's a really cool game.

Labels: ,

Tuesday, April 7, 2009

More Puzzling SQL

Cool:

Juozas solves sudokus in a readble mysql query.

Labels: ,

Saturday, April 4, 2009

One tough puzzle

And for a mental break after a few weeks of living swamped-in-code, here's One Tough Puzzle.

I spent four long, happy years writing programs to solve puzzles - in Java and PROLOG - for my AI Bachelor's, and the last several solving problems that are harder and more useful to solve - in php and SQL. So it's come to this, I'm using today's tools to solve yesterday's non-problems.

Here's a hard-coded SQL script to solve this puzzle. It's not terrifically extensible beyond 9 glossy pieces, but it is proof that SQL can do it given the chance.

CREATE TABLE tiles (id serial, one text, two text, three text, four text);

INSERT INTO tiles (one, two, three, four) VALUES

('s','s','h','c'),
('h','d','d','h'),
('s','d','h','d'),
('s','d','s','h'),
('c','h','d','c'),
('h','d','c','c'),
('h','s','s','c'),
('d','c','c','d'),
('c','h','s','h');

SELECT mi.id as middle,
e1.id as cw1,
d1.id as cw2,
e2.id as cw3,
d2.id as cw4,
e3.id as cw5,
d3.id as cw6,
e4.id as cw7,
d4.id as cw8

FROM tiles AS mi

JOIN tiles AS e1 ON e1.id not in (mi.id) AND ((mi.one = e1.three) OR (mi.one = e1.four))
JOIN tiles AS e2 ON e2.id not in (mi.id, e1.id) AND ((mi.two = e2.three) OR (mi.two = e2.four))
JOIN tiles AS e3 ON e3.id not in (mi.id, e1.id, e2.id) AND ((mi.three = e3.one) OR (mi.three = e3.two))
JOIN tiles AS e4 ON e4.id not in (mi.id, e1.id, e2.id, e3.id) AND ((mi.four = e4.one) OR (mi.four = e4.two))

JOIN tiles AS d1 ON d1.id not in (mi.id, e1.id, e2.id, e3.id, e4.id) AND
(((e1.three = d1.one) AND (d1.four = e2.one)) OR
((e1.three = d1.two) AND (d1.one = e2.four)) OR
((e1.two = d1.three) AND (d1.two = e2.four)) OR
((e1.two = d1.four) AND (d1.three = e2.one)))

JOIN tiles AS d2 ON d2.id not in (mi.id, e1.id, e2.id, e3.id, e4.id, d1.id) AND
(((e2.three = d2.one) AND (d2.four = e3.two)) OR
((e2.three = d2.two) AND (d2.one = e3.three)) OR
((e2.two = d2.three) AND (d2.two = e3.three)) OR
((e2.two = d2.four) AND (d2.three = e3.two)))

JOIN tiles AS d3 ON d3.id not in (mi.id, e1.id, e2.id, e3.id, e4.id, d1.id, d2.id) AND
(((e3.four = d3.one) AND (d3.four = e4.two)) OR
((e3.four = d3.two) AND (d3.one = e4.three)) OR
((e3.one = d3.three) AND (d3.two = e4.three)) OR
((e3.one = d3.four) AND (d3.three = e4.two)))

JOIN tiles AS d4 ON d4.id not in (mi.id, e1.id, e2.id, e3.id, e4.id, d1.id, d2.id, d3.id) AND
(((e4.four = d4.one) AND (d4.four = e1.one)) OR
((e4.four = d4.two) AND (d4.one = e1.four)) OR
((e4.one = d4.three) AND (d4.two = e1.four)) OR
((e4.one = d4.four) AND (d4.three = e1.one)))

ORDER BY middle DESC;

Labels: ,

Wednesday, April 1, 2009

Echo Chambers

In keeping with his long tradition of thoughtfully incendiary blogging, Jeff Atwood of Coding Horror posted on the necessity/efficiency of English as a lingua franca for software developers.

Advocating the adoption of English as the de-facto standard language of software development is simple pragmatism, the most virtuous of all hacker traits. If that makes me an ugly American programmer, so be it.


So it goes, and it was, I'm sure, a reminder to native English speakers that they are fortunate to not have to learn another language in order to communicate with other software developers around the world. As you would expect if you were a frequent Coding Horror reader, the comments were full of offended and well-meaning developers who were angry at connotations of cultural imperialism. While communication would be streamlined if everyone spoke a common language, it would certainly be a shame to lose the world's other languages.

When the story was posted to Slashdot - presumably a more rational and international community, the comments seemed to me to revolve more around a discussion of the use of English as a necessary common medium for code, comments, and technical documentation. There were vivid handfuls of stories from non-native English speakers on how they learned English - whether from Sesame Street, the Internet, or grade school. Snarky debates about the linguistic heritage of English, the relative usability of it, and so on. Fine points and spirited back and forth. All in all, nearly the opposite of the posts on Jeff's blog. In all, the Slashdot echo chamber has a different shape that at this point reverberated with sounds of logical discussion. Particularly interesting to me was this post:

However, the main reason why finns speak pretty decent english is our school system. Studying english is mandatory from grades 3 to 9 in the elementary school and any route you continue from there also requires you to study english. We believe that in the modern world it is just a basic requirement for everyone to understand the same language.


I agree, a common language is necessary. Already the ability to speak the de facto language of the internet is a huge asset, for the individual and for all of us. More intriguingly, why the huge difference? The medium is similar.

Labels: , ,