Tuesday, March 30, 2010

Why everyone always loses at gambling

You always hear about people coming back from Vegas having lost big. A small percentage of people win big. However, you may also know that, if you make smart bets*, the house edge is only, say, 1 or 2%. So you'd imagine, if you had 100 friends, maybe 49 would go to Vegas and win and 51 would lose.

Ah, but here's the trick: if your friends each took $1000 to Vegas, bet it all at once on one of these low-house-edge bets, and stopped there, you'd have 49 friends who won and 51 friends who lost. But that's not how we gamble. I might sit down at a table with $100 and bet $5 until I lose, in which case I'm trivially guaranteed to lose.

Or you might play like me. I thought "aha, I am a clever one. I will sit down at a table with $x, and if I double my $x, I will shrewdly leave the table. Thus my two exit points are $2x and $0; I have a 49% chance of hitting the first and a 51% chance of hitting the second, so I will likely not lose all the time."

But that's not how things work! If the house edge is 2%, like in this example, you basically lose 2% of your money on every bet! The longer you play, the less likely you are to hit $2x, and the more likely you are to hit $0.

How much more likely? You could probably math it out. But I gave up math for programming, so here's a bit of python you can copy and paste:

#!/usr/bin/python
#

import random

startingMoney = 50
bet = 5
wins = 0
losses = 0

for i in range(10000):
money = startingMoney
while 1:
result = random.randint(0,99)
if result >= 49:
money -= bet
else:
money += bet

if money <= 0:
losses += 1
break
elif money >= 100:
wins += 1
break

print "wins: " + str(wins)
print "losses: " + str(losses)

Run it a few times. The house edge here is set to about 2%, corresponding to the 49/51 thing we discussed earlier. You'll find that you win about 40% of the time, though. Ratchet the house edge up to 4% (change that 49 to a 48), and you'll win only 30% of the time! Terrible! And this is not even counting the fools who play slots or those goofy table games or whatever.

Or, you could just accept the folk wisdom that "everyone always loses in Vegas", and you wouldn't be too far off.

* AFAIK, the "good bets" are the pass line and odds in craps and 3-2 blackjack with solid basic strategy. And poker, if you're good. But that's a whole different story...

Friday, March 26, 2010

And... my first mobile app ever is live.

Is It A Party?, now on Android.

Scan that sucka! Download it! Shake it, yell at it, rate it like ten thousand goddamn stars!

After all, we've got Is It Tuesday? to compete with.

Goodnight world! I'll catch you on the flip side of Las Vegas.

Thursday, March 25, 2010

Wait for it...

"Is it a Party?" is coming out soon! So very soon! Sooner on your Android device than on your iphone because Android developers don't have to wait for Apple to approve anything!

In the meantime, working on this app has reminded me of college. Assignments that really take more time than I have, but they're pretty fun because they're all toy problems, so sometimes I don't mind staying up late to work on them. Because I keep getting that little jolt of "you changed something else and now it works!" which keeps me awake wayyy past the point of optimal brain functioning.

It makes me a little loopy and irresponsible! My apartment is a wreck; there are dirty dishes in the sink. I NEVER leave dirty dishes in the sink. But the app has to get done by tomorrow, because I'm leaving for the weekend... some things are just more important. And it's so exciting: discovering mobile apps is like discovering paint for the first time.

So, give me a couple weeks to recover. Then... anyone want to make another mobile app?

In other news, I got a cavity filled yesterday, without novocaine. It was really not so bad. And I'm going to talk up how it's not so bad because I guess people hate going to the dentist a lot or something, but I think it's all just a feedback loop. Do you have a dentist appointment coming up? It is not so bad!
Also, drills in your teeth: what an interesting feeling! I decided I was going to frame it as such, and not as "pain" or whatever, and I think it helped. It was a little painful, but mostly it was just a brand new sensation, and kind of like food and countries, I like new things. Plus, when I thought of it like that, it was like I was taking control of the situation, and that made it easier, I think.

Sunday, March 21, 2010

So, do you ... design stuff?

Or draw stuff? Or something? Gary and I have this app that is quite functional and needs like 4 screens' worth of design. It tells you whether you're at a party or not. Very simple. But I realized, after trying to do it, that I am no good at making apps look all professional-like. Let me know if you're interested.

In other news (actually the same news): Startup Weekend was really great. You know that whole concept of "flow"? You get it when you do things that you're good at, and are really engrossed in. I haven't had a big hit of it for a while, but I sure did this weekend, and that was really nice.

A lot of people made cool things! I'm impressed at these big teams that can get something done in a weekend.

