Got a Wii (Review)

December 7th, 2006

EDIT: I’m updating my review. It was a little premature. I’m allowed to do that right? Here’s the better version, although in the end I say the same thing.

My Wii Friend Code is: 0098 9538 1192 6591. Add me and leave your friend code in the comments if you like.

I finally got ahold of a Wii, barely. I was #32 in line and they only had 32 consoles. Twilight Princess is beyond amazing. It’s purified classic Zelda in a fancy package. It’s perfect so far, and without overselling it, it’s already on of the better games I’ve ever played. I can’t really say if it’s any better on the Wii than on the Gamecube though, the pointer (for aiming) mostly annoys me so I turned it off. There’s a minigame in Zelda that convinced me the Wiimote is the real deal, you rotate the Wiimote to rotate a board in the game and it catches every subtle movement. That, along with fishing, probably makes it more worth it than the Gamecube version. Other things though, like swinging the sword, are basically like pushing buttons by swinging the Wiimote instead. Link doesn’t, for example, swing in the direction you did. The speaker on the Wiimote is only annoying so far, and doesn’t really add to the game.

Wii Sports is mostly interesting because the Wiimote’s interesting right now. It’s ultimately a few experimental minigames put together. Still, I’m becoming addicted to it anyway. One feature that I find interesting are the Miis. You can create a caricature of a person and play as them in Wii Sports (and other games). I found myself trying to make Miis of everyone I knew. When you connect your Wii to other Wiis you can see and share Miis.

There’s lots of missing features waiting to be updated. The News and Weather channels don’t work yet, and while the Weather channel should start working soon the News channel won’t for a while. I can’t download the Opera browser and it seems I’ll have to buy something to get it (although the browser itself is “free”). You can’t backup your Gamecube saves, although you can manage them on their memory cards. The Wii doesn’t come with S-Video cables (I thought it would), only composite cables. The “friend code” system is really annoying, it seems when you add a person to your address book they won’t even know – they have to add you too. Buying classic games online is mostly a scam, as you don’t own them like you own a cartridge, you merely license them and they’re locked to your Wii. Not to mention that you will probably be buying games you already own. It doesn’t play DVDs, or mp3s (except when in the photo viewer), or play videos (unless they’re Motion JPEG – which nobody uses).

As for the nifty things, you can send and receive emails using regular email or the Wiis. Since your Wii can stay partially active all the time your Wii will automatically download emails and alert you by pulsing the drive light. Gamecube games work perfectly with the Wii and offers a good replacement for it. The Wiimote can store Miis (and probably other data in the future) which can be brought to other Wiis.

I think, in the end, the Wii is worth it. There’s a lot of potential in this machine. Keep in mind though, you should consider not buying it unless you’re after a Wii game or two, I think it still needs more time to mature as a console. Most of my complaints are easily fixable and will be probably be fixed. In the end it’s a solid machine that will probably become what it should be – in the future.

Fast Array-Searching Algorithm

December 4th, 2006

A while back I tried to solve a simple problem, first pick a completely random integer, then what’s the fastest way to guess it? That is to say, using the fewest amount of chances. You only have one advantage, when you guess, you are told if the number you guessed is <= or > the number you a searching for.

The answer is pretty simple. Let’s say the number is 481, all you need to start with is a really big number that is greater than what you’re looking for, let’s say 1000. Cut it in half, is it still greater than the number? Yes, so now you know that the number is >= 0 and < 500. Cut it in half again, and you’ll find it’s <= the number you’re searching for. Now you know that the number is >= 250 and < 500. Continue with this like so…

