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?

    Wednesday, May 4, 2011

    What are you reading?

    Over the past two years, I've really increased my reading. At first it was more of a religious thing - reading the Bible and different philosophical books ("If God is Love" and "Critique of Pure Reason" come to mind). Then it turned to historical reading - reading biographies and autobiographies of the of people I respect ("Born to Rebel", "The Autobiography of Martin Luther King, Jr.", "Dreams From My Father", etc). And while these first two sets of books were enjoyable to read, they were not nearly as much fun as what I read (for the most part) now - just general stuff generally off the NYT bestsellers list or stuff that my friends are reading. I've really grown to appreciate fiction. I grew up watching movies, which are mostly fiction so this is not surprising to me. But movies are so limiting on our imagination. We can't see the picture in our way because the director/producer gives us a picture and says "this is how you're supposed to see it". The beauty of a book is that there is so much left unsaid in the book that its left to the reader to wonder about (different facial expressions, if the speaker uses hand gestures, how deep the speaker's voice is, etc.).

    My reading has really increased over the past few years. Now I can probably get through a good book in a weekend, and another good book if I read during weekdays over lunch or dinner or on a walk. That said, I now get into a lot of conversations about books. A lot of these are of the type, "well if you liked this one, you'd love ...", or "in this book, I could really relate to...".

    I recently had a talk with some friends about reading interests. And it kinda surprised me that these friends were more interested in different types of nonfiction than fiction. I don't want to sound like I'm an anti-nonfiction guy, but I do see certain limitations in nonfiction. My main hindrance (and this is kinda why I diverged into fiction in the first place) is that it seems that most of the nonfiction books that I've read have a format of "here's whats wrong with the world and here's how to solve it", or more particularly "here's whats wrong with you and here's how to make yourself better".

    This certainly doesn't classify all nonfiction books. I remember when I first moved from philosophical books, I read a lot of memoirs and autobiographies because they seemed more practical. Still, these books are sometimes hard to read as well.

    I remember when I was a kid (maybe third grade, maybe younger) and my principal decided to show the movie "Roots" to the entire school in the auditorium. That movie was so hard to watch, yet so hard to turn away. And due to my age, it was hard to discern that these people in the movie are not the people I see in my everyday life. I remember that at the same time, my father had a guy he worked with who would come over and help with his computer. I was young, but I could understand a lot of what he was talking about. He would always compliment me on how smart I was and say things to encourage me. Oh, and this guy was White. Well, I remember when I came home from seeing "Roots", the guy was at my house. I saw him leaving as I walked in the door. I greeted him as he left, then turned, went inside and told my mother, "mom, I hate him".

    I realize today how naive that statement was, but watching "Roots" brought up so much pain and anger that it made it hard to channel it correctly. And when I'm reading some of these memoirs of my heroes, I find myself often having to pause, and calm myself down. Normally I see it as a situation where they are faced with racism and have to deal with it accordingly. In my mind, I'll ask, "how would I have handled this situation"? But when I can't come to a conclusion that yields a different outcome, it gets pretty stressful and all I can do is hope that times have really changed as much as people say they have. I even had this problem with "Kindred" by Octavia Butler, a work of fiction which many of my friends love. I thought Dana handled many of the situations similar to how I would, but the outcomes (particularly when she was whipped) just made me pause. That was one of the hardest books for me to read. I feel somewhat bad, because I know I shouldn't discount a good writer in Octavia Butler because I found the book painful, but I have hesitated to read another of her works.

    To date, my favorite book is "A Lesson Before Dying" by Earnest J Gaines. This is what I look for in most of my books. I like it so much that I use it as a basis for future books. So far I haven't found anything that touches on all the topics that this one does. In particular, I love the debate about Atheism vs Christianity and saving the guy's soul. Thats such a relevant debate, and instead of telling us how to think the book does a good job of describing both sides of the debate and the conflict that the main character is in. I really wish there were more books on this level. Maybe there are, and thats why I continue my search. 


    But I'm curious to know what others are reading. 

    Monday, May 2, 2011

    Is there a right way to feel about tonight?

    So news just broke about the death of Osama Bin Laden. I have many reactions to this, including a sense of a conclusion of the terrorist attacks on America on September 11. But I'm surprised that I don't feel the remorse that some of my friends are showing on facebook. Is it because I never met Osama? Is it because of the thousands of deaths he's responsible for? Or does it mean that I just have a cruel heart?

    These are the things I wonder about as my night comes to a close. People are reminding me of Proverbs 24:17, which says not to rejoice in your enemy's defeat. I understand that, but I wonder how these same people would react at similar moments in American history (the death of Hitler comes to mind).

    I've told myself and my friends that we are at war, and death is a consequence of war. But is this really the case. Was Osama actively engaged in this war, or had he resigned to a life away from it? I remember having actively different feelings when we killed Sadam Hussein. I thought he was more of a casualty of war than an active participant. But for some reason (media and political influence) I feEl like Osama was actively engaged in this. He continuously released tapes threatening America. His terrorist network was still conducting bombings. Does this mean he deserved death? I don't know.

    I had an online conversation about what MLK would say. I have no doubt that he would be against this killing as he preached the power of love in all cases. As much as I'd like to day I believe in the power of love, I am much confused about it. For instance, was David practicing love when he was a soldier for King Saul?

    Or a more specific example that bafled me, say there is a burglar who breaks into my house and wants to rob me and my family. What is the loving thing to do? My first thought would be to try to reason with him, or at worse to use physical restraint. But what if that doesn't work? Should I just turn the other cheek, allowing him to kill me as well as my family? And would that be loving him? I'd think that if I were in his position, I'd expect the person I'm attacking to try to kill me in self defense. So would the universal law say that in this case, its okay to kill in self defense?

    This is the logic I seem to have regarding war. I do not like war. I do not want to be in any wars. But some say that wars are necessary, and if this is the case, and if we believe that what we're fighting for is the ultimate truth, then its hard for me to argue with the consequences of war. Does this make me a bad person? I do think we need to continuously question if this "ultimate truth" we are fighting for is in fact ultimate, though, as many wars have been fought over unnecessary causes.

    Creative Commons License
    This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.