A solution to a fabled problem

We’ve all heard the story in school — when chess was invented in India the local King (they had lots of kings back then apparently) was so impressed by the game that he offered its creator whatever he wanted. The man (who was rumored to be wise but somewhat of a smart-ass) responded that all he wanted were a few grains of rice. The number of grains was to be determined as follows: using a chessboard, place 1 grain on the first square, two on the second, four on the third, 8 on the fourth, etc. To which the King immediately assented, until one of his ministers told him that not only was this more than he had to give, but was in fact more grain that was produced by the entire known world at the time.

So, being somewhat of a smart-ass myself and being in the middle of learning the python programming language I figured I’d come up with a neat and efficient way to calculate exactly what that number was. It’s not that difficult. Basically because the chessboard has 64 squares, the number you’re looking for is the sum of the solutions for 20 through 263.

Since Python is loosely-typed you don’t have to worry about declaring the right type of integer to hold the final result, which is astronomically big. Here’s the code for it:

numTotal = 0;
for numExponent in range (0,64):
    numTotal += 2**numExponent
    print "Total at", numExponent, ": ",numTotal
print "All done."

Note: even though I declared the range 0 to 64, 64 is not itself included.

So what’s the final result? It’s 18446744073709551615. 18 quintillion, 445 quadrillion, 744 trillion, 73 billion, 709 million, 551 thousand and 615. Quite a large number indeed and assuredly more than the King could deliver.

Sweetening the pot

Disappointingly I still have no takers for my offer to take over property owned by people who genuinely think that the world will end on Saturday, so let me sweeten the pot a little bit on this — I will give you $20 right now if you will turn your property over to me Saturday at 11:59 pm (EDT). This is a very good deal, because if you truly think that, according to the Bible, the world will end Saturday you will still get the $20 and I will get nothing. So you should all think about it, doomsday people! if, of course, your faith is strong and unwavering. On the other hand, you want to “play it safe” and hold on to your stuff “just in case”, then you really have no faith, have you?

More thoughts on Portal 2

Okay, so this is a post about Portal 2, but you’ll probably not want to read it unless you’ve already played through the game because it is literally full of spoilers right from the beginning. So I’m going to make some white space now in case you’ve stumbled on this article by accident and don’t want the game spoilt for you, although when you think about it you really should have taken the hint from the first sentence of this post…

 

 

 

 

 

 

 

 

 

 

 

 

 

What happens in Portal 2 is that a time warp takes place. And it doesn’t take place before Chell gets woken up in The Courtesy Call, it takes place when Wheatley is in charge.

The biggest hint in the game is an obscure achievement called “Ship Overboard”, which is a kind of companion to the “Door Prize” achievement. In Ship Overboard you stumble on a dry dock which is rather oddly located in a salt mine, with a rescue buoy from the ship BOREALIS. This is a reference to Half-Life episode 2 where the Borealis, which bears an Aperture Science banner, and her dry dock go missing. But this is the HL2 timeline, and that takes place some time in the future. So why does the dry dock turn up in the Aperture experiments facility that was built in the 1970s?..

There’s an even better question, though. How did it come to pass that Aperture had scientific testing facilities as far back as the 1950s? If you look at the “official” Aperture Science wiki it states that AS was just a shower curtain company from its foundation in 1953 to Cave Johnson’s death in 1976 (that’s also problematic if you’ve played through the game, but bear with me) and only gets into science at all in the 1980s. Yet in the 1950s test chambers there’s a trophy room touting science awards that Aperture Science Innovators (as they were known then) has won in the 40s and 50s. So clearly something has changed there.

This is also obvious when you consider that in the beginning of the game, through the ruined test chambers, you never see anything about the repulsion, propulsion and portal gels, but they’re a big part of the ending of the game which takes place in the same day as the beginning of the game.

It also goes some ways towards explaining exactly why someone would build a science facility in a closed salt mine in the first place. After you reach the bottom of the mine you have to wonder why and especially how such gargantuan and technically complicated buildings could possibly be built 3 miles underground. Not to mention how a shower curtain company manages to attract test subjects who are also astronauts, war heroes and olympians.

Another hint comes very early in the 1950s testing phase of the game, where you’re informed that you need the portal device in order to complete the test. This was supposedly not invented until the 1980s! And the propulsion and repulsion gels were not invented until the late 1990s, but they show up in the 1950s and 1970s test chambers! And the 1950s chambers were condemned (“vitrified”) back in 1961 (read the signs, folks!). Also the reason stated for the vitrifying of the facilities is cosmic ray contamination, which seems unlikely in a facility that’s 3 miles underground. Unless of course there is some sort of a portal device involved…

