Sunday, May 22, 2011

How do you bid in Spades?

Anybody who knows me knows that I enjoy playing games, particularly card games. And when it comes to card game, I'm particularly fond of playing spades.

Spades is a four player game where players pair up on teams and collect "books", competing to reach some predetermined score. A book is a set of four cards given to the team who plays the highest card under the rules of the game, which I will explain later. Teams collect points by bidding [or trying to predict the number of books they will collect]. If a team does not collect the number of books they bid, they will lose ten times their bid. If a team does collect this sum of books, then they gain ten times their bid (I'm assuming a simple version of Spades here with no sandbags to simplify the explanation). 

So we can see the importance of precise bidding. What then should be the standards of good bidding? 

We can start by mathematically describing the rules of the game. 

1) Trumps / Spades beat allother cards (hence the name of the game). 
for all x \in Spades, y \notin Spades x > y
(because there are only four suits, the statement y \notin Spades could be replaced by y \in Hearts \cup Clubs \cup Diamonds). 

2) In every suite, the cards 3, 4, ..., K, A follow their natural order, i,e,

3D < 4D < 5D < 6D < 7D < 8D < 9D < 10D < JD < QD < KD < AD
3H < 4H < 5H < 6H < 7H < 8H < 9H < 10H < JH < QH < KH < AH
3C < 4C < 5C < 6C < 7C < 8C < 9C < 10C < JC < QC < KC < AC
3S < 4S < 5S < 6S < 7S < 8S < 9S < 10S < JS < QS < KS < AS

(There are many ways of playing this game. I'm going to assume the deck is set up the way I originally learned it. This is sometimes called "Joker, Joker, deuce, deuce", which refers to the top 4 Spades - the big joker, the little joker, the high deuce, and the low deuce. Under this setting, there is no 2C and no 2H, and generally the 2D is the high deuce and 2S is the low deuce, but this generally depends on where the game is being played and who else is playing). 

And by 1) we have that AD < 3S, AH < 3S and AC < 3S. This establishes a partial ordering amongst the suits and cards. Note that this is not a total ordering because ther is no comparison between a JH and a 3C. This is handled by the next rule. 

3) All players must follow suit unless a player has no cards of that suit in their hand. This means that the suit of the first card thrown determines the type of cards that all other players must choose from. If a player does not have that suit in their hand, then they are free to play anything, but the only suit that can beat the original suit is a spade (per the partial order). 

4) If a plater does not follow suit (and is caught), it is called reniging and costs that team 3 books. 

5) The first player to play a card in the first book is the player to the dealer's right. The first player to play a card in all successive books is the player who won the last book. 

From this we can see that the only cards that beat Aces are the Spades. One strategy is to play aces first, in which case the only way an ace doesn't bring in a book is if a player on the opposing team has no cards of that suite. What is the probability that an Ace walks then? 

We can set this up as the following fraction: 

number of ways that another player can be dealt a hand without receiving a card of this suite
---------------------------------------------------------------------------------------------------
total number of ways that another player can be dealt a hand. 

How many cards are left that are in this suit? Suppose that I have x cards of this suit in my hand. There are 12 cards total in a (non-spade) suit. So this leaves 12 - x cards in this suit that are not in my hand. 

How many cards are left that are not of this suit? Suppose again that I have x cards of this suit in my hand. There are 52 cards total, 13 of which are in my hand (13 = 52 / 4), leaving 52 - 13 = 39 cards remaining. Each (non-spade) suit has 12 cards.  So there are 39 - (12 - x) = 39 - 12 + x = 27 + x cards that are not in this suit and not in my hand. 

If a player has no cards in this suit, then all their cards come from this set of size 27 + x. 

So this equation can be represented as 

(
27 + x
13
)
-------------------------
(
39
13
)


This simplifies to
(27 + x)! 26!
--------------
(14 + x)! 39!