At the same time, I'm sick of trendy software. If I hear the words "social media", "twitter", "facebook", or "foursquare" again I will punch something.

Social software is bacon. It tastes good at first. It tastes good at second, too. But these days, everyone has figured, well, it tastes great, let's get more of it! I don't have enough (bacon/social software)! Furthermore, I'm making a new (food/software); why don't I make it hip and modern by adding (bacon/facebook). We can have (bacon/social software)-fests! We'll joke about how everything is better with (bacon/twitter).

Well, who knows. Maybe it's great. And who am I to talk: I just spent a weekend making a dumb phone app.

Which brings us full circle! If you can make said phone app look sweet, let me know.

Saturday, March 20, 2010

Take 10 seconds to help me out. This is not even an online petition or survey.

Okay, so. I'm doing this thing called Startup Weekend. A bunch of people who want to start businesses get together and pitch ideas, then people clump together and work on those ideas for a weekend. Maybe they start a business about it.

(If you know me, you know that I don't at all want to start a business right now! But I do like hacking on things and learning things etc, and I'm interested to learn how these startuppy things go and how people make software things quickly.)

So while other people are working on all these actual serious things where they're going to make money or save the world or social network facebook linkedin twitter mashup foursquare blaaaaaah, a guy named Gary and I are making an app called "Am I in a bar or not?"

The premise is simple: you know how often you hold up your phone to Shazam a song, and it's all noise and Shazam doesn't work? Well, there's a lot of background noise there, which is a lot of data... what can we learn from that data? How about whether you're in a bar or not? So our app will work like Shazam: you hold up your phone, get an audio sample, and it tells you whether you're in a bar or not.

Here's where you can help: we need data points. We need data from you when you're in a bar, we need data from you when you're not in a bar. So please, record 10 seconds or so of audio with your iphone or whatever you have (an app called "hifi recorder" works well on android, unless you know a better one), send it to amiinabar@gmail.com, with the subject line "in a bar" or "not in a bar", accordingly.

Kthxbai.

Sunday, March 14, 2010

When I finish this post I am going to hit "Enter" with such a flourish...

Have I mentioned "What Japan Thinks"? It's one of the oddest blogs I read, in that it doesn't really fit into "webcomics", "enlightenment", "travel", or "friends' blogs". I don't really think you can get a sense of "what a whole country thinks" by reading surveys, but I think you could do worse. Still, it's not super entertaining; I'm considering no longer reading it. But then a post like this comes along and it's great: what girls do to appear cute and what guys do to appear cool.

I mean, I know I always fall for girls who say "upsadaisy" quietly when they lift things. (Only quietly, mind you.) That's why I hope to attract them by leaving a toothpick hanging out of my mouth and staring into the distance.

(waves finger) Indeed!

Saturday, March 13, 2010

A thought about Happiness by way of Math Contests

I swear I'll stop talking about Happiness soon. It's getting annoying, even to me. Anyway, the topic of this post: Everyone wants to know about Happiness these days. But when people talk about Happiness, they're talking about a lot of different things.


A long diversion into high school math contests:

Back in high school, there were math contests. You might have had them too. We had the OML (6 tests x 30 min), the CML (5 x 30 min), the OCTM (1 x 60 min?), and then the big one, the AMC (1 x 90 min?).

Each test had its own little flavor. The OMLs were the most popular, because they were just a half hour and I think most teachers gave you bonus points if you took them. Each test had 6 questions, 2 easy, 2 medium, 2 hard. Your school's score for each test was the top 5 students' scores that day, so as long as we had 5 6's, we were golden. Your personal score was your total along all 6 tests. We had a guy named Orest who got a 36 my junior year, I think; the math teachers were pretty excited. (to be fair, some of us kids probably were too, but it's high school math contests, so you always had to play it cool, like you were just taking them for the extra credit and didn't really care.) Anyway, at the end of the year, our school would get a little plaque that said "#9 in the state" or whatever. Or did we win that one a lot? Maybe we got #1 in the state a couple years, I don't remember.

The CML was just like the OML but really nobody cared.

The OCTM was even better: you had to take it on a Saturday! Of course I did, because I was a dork, and about 30 other students ended up going because they were dorks or were getting extra credit. But it was cool, because invariably like 5 of us would do pretty well, so we got to go to the OHMIO, which was in Columbus on another Saturday. (why did I think this was fun? oh right, high school, basing my self worth on mathematical ability. (and you know other stuff but really on mathematical ability)) The OHMIO actually was kinda fun though, because I'd get to hang out with all the senior math guys, some of whom I thought were cool, and we'd all joke about how we didn't care about this dumb contest. (clearly we, y'know, dragged ourselves to Columbus on a Saturday just to show how much we didn't care.)