There’s clearly a time warp that occurs somewhere and changes the in-game reality. It’s not just the gel or the portal technology, but the “current” Aperture Science facility also becomes hugely more vast than was hinted at in the first Portal game. By orders of magnitude.

As for Cave Johnson, in the first Portal timeline (from the wiki posted above) he dies in 1976 of mercury poisoning, but now he’s made prerecorded messages for chambers that were only built in the 1980s.

One may well then ask, “if Aperture Science had all this technology in the 40s or 50s why didn’t they deploy it all then?” Indeed the gameplay is structured so that the 1950s introduce the repulsion gel, the 70s introduce the propulsion gel, and the portal-surface-making gel shows up in the 80s. Some of that new technology was obviously released then, that’s how ASI was able to fund their fantastically immense facilities, but you have to keep in mind that ASI is not a very good science company — they build giant spheres of asbestos to conduct tests in, test products without knowing what elements they contain (“it’s a lively one and it does not like the human skeleton”) and “throw science at a wall to see what sticks”.  It took them some time to figure out how to replicate the propulsion gel, and their early experiments in gathering moon rocks — a necessary ingredient for the portal-surface-making gel — led to the cosmic ray contamination that caused the shutdown of their 50s facility. They only managed it in the early 80s, with bad consequences for Cave Johnson and his “why not” approach to scientific experimentation.

So, for those of us who think that the Portal 2 game was rather short, this seems to offer the answer that the game is, in fact, not over and that there is more to come. There might be more use for a stalemate associate yet. The game is such a mindfuck it’s brilliant.

Interesting times

2011 has so far been a rife year for change — if anything that’s quite the understatement. So far this year two long-standing regimes have fallen in North Africa, and this seems to be fanning local flames of discontent over large parts of the middle east and northern Africa.

It’s enough to drive some people mad with fear about some kind of greater Islamic Caliphate. American entertainer (and nothing else) Glenn Beck has made it the cornerstone of his show, which has recently become a sort of festival of ranting paranoia that’s led many to question whether Beck is still sane at all — although his general message differs little from what’s coming from the American right wing (i.e. Fox News) generally. Fox News doesn’t care for brown people, that’s hardly news to anyone.

That’s one way to see things. It’s also the wrong way to see things. When you look at these uprisings more closely you find that in each country in which protests have occurred so far, the causes for the protests are pretty much purely local to the place in which they are happening, and that beyond the demands for change there is little in common between them. To claim otherwise is either foolish or dishonest.

This is not to say that each national protest occurs in a vacuum, of course. Tunisia, as the first country to revolt, has undeniably inspired protesters in the other locales by showing them the power behind non-violent resistance. When President Ben Ali resigned he had been in power for 24 years and had built a strongly repressive regime that for most of the protesters had existed for as long as they were alive. That this regime could be toppled with relatively little bloodshed has without a doubt bolstered the spirits of protesters across the region and made them realize that no matter how long a regime has been in charge of their country, it’s just not going to last forever. In fact as soon as Ben Ali’s resignation was announced I had a strong feeling that Egypt would be next to see protests.

Tunisia’s revolt came as a result of two factors: resentment against Ben Ali and his internal security forces, but especially changing government policies that caused the price of food to skyrocket in a very short timeframe. Additionally young Tunisians are a well-educated middle-class people, so long-term unemployment for many of them — it is said to have been running around 15% — was the spark by which the revolution started.

The situation was very different in Egypt, which did not see an economic downturn or sharp price reforms like Tunisia. Rather in this case the impetus was provided by simmering resentment over Hosni Mubarak’s (almost) 30-year rule of the country, particularly the complete lack of political reforms and the authorities’ reliance on brutal gangs of thugs to “maintain order” whenever there were political protests. I’m actually struck at how similar Mubarak’s Egypt was to the Iranian Mullahs regime in that respect — whether you call them “Egyptian secret security forces” or “basiji”, in both cases a brutal repressive regime used uneducated, unemployed people from the country in order to crack heads in the cities whenever the regime feels a threat. But Mubarak was not able to make much of a difference through his thugs, and it’s since transpired that he had initially ordered the army to have a Tiananmen-square style crackdown on Tahrir square and even wanted armoured batallions to just run over the protesters and retake the square by force. Fortunately the army point-blank refused to listen, and from that point on the dictator was finished.