250 >= x < 500
Guess: 325 (it's <=)
325 >= x < 500
Guess: 412 (it's <=)
412 >= x < 500
Guess: 456 (it's <=)
456 >= x < 500
Guess: 489 (it's >)
478 >= x < 489
Guess: 483 (it's >)
478 >= x < 483
Guess: 480 (it's <=)
480 >= x < 483
Guess: 481 (it's <=)
481 >= x < 483
Guess: 482 (it's >)
481 >= x < 482

At the end, you’ll notice there’s only one number that’s >= 481 and < 482, the number you’re looking for.

In case you didn’t notice several numbers above were rounded. This always bothered me as it seemed untrustworthy, inheriting possible problems from floating point number math. Then I realized this issue could be overstepped and made much faster through the use of binary math. With a binary math technique you’d only work with multiples of two, so there are never rounding issues. First you need to find the highest multiple of two that is above the number you are searching for, in this case, we’re trying to find 1683.

Guess: 00000000 00000001 (1) (true)
Guess: 00000000 00000010 (2) (true)
Guess: 00000000 00000100 (4) (true)
Guess: 00000000 00001000 (8) (true)
Guess: 00000000 00010000 (16) (true)
Guess: 00000000 00100000 (32) (true)
Guess: 00000000 01000000 (64) (true)
Guess: 00000000 10000000 (128) (true)
Guess: 00000001 00000000 (256) (true)
Guess: 00000010 00000000 (512) (true)
Guess: 00000100 00000000 (1024) (true)
Guess: 00001000 00000000 (2048) (false)
Answer: 2048

Now we know the first multiple of two that is higher than the number is 2048. Now finding the number between the current minimum/maximum is much simpler through the use of binary math.

00000100 00000000 => 1024 (start)
00000110 00000000 => (1024 | 512) == 1536 (true)
00000111 00000000 => (1536 | 256) == 1792 (false)
00000110 10000000 => (1536 | 128) == 1664 (true)
00000110 11000000 => (1664 | 64) == 1728 (false)
00000110 10100000 => (1664 | 32) == 1696 (false)
00000110 10010000 => (1664 | 16) == 1680 (true)
00000110 10011000 => (1680 | 8) == 1688 (false)
00000110 10010100 => (1680 | 4) == 1684 (false)
00000110 10010010 => (1680 | 2) == 1682 (true)
00000110 10010011 => (1682 | 1) == 1683 (true)
Answer: 1683

You’ll notice every time the result is true, the bit that is currently being tested stays in the result, otherwise it returns to zero.

Next is a simple example of how to use this technique. The goal of this code is to insert a number into an Array in numerical order. That is to say, each number in the Array should be greater than (or equal to) the numbers that precede it. Also keep in mind even if there is only one entry (length == 1) there are two possible places to put the new number, before and after the lone entry.

function addEntry(entry:Number):void {
var cBit:uint = 1;
while (cBit < arr.length) {
cBit <<= 1;
}
var pos:uint = 0;

do {
if ((pos | cBit) <= arr.length) {
if (entry >= arr[(pos | cBit)-1]) {
pos
|= cBit;
}
}

} while ((cBit >>>= 1) !== 0);
arr.splice(pos,0,entry);
}

That’s the simplified version, get a more optimized and complete example here. The great thing about this method is that it can be used to keep (or find) just about anything sorted. I’d also like to note that while I did actually think this up on my own, I’m definitely not the first. Not by a long shot. The real name for it appears to be Binary Search Algorithim.

Wii Flash

December 1st, 2006

I thought the fact that the Wii is including the Opera browser, which is very portable and works amazingly on small screens, was an interesting bonus feature. Then, in passing, I noticed something that changed everything.

It supports Flash. What version I don’t know yet, but it could change a lot of things. Since the Wii is PowerPC-based it’s not too much of a stretch to hope for Flash 9 support since it’s already out for the old PowerPC-based versions of OSX. Then again the Wii might not be powerful enough, so they might be using an older version instead. I don’t have a Wii yet so I’m dependent on the info that leaks out onto the Internet but I’ll find out soon enough.

There’s an interesting article on Wii-based web design here for those interested.

EDIT: There’s an even better article here.