Friday, March 27, 2009

Spades for Android

I've gone from dipping my toes into Android app development to jumping completely in. Over the last week I've put a lot of work into my newest app, Spades. Here's a demo video of what the play looks like:

I tried to make the card design fun and readable. Instead of using individual pips for suits, I used large numbers, which makes them more readable on the small mobile screen. I also made custom Jack, Queen, and King pics out of the Android logo.

The interface design was interesting. I wanted to support play primarily in vertical mode, which seems the most comfortable and natural to me. That presents a difficulty, since the screen is only about four thumb-widths wide. I initially made a hotspot for each card in the player's hand, which divided that horizontal region into 13 equal slices. That just didn't work. Not enough space, and it was very difficult to grab the card you wanted. So I went with a simple magnification scheme. That lower space is divided into four equal parts. When the player clicks in one of the four regions, the four closest cards enlarge. If the player slides their thumb horizontally, they will select one of the four enlarged cards. If they move their thumb up over a particular card, they will pull it out of the hand, and they can then drop it in the center to play.

Right now there are no sounds or animations, which would add to the experience. I just want to get the first version to market, and then incrementally add in other features, including Blind Nil and hopefully eventually network play. The only thing I have left to do is program the partner and opponent AIs, and I'm not out to make them exceptional, just moderately competent. I should be releasing it in the next few days. As of this writing, there are no Spades or Hearts games on offer in the Android Market. I hope to be the first with both.

I'll update here with some sales stats after release.

Friday, March 20, 2009

Lessons Learned From a Week in the Android Market

So spurred by the acquisition of a G1 Dev Phone and learning about the Android platform, I started developing my own apps. I've set up a website for my little enterprise, called Polyclef Software. Have a look and let me know what you think.

I released my first app, a simple tip calculator with a virtual number pad, a little over a week ago. I set the price at $0.99. So far no one has bought it. This could have something to do with the fact that there are a dozen other tip calculators already in the market, most of them free. Ah well.

Lesson #1: You're probably not going to make money off an app for which there are already many others just like it.

Since then I've released four more apps:
  • Where Am I? A simple app that pulls GPS data (latitude, longitude, altitude, bearing, and speed) and calculates your distance to the Prime Meridian and equator in km and mi (Price: free)
  • JoyBuzz A silly app with a big red virtual button. When you press it, your phone vibrates and it makes a buzzing sound (Price: free)
  • ConcretePal A simple calculator using the same virtual number pad as my tip calculator. You enter the dimensions of a slab to pour and it returns the volume in cubic feet and cubic yards, as well as estimating the number of either 60 lb. or 80 lb. bags of concrete you will need. (Price: $0.99)
  • DogWhistle An app that generates 5-second sounds at 7 different frequencies, most out of the range of human hearing, but within the range dogs can hear. (Price: $0.99)
Here are the stats so far:

Where Am I?
631 total
389 active installs (61%)

1607 total
974 active installs (60%)

19 total
18 active installs (94%)

4 total
3 active installs (75%)

I've actually got a bunch more numbers for DogWhistle, but the Google Developer Console hasn't updated them yet. I actually released the app last night. I had read about a popular app for the iPhone that was similar, and since I already had an app that generated sounds on the press of a button, I just swapped them out and put up the app. This was a mistake. I didn't extensively test the app, and as a result, I got an initial barrage of negative comments and cancellations of orders (Google gives you 24 hours to cancel your purchase of an app). So I reworked it, tested it a bit more, and re-released it today.

Lesson #2: Don't release apps impulsively. I was doubtful that the app would even have much interest, but I immediately got a flood of downloads. Which leads me to...

Lesson #3: Unique apps have much more potential for making money.

And another lesson...

Lesson #4: People will spend money for stuff related to their pets.

Now, back to the other paid app that's got sales, ConcretePal. So far this week I've sold 18 copies at 99 cents apiece. Google takes a cut of about 20%, so I'm going to see about $15 out of that. Not too bad for the first week. Although, yesterday I got a negative review from a user (which the developer can't respond to), which said that the calculations were wrong. The calculations are not wrong. This is a simple length x width x height, for frig's sake. The height is in inches, so I have to divide by 12, but the math is correct. I checked it several times, and checked the calculations against other on-line concrete calculators. Also, he said the bag estimates were too high. This may have some merit. Different on-line calculators and sites have slightly different estimates for bags per cubic foot of concrete, but I went with calculations with conservative estimates that take into consideration waste and spillage. I would think an overestimation would generally be better than an underestimation. Anyway, again, the market provides no way to directly address negative comments from users, which sucks. I had one other positive comment from a buyer of ConcretePal, and I hope this one dumb comment doesn't hurt the steady trickle of sales, but we'll see.

