Rock Band Group Algorithm

I often play Rock Band with my friends, but we have a tough time deciding who will play what part and for how long. Here is what we’ve come up with as requirements

  • Everyone must play every instrument an equal amount of time – To avoid hogging
  • Every time a person is on an instrument, they must play with a different combination of people – To play on other people’s strengths and avoid other’s weaknesses
  • Sitting out many songs in a row is minimized

Does anyone else have other constraints they play with?

Given these requirements, here is what we do:

  1. Lay the 4 instruments out and randomly put 4 people on them, and intersperse the remaining people in the gaps between instruments
  2. Cycle everyone through every instrument and every gap (clockwise), until we arrive back at the initial state
  3. Shuffle everyone like this:
    1. Group the people into 2 groups. Those on instruments (size 4) and those not (size n-4)
    2. Pick 4 people from the non-instruments and randomly put them on instruments
    3. If you have less than 4 people on non-instruments, select random people to stay on instruments, but change their instruments randomly
    4. Randomly permute the remaining people into the open spots
  4. Play another round and then re-cycle


  • Designate one guitar as the Guitar, and one as the Bass. We choose the one with the solo fretboard as the Guitar.
  • The singer picks the song since it is the hardest to do if you don’t know the song.
  • If you fail a song, if you are 50% you move to the next instruments. If you fail again, you add your %s together.
  • We don’t replay the same song that we already played unless we REALLY need to.

This can work for other games, like Guitar Hero or even non-music games. Just change the number 4 to however many slots you have and run it.

I’m interested in how other people do this. I like fairness, but I also like not having to have a complicated system that requires white boards, a master planner, and a dictator.

And what kind of geek would I be if I didn’t have some code to solve this problem

$ python Paul Michelle Martin Melanie Surbhi Ziga Emily
Drums:  Martin
Vocals: Ziga
 Gap:   Melanie
Guitar: Surbhi
 Gap:   Paul
Bass:   Michelle
 Gap:   Emily
Press <Enter> once you finished a round: 

Drums:  Paul
Vocals: Ziga
 Gap:   Surbhi
Guitar: Emily
 Gap:   Michelle
Bass:   Melanie
 Gap:   Martin
Press <Enter> once you finished a round: 

Drums:  Surbhi
Vocals: Martin
 Gap:   Paul
Guitar: Michelle
 Gap:   Melanie
Bass:   Emily
 Gap:   Ziga
Press <Enter> once you finished a round: q

This code doesn’t work very well with 8 people as they will always be playing with the same group, but at least their instruments will change. All other sizes should work well.


File Extensions on the Internet

td.num {
padding-left: 20px;

I had a simple question to which I couldn’t find an answer.

Which file extensions are used on the internet?

So I wrote a little program ( and a half million calls to Google later, we have some interesting data.

First, the raw data:

Top 10:


6 700 000 000


5 980 000 000


1 690 000 000


1 510 000 000


1 380 000 000


565 000 000


385 000 000


298 000 000


242 000 000


199 000 000

Some interesting facts I saw :

  • There are 1305 unused 3 letter extensions out of the possible 17,576. That is 92.5% are already used for something. (There IS a lot of junk thought, so don’t be TOO alarmed).
  • There are a lot of common extensions that I have NO idea what they are for. .e? .nhn?
  • 4x more pages are html instead of just htm.
  • PHP is beating ASP by about 2x.
  • Many servers serve HTML from image extensions, and jpg > png == gif > svg > jpeg > bmp > tiff
  • Naming is mostly not biased by first letter. The empty part is 3 letter extensions starting with y.

  • Only the top 5,000 extensions have more than 1000 pages.

Some caveats

  • This was done in October 2009, things might change. I’ll rerun it if people leave comments.
  • I only looked for extensions up to 4 letters. No numbers or funky symbols.
  • I am assuming the counts on Google’s search results are ACTUALLY correct.

If anyone makes any interesting observations with this data, please let me know and I’ll post it here. Pretty graphs are welcome as well 🙂