(interlude interlude. At this point in the story, I realized I haven't mentioned an important character: the B-man. He was that math teacher who wrangled all the math kids to the math contests. He also taught the advanced calculus classes, and his classroom was called "the Math Factory". Naturally, he was this intense, motivated, Stand and Deliver-type inspirational Math Guy who spurred us all into love of all things numbers, right? Nope. He was very disorganized, not good at teaching, terrible at keeping order in class, likable but out of it, nutty professor. Oh the B-man stories I could tell... but that's another post. Or series of posts.)

And then there was the GDOTA (Grand Daddy Of Them All): the AMC. You got to get out of your first two classes one day to take the AMC, so that was popular too. 25 questions, multiple choice, where each is 6 points if you get it right, 2 if you leave it blank, and 0 if you get it wrong. 90 minutes. You could take the AMC 10 if you were in 9th or 10th grade, or the AMC 12 if you were in any grade. Also, you could take it twice (the AMC A or B). If you did well on the AMC, you could take the AIME, and that was a trip: 3 hours, 15 questions, each answer is a number between 1 and 999. And then I guess if you did well on the AMC and the AIME combined, you could go to super math camp where they prepare you to duke it out against the Soviets or something at the International Math Olympiad, which is 6 hours, 5 questions.

Nobody from our school ever went on to the IMO; that's crazy talk. What super nerds those guys must be! ... but we all kinda, or at least I kinda, wanted to be the first. And one year I got hella close! I remember I got a 136 on the AMC 12 B, and I think a 9 on the AIME, so my total score was (136 + 9 * 10) = 226, and the cutoff for being a Friggin' Righteous Mathstronaut was 236. I was so proud that year! But besides my winning the AMC school champ's prize, I didn't really tell anyone.

So, no Math Uber-champs from our school. But we'd have 5 or 10 kids take the AIME every year, and this one was a real treat. We'd get out of our first like 5 classes one day, sit around in the School Board room with its fancy wood table and leather chairs (private high school...), one of the teachers would bring donuts, and we'd sorta rack our brains for an hour, sit around for 119 minutes, and then pick out random numbers to guess right before the time ran out. I mean, this test was hard.

Anyway, why do I tell you about all this? Well, 1. because it's interesting. What a weird, cool, nerdy, nervous subculture we had! There were clearly a few Math Guys, and we'd all take these math contests that were pretty fun, but we'd never admit to them being fun. Or maybe some of us were just there to get out of class, I don't know, but I at least quite enjoyed them. We'd celebrate our OML victories, but only a little bit; we'd never all go out together or meet up at any time besides math contests. The B-man really enjoyed all this, and he'd do stuff like get OML sweatshirts printed (no lies), but his enthusiasm wasn't contagious. Well, maybe a little bit. But the whole thing was a little warped-- repressed nerdy math kids taking math contests so the Grown-Ups can give us gold stars and we can further develop our identities as "just the smart kids".

But 2. because I actually have a point out of all of this. Okay. So I'd always notice on the statewide scores for Ohio math tests (any of these, but particularly the AMC), I'd find my name, and it'd be in the top 100 or whatever somewhere, and always a bit above it would be this other kid, Jason Juang. I never met him, I don't know why I picked out his name, but kid was good at math. Even on the tests I did well on, I'd go up the list a bit, and there he was. This bugged me! I'd always say, man, if only I were as smart as that guy. I could win statewide contests, instead of just school-wide. I'd be actually smart, not just kinda smart.

(in my super-year when I fell just shy of math stardom, I did beat him on the AMC 12 B. But he beat me on the AMC 12 A. Meh.)

Anyway, I don't know why his name popped into my head this morning, but I got to wondering, what's he up to now? (I might have googled him. err, creepy? yes. sorry. ooh, I hope my pagerank is high enough that this post shows up when he googles himself. Hi Jason!)

Uhh, me-being-creepy aside, I got to thinking, what do I mean by "what's he up to now?" I wonder that about people sometimes, and it's never really clear what I'm wondering. I guess it'd be kinda interesting to look back at my 6th grade class, say, and see who's the most rich and famous, but I don't even care. It'd also be kinda interesting to gawk at who totally burned out, but again, I even more don't care.

It'd be really interesting to go back and see who's the happiest.

And here's where I get back into my original post. Happiness. Everyone's talking about it, and I think we just have a big issue of word choice failure. There's a lot of things people talk about when they talk about Happiness, especially these days. Shooting for "happiness" has become like shooting for "goodness"- almost a tautology. Of course you want to be happy, because you define "happy" as the thing you want to be.