Lesson #5: You're stuck with what people say about your app.

I've also gotten several emails from people. Most of them have been about JoyBuzz. I'm kind of surprised it's gotten that many downloads. Some people want to be able to turn the vibrate feature off. Some people what another button that gives a "correct" ding. Who knows...I may throw those things in, but not right now. I basically wrote the app to learn how to make the phone vibrate and emit noise based on user input. Same with the GPS app, which I basically wrote to learn how to access the GPS information, in case I wanted to write a more complicated app that used the users location for some purpose.

Lesson #6: You can never tell what people might be interested in.

Anyway, my next app will be a card game. It's much more complicated than any of the apps I've done so far, so it will probably take another week or two. I'll post here about it when it's released.

Thursday, March 12, 2009

The TMobile G1

I recently got a TMobile G1 phone as a gift.

It's pretty darn cool. Like the IPhone, it features a touch screen interface, wireless internet access, GPS, and access to a market of free and paid applications you can run on it. Unlike the IPhone, the G1 also has a keyboard that's accessible if you slide the screen up. The phone runs Android, an open-source operating system based on Linux that runs apps written in Java.

I also downloaded the Android SDK and have been playing around with it a bit. My first app is a tip calculator called "TippinTime", which features an onscreen keyboard (for those who don't like the built-in keyboard), calculates the tip, total check, and split amounts for the tip and total.

Building an app with Android is pretty straightforward. The layout of onscreen elements like text fields and buttons is specified in an XML file. A Java file accesses the IDs of the elements in the XML file and let's you add functionality based on events like touching a button.

I plan on implementing a number of simple apps and trying to sell them for $0.99 a piece on the Android Market to see how that goes. An acquaintance recently put some simple apps for sale on the IPhone market and he's earned a few hundred bucks from it.

I'm especially interested in playing with the GPS capabilities. I was looking at an example today that let's you access the phone's GPS features and fetch features like latitude, longitude, altitude, speed, etc. There's an app for the IPhone called TrailGuru that graphs your progress while hiking or biking, gives you summary statistics, and let's you share them on a community website. I may work on a similar app for Android at some point.

I'm also intrigued by the barcode scanning functionality of the device. Here's a website that reviews two shopping apps that let you scan barcodes automatically with the camera built into the phone.

I downloaded a few apps to play around with them, and the scanning process itself works very well. Unfortunately, the database of current items is either incomplete or inaccurate for many products. For example, I scanned a box of Nabisco crackers as a test case.

One of the apps detected it as "The Best of Red Skelton" video.

Which is funny, but not all that useful. The apps did a good job of integrating with the web. I could scan a box of Cheerios and find the best deal if I wanted to buy them off the internet. But the most useful feature, comparing prices at local retailers, didn't work in any of the apps I tried, which kind of sucks. I'd like to be able to scan a box of cereal in my supermarket, and see what it costs in other stores in the area. Of course, this would mean that shopping would take approximately 100 times longer, since I'd be scanning just about everything in the store. But it would be cool, at least until the novelty wore off.

Bar codes are also on a ton of other things, from business cards in Japan to movie posters. Unfortunately, the hard part is building up the databases for reference. But I can already see the potential for this kind of technology, and it would be a lot of fun working on apps that exploit the bar code scanning capabilities of the phone.

I'm pretty impressed with the phone overall, but there are two big gripes with it. One, the battery life is pretty bad, especially when using some of the higher-end features. Also, the touch-screen interface is not very good. I put a screen protector on it, which I think has reduced its effectiveness, but even before then it wasn't working very well. I've seen some side-by-side comparisons with the IPhone, and I think in general the responsiveness of their touch interface is better. Although, the G1 does have a built-in keyboard, which does work pretty well. I'm not happy that there's no setting to adjust the touch-screen sensitivity, though. I'm not sure why...maybe it's very complicated.

Anyway, at some point I'm going to launch a simple website as a portal for the side projects (games and apps) I'm working on. I'll post a link here when it's up and running.

Tuesday, March 3, 2009

Why People Who Don't Understand Evolution Shouldn't Write Science Books

Recently I started listening to Why Beautiful People Have More Daughters by Alan S. Miller and Satoshi Kanazawa. It's about evolutionary psychology, a relatively new field which seeks to answer questions about human behavior under the assumption that there is a strong genetic component to behavior and that adaptive behaviors have evolved. So we can understand modern psychology by examining the conditions under which our ancestors evolved, namely a hunter-gatherer social unit, small in number (~30-40 individuals) living in savanna conditions.

There's some value in this approach, to be sure, and the book starts out all right, by discussing possible types of bias that people can fall into. Both involve confusing the way things are with the way things should be. The authors call these the naturalistic fallacy, in which people believe that because that's the way it is, that inherently makes it morally correct (e.g., nature is harsh and unforgiving so human societies should be harsh and unforgiving). The moralistic fallacy is the opposite, believing that things are the way you think they should be (e.g., all races and genders should be treated with equal respect and given equal rights, therefore there are no significant differences in measurable capacities such as intelligence or athletic ability between genders or races). But then the authors state blithely that they're not going to fall into either trap by simply not discussing the way things should be, but by sticking to the facts. Which is dumb. You don't have to explicitly talk about they way things should be to commit either fallacy. But hey, whatever. I let that slide and kept listening.

What made me press the eject button was the bit where they actually start talking about how evolution works. This snippet from an interview with Kanazawa basically restates the position from the book:

In fact, we’re not playing catch up; we’re stuck. For any evolutionary change to take place, the environment has to remain more or less constant for many generations, so that evolution can select the traits that are adaptive and eliminate those that are not. When the environment undergoes rapid change within the space of a generation or two, as it has been for the last couple of millennia, if not more, then evolution can’t happen because nature can’t determine which traits to select and which to eliminate. So they remain at a standstill. Our brain (and the rest of our body) are essentially frozen in time — stuck in the Stone Age.

That may sound reasonable on the surface. The problem is, it's flat out wrong. It's utterly, horribly, unmistakably wrong.

First of all, evolution in the strictest biological sense simply means change. Specifically it's a change in the makeup of the gene pool of an interbreeding population over time. Natural selection is just one way in which the number and types of genes in a population can change. It's a powerful mechanism, no doubt, but it's not the only mechanism. There's also a little thing called genetic drift, which is basically the effect of chance on changes in gene distributions. For those with any statistics in their background, you can think of it as sampling bias.

The point is, even if in an idealized model in which no selection were acting on a population, it would still continue to evolve. But besides that, there has been a torrent of recent research demonstrating that not only has human evolution not ground to a halt, it has actually accelerated. Check out this post on John Hawks' excellent blog regarding the increasing rate of genetic change in human populations.

Anyway, when someone is writing a book about how evolution affects behavior, they need to demonstrate a basic working understanding of evolution. By completely failing to do so, so early in the book, the authors actually saved me a fair amount of time. Why should I listen to someone ostensibly trying to teach me about a subject that they don't even have a basic grasp of?

I didn't even get to the explanation of why beautiful people supposedly have more daughters, but based on what I'd read so far, I be a lot less credulous about any claims they make.

Monday, March 2, 2009

Republicans and Science

My sympathies are split between the Democratic and Republican parties. I generally support the social liberalism that the Democratic party espouses, while supporting the avowed fiscal conservatism and hawkish foreign policy of the Republicans. But there's one issue that's recently turned me more and more off the Republican establishment, and that's their public perspective on science.

During the Presidential campaign, McCain mocked the idea of upgrading the projection system in a planetarium, and Palin made fun of fruit fly research, which is essential to continued research in genetics. They both looked like backwards assholes.

And in his response to Obama's Congressional address, Louisiana Governor and rising Republican star Bobby Jindal pulled the same shit, mocking magnetically-levitating high speed rails (with a tone that suggested it was akin to voodoo), and worse, making fun of "something called volcano monitoring". As a number of bloggers, scientists and laymen, have pointed out, far from being frivolous, volcano monitoring is an essential component of natural disaster prevention for those in potentially-affected areas. Would "something called hurricane monitoring" be just as ludicrous?

Look, there are more and less legitimate scientific spending projects. If you think the money is better spent on one project as opposed to another, say so. But what the Republicans have systematically been engaged in is a kind of populist, intellectual warfare where they mention a scientific spending project as if it's the most absurd thing we could be spending money on. I think they think this will resonate with an average voter, and it just might, but at the expense of sowing further misunderstanding and distrust of the scientific community, and potentially jeopardizing legitimate investment in research and technology, which is a bedrock of American innovation and economic strength.

If these top-tiered leaders of the Republican party really don't understand the projects, then they should just keep their mouths shut. But I think it's probably the more egregious case where they actually understand the issues, but are just trying to score political points by exploiting ignorance and mistrust.

Either way, it really pisses me off.