17 January 2009

Renewed Vim and Vigor

Today brings and end to my focus on Python. My adventures into programming with python and pygame haven't ended, but I'm doing a bit of transition (just like I promised : ).

I recently started a new job (large video game developer) in a new city (on the west coast). I want to make an effort to start writing more, and this is my outlet. However, I'm so busy with all of these new things that I don't do enough programming in my spare time to produce many posts.

So instead, I'll talk about video games, software, and general technology topics. Of course, anything I say here is in no way representative of my employer.

Hope you enjoy the new cipher.sense!

Glossy Finishes and Translation of Design

Jeff Atwood recently posted about the importance of pearls on a pig.

As you may guess, Jeff and I disagree. In my opinion, the "new" Windows 7 (beta) calculator has not had a UI redesign. It's just been themed so it matches the new Windows look.

If they actually did a UI redesign, then it should result in a BETTER INTERFACE. Why would you ever change your interface if you are not going to improve it?

Let's look at the "new" interface: All of the buttons are the same size. The primary input buttons (numbers) are white, except for some strange blank key next to Mod. (Anyone know what that's for?) In order to maintain the layout of the standard calculator and keep the equals on the bottom right, the operators are split on either side of the numbers, instead of being grouped. The hex-exclusive numbers (A-F) are not obviously greyed out in Decimal mode. (They look the same as the decimal button, which shouldn't be disabled at this point.)

Of course, this is still beta software at this point and things may be improved. Also, I'm not using the calculator. My impressions are based on screenshots. Lifehacker reports that Microsoft has added some nice functionality to the calculator, but what if they took a different approach to design?


How about having a keyboard-focused mode? When I use a calculator, I rarely use they mouse, but I never remember keyboard shortcuts for square root, memory, toggle negative, or several other complex functions (do they exist?). Having those easily accessible would be far more useful. Have an user-friendly way to store multiple numbers.

But instead, the new Calc just looks prettier. Garbage! I love pretty, but pretty without function is a waste of time.


That said, I haven't used a really good calculator app. I often just open a python interpreter because at least then I can store several variables and I get a better computation history.


Calc looks like a real calculator. Because we lose the tactile input, it's harder to use and (for me) even a simple command prompt is easier to use. Replicating the design of real-world objects has some utility in software design, but there are many cases where it is misguided. How many people remember where all the keys are on a (real) calculator? If they were laid out differently (but still sensibly), would it be that much harder to use? No. While your muscle memory would be impaired, it doesn't make that big of a difference. And since computer software throws all of that muscle memory out the window, it doesn't matter.

So if you're designing your app to look like a real-world object, think again. And read the Design of Everyday Things.

03 January 2009

The Problem with the Monty Hall Problem

If you're not familiar, the Monty Hall problem is a frequently discussed (in probability) and often confusing problem (for almost everyone).

Jeff Atwood recently posed a question to his readers that involves similar reasoning. The poor phrasing of Jeff's question and the response in the comments got me thinking about old Monty again.

I think the problem is not just the wording of the boy/girl part of Jeff's question, but when you get your information. The 2/3 answer assumes that you are making a prediction. This is the same problem with the Monty Hall problem.


Exploring the Problem

Say I was going to flip a coin twice. If I flipped it once and it was heads, the second flip is not more likely a tail since the events are independent.

However, if I said I was going to flip a coin twice and I want you to bet on the result before I flip any coins. If a coin is heads, you bet what the other coin will be, and if one is tails you bet what the other will be. You should be the opposite (for heads bet tails).

If a coin is going to be heads, it's more likely that the other coin is tails. (Possibilities: HT TH HH)


Or, to make this more like Jeff's original problem, you can only bet assuming one coin is heads. If both are tails, then we throw out that round (and this action is part of what makes the result not 50%).


This explanation also demonstrates why programming a simulator and examining the results is misleading. The simulator is working on predictive probability. If you wanted your simulator to work without predictive probability, then you'd have to program it at the point the decision is made. You should assume the initial condition (that you chose the left door and the middle door was shown to have a goat). Then decide whether to switch or stay.

I'll leave the programming as an exercise for the reader : )

19 October 2007

Return, hopefully

Long time away. School got in the way. I did manage to play around with pygame. I got the chimp example working and then modified it to implement a chase algorithm.

But then came school and I was long distracted making phones and sentient beings.

But now I'm back on track to work again. I've started playing around with PyObjC. Hopefully, I'll have some pygame progress soon too.

11 March 2007

pygame setup

The Prerequisite Quest
So I have some dependencies that I'm supposed to install:
Numeric, PyObjC, PIL, and SDL

So I got Numeric and PIL from pythonmac. (Yes, the same place that I complained didn't have a working 2.5 installer.)

Futile Search for PyObjC

PyObjC doesn't have a 2.5 installer, I googled and came up with this:
> The current installer refuses to install after a python 2.5 install.
> Is there a way around this?

Install from source. Make sure you have Xcode installed, including
the Universal SDK and then install setuptools and use
'easy_install-2.5 install pyobjc' to install PyObjC.

That sounds useful, so I throw caution to the wind and start hunting down setuptools. Seems like a really easy download, although their page is strange. Go here to get the "egg" (like a deb, gem, rpm...), but don't bother with the "Downloads" section, just go right to the bottom of the page. (The self-referring link is a little confusing, but I assume some automated solution set it up like that. Still, begs for a bug report.)

Once you've installed setuptools, you'll have easy_install on the command line. Run
easy_install pyobjc
to install PyObjC. (Yes, I know that's not the same as the mailinglist instructions, but this is how you install packages with EasyInstall.)

However, all of the above doesn't work. After a big stack trace, I get:
File "/private/tmp/easy_install-Srjxqo/pyobjc-1.4/source-deps/py2app-source/src/macholib/util.py", line 33, in
TypeError: Error when calling the metaclass bases
first argument must be callable

So on to another method...

Non-easy_install of PyObjC
EasyInstall (as I understand) is just supposed to make it easier to install python packages. But there's always the old fashioned setup.py way:
  1. Download the pyobjc source from http://pyobjc.sourceforge.net/software/
  2. Untar to a temp directory
  3. From that directory (should see an Install.txt in there), run python setup.py build
  4. Run python setup.py install
  5. And if you want py2app and other fancy things, run python setup.py bdist_mpkg --open

Then follow those build and install steps (1-4) again getting the pygame source package from http://www.pygame.org/download.shtml

After that, you should be able to run the simple Chimp example from pygame.

(Although I seem to be missing the sdl_ttf package to do font rendering.)


Progress is made!

"The software has been successfully installed"

So I feared before that I wouldn't be able to easily install Python 2.5 on my Mac (10.4.8).

I had been using this url to get my python 2.5 installer:
http://www.pythonmac.org/packages/py25-fat/index.html

But of course, that's the wrong url. If I use this one, then I actually make progress:
http://www.python.org/download/

Hurrah. Time to go ask for some fixes and then get myself pygame.


You might think to yourself, why didn't he just verify the files? Well dmg files seem to do their own kind of verification, but I also checked the md5sums:

$ md5sum -v python-2.5-macosx.dmg ../python-2.5-macosx.dmg
9ea85494251357970d83a023658fddc7 python-2.5-macosx.dmg
9ea85494251357970d83a023658fddc7 ../python-2.5-macosx.dmg

I don't need to tell you which is which, they're identical! (And they are the same as the posted md5sums.) Don't know how that happened.

[edit:verify, linkify]

Installation Woes

So it appears that Python 2.5 doesn't want me. I tried to install the newest version of Python (2.5) and everything seemed fine but at the last step of the installer (where you click 'Install'), it hangs and I get Beachball of Doom. Apparently that's what I get for using a Mac : (

Odd too. You'd think that Apple would make sure that developer tools like Python would work flawlessly on their system. I want to make software for their customers. Sigh, you can't make all of the people happy all of the time.

So my options now are compiling from source or trying to track down my problem. Which is more daunting...