There's experienced happiness, and there's remembered happiness. Daniel Kahneman gave a great TED talk (is there any other kind?) about this. People think vacations are better than they actually are, because when they remember vacations, they only remember the good parts. Which do you want, happiness seeker? Do you want to maximize experienced happiness or remembered happiness?

How about fulfillment? Maybe I'll be happy today if I play video games all day. But tomorrow, I'll feel like I wasted today, and that will make me unhappy indeed.

There's comfort, too, and I think this is what this post ("you can either be happy or interesting") is all about. I don't buy the "you can either be happy or interesting" argument. (Penelope Trunk would then say "then you must not be interesting. interesting people don't mind that they can't be happy." But that's some kind of logical fallacy, some reductio-ad-you-can't-argue-with-me circularity. Assuming the consequent?) You can be either comfortable or interesting, maybe. And comfort is nice; even Kahneman above says, if you want experiential happiness, spend time with people you like. Easy enough.

And then there's mindfulness, or transcendence, or whatever it is that supermonks have. I bet Matthieu Ricard (another 20-min TED talk, sorry) isn't "happy" the same way I'm "happy" when I go to the pub with some friends. In fact, it's demonstrably not the same: delta waves, left prefrontal cortex, n'at.

So there's a few, to get started:
  • Experienced happiness
  • Remembered happiness
  • Transcendence
  • Comfort
  • Fulfillment
Or, maybe some are subcategories of others: experienced happiness includes comfort and transcendence, remembered happiness includes fulfillment.

What am I leaving out? Help me out here. And which of these is most worth pursuing? Ah, now that's a good question.

Finally, while we're still talking about this, I'll leave you with another talk, this one by Srikumar Rao, in which he posits that unhappiness comes from concentrating on the results of something; happiness results from enjoying the process. Nothing really new, at least to me, but it's fun to watch because he's really into it.

Friday, March 05, 2010

Oh snap, No Impact Man!

Question: am I using my big ol' noggin to help the world in a meaningful way?
Point: what I do is useful, because though I am but a cog in a big machine, I am helping make Chrome, which is very fast and makes the internet better by pushing for faster better more standards-based websites, and more internet makes things better for everyone! You know, like those farmers in Africa who can look up information about crops on their phones now.
Counterpoint: http://noimpactman.typepad.com/blog/2010/03/progress.html

Let's duke it out, but first let me diverge and talk about Buddha for a while. I saw a talk by Thanissaro Bhikkhu yesterday where he talked about questions and answers with the Buddha. A lot of people asked the Buddha a lot of questions, and were often confused by his answers. Most people answer questions one way: categorically, but the Buddha answered questions 4 ways:
1. categorical answers, like "yes" or "no".
2. analytical answers, which take a little explanation, or breaking it down into cases.
3. answering the question with more questions
4. just not answering the question, or the "mu!" answer

The Buddha didn't pick from these at random; he did whatever would be most skillful. And you can see this makes sense, and you get questions like this in daily life. Examples:
1. categorical: if you said "does 2+2=4?" I'd say yes. Done.
2. analytical: if you asked me "is it sunny today?" I couldn't just say "yes" or "no"; I could say "if you mean "was it sunny this morning" then yes, if you mean "is it sunny now" then no."
3. more questions: if you said "hey Dan, what kind of knife should I buy?" I'd say "do you mean for the kitchen, or for juggling?" and next "if you mean for the kitchen, do you want a cheap knife or an expensive knife? and what kind of knives do you already have?"
4. mu!: if you said something nonsensical, like "do colorless green ideas sleep furiously?", that would not merit answering. Or like "hey, what's the best way to dismember a corpse?" It would probably be best for all involved if I didn't answer that.

(for the record, draw and quarter. cut at joints, not through bones. duh.)

The Buddha is such a pragmatist! It's kind of weird that it's even considered a religion. At all points, he's just trying to get people enlightened (/in a higher mental state/happier), in the most logical, straightforward, and effective way. It's kind of weird that there are scientists or engineers out there who are not Buddhists.

Anyway, No Impact Man vs. me working at Google. I was going to say "well, my point above wins." Then I was going to be all mopey and be like "yeah, but does it really? I mean, internet is nice and all but I should be feeding starving children." Then I was going to be like "look I learned cool things from the Buddha; this question does not have a categorical answer." But I think ultimately I just posted about two unrelated things, and my point above wins.

(or at least, to worry about it, at this point in time, would not be skillful.)