Just another WordPress.com site

Archive for July, 2011

Help us rank character cards in bang

Hey All,


Adam and I are working on a ranking system for character cards to make the AI work well. The thing is, I am not 100% on the ordering of the character cards, so if you play Bang and have some thoughts, please share.


I found that poll on the Internet and used it as a starting point and from there broke it down into the following groups, going from best to worst.

1 Willy the Kid, Slab the Killer, Calamity Janet

2 Black Jack, Kit Carlson, Suzy Lafayette

3 Bart Cassidy, Pedro Ramirez, Jesse Jones, Jourdonnais

4 Lucky Duke, El Gringo, Sid Ketchum

5 Vulture Sam, Rose Doolan, Paul Regret


I am not 100% sold on this, but its a start. I am looking for any thoughts you might have on the ordering. There are no requirements for number of rankings, so if you think that we should have 6 or 7 groups instead of 5 that is fine, as is having 4 groups instead of 5.

The approach we are taking here is to tier the quality of the card, so the AI has a better card, so we don’t just randomly pick and end up with Vulture Sam over Slab the Killer. Within each group we will break ties randomly, so it is very important to have a good break down here.

It is also worth noting that we don’t want to have too many tiers, because if we just ordered them, then you would never have a chance of playing Rose Doolan or Paul Regret (which ever one you defined as the worst), so I think the grouping and deciding with in groups randomly is best, but if you have a case against that approach or really any thoughts on it at all, let me know.


Andy and Adam



Evrry Day I’m Shufflin’

Hey-o Internet!

Hot sexy programming date got moved to a Monday, but was still pretty awesome. There is not a whole ton to tell, but we finished up the character cards and job cards, so we have all 3 decks of cards set.

Adam also took the lead (hey, I am terrible at programming and he is a boss at it) on the shuffler.

After reading around a bit, we decided on the Fisher-Yates  shuffle.


The wikipedia article goes into more detail and does a good job of explaining it, but it really just boils down to assigning a random number (some interesting concerns there. We don’t really deal with it and I believe it is a non-issue for us, but achieving randomness is a lot trickier than you might expect: see this xkcd blog post for some randomness http://blog.xkcd.com/2010/02/09/math-puzzle/) to each card and then order them based on that. I was surprised to see how intuitive the shuffler ended up being. I sort of figured it would be more complicated.

Currently we have 3 decks of cards and the ability to shuffle them,so next week we are going to create a player, which is a job card, a character card, a life total, a standing board (that is cards they have that stay in play) and a hand. I also started looking into sorting out a reasonable approach to the artificial intelligence, but that won’t be for a bit yet.















Playing Programmers

Hello Interwebs!

Statistics project is 1 meeting away from me having to write a paper, but an update is not worth it, since its just obnoxious technical stuff and bad things that happen when there are 30 instances of something happening in a 15k+ individual dataset, BUT I did get a few things done.

My old undergrad roommate and I got together on Saturday to play programmers. He majored in computer science in undergrad, so lets just say he did a lot of the programming and I was more of a “big picture” guy, but it was a good, productive time anyway.

Our goal is to program the game Bang! (http://en.wikipedia.org/wiki/Bang!) in c#. Its a really fun game, but has some balance issues and I think bootstrapping (http://en.wikipedia.org/wiki/Bootstrapping_(statistics)) is a way to balance it and get a better idea of what is going on. For now, just imagine playing hundreds of thousands of games of Bang! and recording their results to get a distribution (breakdown) of win rates, what cards were used, etc. We are a ways from the actually bootstrapping, so I won’t focus on it here, but you get the idea.

On Saturday we set out to make the deck of cards for the original game:  http://www.emilianosciarra.net/ENG/playing_cards.html


It took a fair bit of time. We ended up having 1 typo that led to a null reference in the array we were using that took a long time to catch, but we fixed it and currently have the main deck of cards coded.

One thing we came across that I have run into before and always find interesting was some trouble with referencing an object. It tripped up Adam a bit, so maybe its not just my general lack of experience with programming, but I always find it super frustrating.

Consider what we were doing: defining 82 cards and referencing them. We started by creating card1 = card info, card 2 = card info, etc up to card 82. Now if you wanted to systematically reference these cards with a loop, the approach that comes to my mind is just loop through all cards something along the lines of card*, where * is the number you want. You can do this with strings, where you combine outside variables with text and such, but you can’t (rather we couldn’t figure out how to) get it to reference objects in this way. So you could create a variable that was card1, but the way it was combined created a string and now a reference to the card1 object we created earlier. It was not a super hard to fix, we just had to use an array (http://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx), but it is definitely the thing that frustrates me most about programming. I am pretty good at thinking like a computer (in loops, if statements and such), but sometimes how I think about it does not translate to the reasonable approach I was taking.

After reading around a bit, I have a better idea of what it is hard to deal with the approach we were using and why they have the work around options they have. I think things problems like this are really how you learn how to program in a specific language, it seems reasonable, but is not, so go find a functioning way.

Next weekend we are making a shuffler and adding in the character cards and role cards. I might post a bit more on the information we are keeping track of with the cards as well, but I left my notes on it at Adams and doing it from memory seems silly.

Tag Cloud