I've taken a basic approach to this game and there are many further questions to be answered about the game of spades. I could continue and find the probabilities for other non-spades, as well as the probabilities for spades. But my time has run out and this has been a fun exercise to play around with one of my favorite games and one of my favorite languages.

    Tuesday, May 17, 2011

    Why do we feed the trolls?



    I remember when I first got into the internet. I was on two mailing lists. One was for my favorite football team (Go Skins) and the other was for Lincoln Douglas Debate which I did a long long time ago. I remember how much I enjoyed the "chat room" type atmosphere of those things. But every once in a while, a conversation could get out of hand - a racist slur, or a sexist comment, or a sequence of images that just didn't belong there. I can't remember, but I imagine that initially I was probably upset by these types of things trying to get in the way of my Zen and the relaxation that I was seeking by going to these message boards.But I know that somewhere along the lines, the fact that I was more of a reader than a commenter helped me to understand that by commenting on these "internet trolls", all I was doing was giving them more ammunition to come back and get more attention. So ultimately, as my presence in these (and similar) forums grew, I learned to not get bent out of hand about stuff like this.

    There's been a lot of talking going on lately about two things in my circle of friends. The first is Fox News reporting about Common as if he's the one who put a target over a congressman's head or something (wait, thats what MSNBC and many liberals said about Sarah Palin in response to the shooting which 6 people were killed and 19 people were shot). The other was an article that was put up on Psychology Today (which was later taken down, but from what I understand the text of the article is available at All Hip Hop: Psycho Today headline: "Why black women are rated less attractive"). Both of these seemed to initiate "riots" on facebook and twitter talking about how bad the journalism was, or the racism, or the sexism, etc. Me personally, I saw these two headlines and just kinda dismissed them as stuff thats trying to bring me down and since I've got enough things that are trying to do that in my own personal life, figured that I didn't need to worry about the articles themselves.

    One thing about the Common story is the source of it. It was coming from Fox News. This isn't the first time they've said something thats been taken as racist, and I'm sure it will not be the last. Thats part of their "thing". They like to rile up their base, particularly by making up lies to convince their base that the opposing side is evil, in which case they can get their base to do whatever it is Fox News is promoting (is this what Malcolm meant when he said "By Any Means Necessary"?). Like Jon Stewart said about a year ago in an interview with Rachel Maddow, the thing about Fox News isn't the lies they tell, its more about the fact that they're a well oiled machine at doing it.

    The other story about Black women, well thats one that (IMO) is rooted in a lot of racist beliefs and trying to use "science" to back up those beliefs. I find it funny (what else can I do but laugh) that they basically had a survey and called it objective. Yeah, cause I'm sure that if you change the set of people you're interviewing the results won't differ. And I'm sure that if you change the definition of 'beauty' the results won't differ. But this is the type of pseudo-science that is driven for tabloids. Maybe I should be mad that it could be published in Psychology Today, but even that doesn't get me mad. Nothing surprises me any more.

    While I still hope for the best in my fellow human beings (and myself), the fact that they (we) don't measure up to the ideal standards we set for ourselves doesn't mean I'll get bent out of shape about it. If I meet somebody who holds these beliefs, I'll probably try to talk to them about it and if it leads to a good dialog, then I'd be happy about that. If not, then at least I tried, but I won't beat myself up about it either way.

    This is not meant to discourage others who acted differently. I have a friend who sent a letter to Psychology Today. Jon Stewart went on Bill O'Reilly to talk about the Common issue. I think those are both constructive ways to address this problem. Other friends have written their own blogs about these different issues, and I'm sure that helped diffuse some of the tension (both internally and externally). And this post, in itself, is in some measure inspired by these trolls themselves. But I feel like the more time we spend feeding the trolls, the more ammunition they will have to upset you (us) the next time. I guess its the principle that there's no such thing as bad publicity. I think this is especially true in the case of trolls. Publicity for a troll establishes that they've gotten into your life, into your stream of thought, and thats, is a success for them.

    Like I said, there may be other, more constructive ways to defeat a troll, but if nothing else comes to you, I say just ignore them and don't let them bring you down.

    Monday, May 9, 2011

    Do You Need a "Vacation"?



    I can't count the number of times friends have suggested to me that I need a vacation. While I'm inclined to agree, the truth is that the nature of my work is that research questions tend to try to fill any moment where my mind is not already thinking of something else. So the idea of me going on "vacation" is just as much mental for me as it is physical. To me a vacation is a way of relaxing to the point where I'm either thinking of positive thoughts or I've at least found a way to not think about whatever negative thoughts are trying to get me down. So here are a few ways that I take my "vacations".


    • Work
    In my opinion, my tendency to overwork is not always a bad thing because I sometimes turn to work to provide relief (or a "vacation") from the seemingly unsolvable problems of my life (relationship stuff, employment issues, health related stuff, family matters, etc). When I've got a good lead on a problem, it provides a flow of thoughts that keeps my mind busy for hours at a time and this can be such a relief from those issues that its a welcome "vacation". But then the question becomes why don't I get good leads whenever I'm stressed out? Sometimes, the work can be stressful because I'm not progressing fast enough, or because I find a counterexample to an idea, or for a variety of other reasons. So then what should I turn to?

    • Conversations
    One of my favorite "vacations" is an ol' fashioned conversation, whether it be with long time friends or somebody I just met at the bar. Sometimes, the procedure of sitting and talking to somebody else can else can seem to relieve a thousand burdens. Sometimes I don't even talk - I'll just sit and listen and hear stories that I can relate to. I think I read something somewhere about this being the human need for companionship, not necessarily on a bedroom sense, but more in a sense that you are not alone in this world, and you are not the only one who sees the world in a certain way.

    Conversations, though are not without their limitations. One of the problems with conversations is that you don't really know where they'll lead (I guess thats a good thing and a bad thing). Sometimes a joke is misinterpreted; sometimes the other person will just want to vent (which isn't really a problem, unless you entered the conversation with a "no venting here" attitude); sometimes they want to vent about something you did (which can be really unpleasant, and probably not gonna provide that "vacation" type feeling); or sometimes they're (or you're) just not in a talkative mood. So if talking to a friend won't do it, what else is there?

    • Books
    Lately I've gotten a lot of relief from reading books. The titles come mostly as a recommendation after a conversation with friends. After talking about whatever's on our minds, the friend will generally follow up with "you know, you sound like you'd be interested in reading ...". I'm not often disappointed, although I do know of one book that was recommended to me where I probably should have been more considerate of the recommender's feelings when I was asked how I liked it. 

    I haven't decided the type of books that I like best, though, I do tend to get more of a "vacation" from works of fiction. Aside from taking me from the here-and-now (which most books tend to do), works of fiction (particularly sci-fi) have the ability to take me outside even the laws of the universe. Suddenly I can spend 500 pages imagining I'm the son of a Greek god (ala the Percy Jackson and the Olympians series), or a wizard (ala the Harry Potter series), or that I have mutant powers (ala the Gone series). Most of the nonfiction I read gives me different perspectives and philosophies on life. I find those interesting and use them as good food for thought. MLK's autobiography and book "Strength to Love" are great examples of this. So is the book I just finished, James Weldon Johnson's "The Autobiography of an Ex-Colored Man". The main thing that interests me about biographies and autobiographies is the sequence of events that (at least in the writers eyes) helped chisel them into the person they grew to be. And again, thinking about their lives allows me to not think about my own.

    • Music
    Those first three things I mentioned I normally normally take some time. Sometimes I only have a few minutes, if that, and still need to relax. This is especially true when I'm doing something like programming or debugging a program, or even grading. These are tasks that need to get done (hopefully quickly), so its not really easy for me to do work, hold a conversation, or read a book while doing them. So another of my favorite "vacations" is just music. The selection depends a lot on my mood and setting. For example, I try not to listen to Tupac in the office too much (even with headphones) because I don't think my officemates will get the same relief from his lyrics (if they overhear it) as myself, but most of my 70s stuff is fair game. 

    I'm sure that others find this relief in different ways. So I'm curious, what provides a vacation for you?
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.