This was just the beginning. Protests have broken out since in Bahrain against the Khalifa family, who control all aspects of political life in the tiny island nation; the biggest grievance there is that there is (apparently) widespread discrimination against the majority Shiite population by the Sunni Khalifas, as well as the (sadly usual) accusations of corruption. One especially salient point made by the protesters is that the police force of Bahrain is being supplemented with Sunni foreigners who are fast-tracked for Bahraini citizenship even if some of them do not even speak Arabic (the local language). The protests there, ongoing as we speak, materialized very quickly; they are not as big as in Egypt, but then Bahrain is a lot smaller and less populated. As an additional factor the protesters are vowing to cause disruptions during the Grand Prix of Bahrain, a Formula One race scheduled to take place in Sakhir on March 14th. Americans will also be particularly interested in the situation there as Bahrain is the home of the US Fifth Fleet.

Protests have also flared up in Iran, in a sort of “round 2” to the green protests which took place last year. There is also some unrest occurring in Algeria, Lybia, Jordan, Syria, and Yemen. In each case the protests have a distinctly nationalist nature and belie the very idea of some sort of pan-muslim uprising.

Personally it’s always been my position that repressive regimes tend to foster and stoke the flames of extremism. It’s not surprising that the bulk of the terrorists involved in the 9/11 operation generally came from places where dissent is not tolerated and political freedoms are few (ya, Saudi Arabia, I am looking at you). In that sense I can’t help but see the toppling of dictatorial regimes by democratic forces to be a fundamentally good thing and conducive to long-term stability in the region.

In that the US find themselves squarely on the wrong side of history by their long-standing habit of backing dictators who could either a)give them what they want in terms of oil and soil to build military bases on, or b)be a hired friend of Israel. Those two factors are still the cornerstone of American policy in the region, so America is clearly on the back foot and really can’t get involved much. Obama pretty much took the best line he could in Egypt, everything considered, but the point has been driven home that these uprisings are not about America or (at least so far) Israel, they are the shouts of peoples who have had enough from local despots.

Interestingly enough these local despots seem so far to have quite a bit in common. The fallen ones are both older (75 for Ben Ali and 80 for Mubarak), largely secular autocrats who have been in power for decades and seem to share a taste for black hair dye. Even in the countries which are currently experiencing protests the trend seems to be largely borne out, with exceptions of course — Syria’s Bashar al-Assad is still a youngster at 45, but Khalifa (Bahrain) is 60, Gadaffi is 68 and in power for 41 years, Saleh of Yemen is 64 and Bouteflika (Algeria) is 73.

What we’ve seen so far is only the beginning.

If you’re as interested in these things as I am, I recommend watching Al-Jazeera, either through their web site (http://english.aljazeera.net) or via the Livestation desktop application (http://livestation.com). AJ is the authoritative television station in the area and their coverage blows away all competition.

Micro-USB is the new, er, USB

Consider me somewhat of a gadget-trend barometer if you will, but I couldn’t help but notice that the last several gadgets I’ve purchased use a micro-USB connector for data exchange and battery recharge. Those gadgets have included the following:

  • Archos 5 internet tablet (when it came out people thought it used a proprietary connector)
  • B&N Nook
  • Google Nexus One smart phone
  • Amazon Kindle 3
  • Motorola Rokr S305 Bluetooth headphones

Obviously this isn’t the totality of gadgets, but there’s clearly a trend there. In fact I’d say that within a year the only USB devices to use a Mini-USB connector will be knockoffs.

Part thriller and part environmental snuff flick

If you want to see what millions of gallons of crude look like as they pour into the ocean, as well as what people with robots are trying to do about it, check out the live ROV monitoring of the damaged riser that is causing the leak of oil into the Gulf of Mexico. Hosted by BP and featuring robots.

Fact checking… Investors’ Business Daily has heard of it.

In a spectacular outbreak of foot-in-mouth disease the right-wing newspaper Investors’ Business Daily avers that “People such as scientist Stephen Hawking wouldn’t have a chance in the U.K., where the National Health Service would say the life of this brilliant man, because of his physical handicaps, is essentially worthless.” Without realizing of course that Hawking IS in fact British and that the NHS didn’t just leave him on a mountaintop to be pecked clean by the crows, something which any American health insurance company would no doubt have done decades ago. This, I’m afraid, is typical of the level of debate in the United States about health care reform.

Note: I’m quite sure that the original article will be removed as soon as it starts getting a lot of traffic, so if you can’t find the quote I highlighted have a look at the article as it originally appeared (local cache).