Monday, August 13, 2012

Gridiron Solitaire #16: A Big Week

I wrote last week about the process of designing and implementing the new drive meter. Fredrik was able to make four or five iterations of the art in only a few days, so by Friday, everything was basically completed.

Here's a screenshot (you can click on it to get a larger view):

There are two plays left in the drive (two stars on the meter). The CPU called a pass (see the quarterback in his throwing motion). The human player called "defend run" (which is why he's down in a three-point stance).

What I particularly like about this new "meter" is how much additional information it can give to the player. For instance, here are all the possible poses:
--running back (running)
--quarterback (throwing)
--quarterback (throwing Hail Mary)
--wide receiver (running)
--defensive lineman (3-point stance, run defense)
--linebacker (hands on knees stance, pass defense)
--defensive player running
--defensive player preparing to tackle

These poses give me an opportunity to tell mini-stories, essentially, that describe the progress of the drive. At the beginning of each play, the play calls determine the starting pose of the players. As cards are played and players move toward each other, there's a separate pose for running backs and wide receivers. When you see your defensive player "break down" into the prepare-to-tackle position, that means you're one more card play away from making the tackle.

When you see the tackle and hear the cannon, you've stopped the drive.

For months, I thought that the defensive "stop the drive" meter was the weakest design element in the game. It was a problem. Now, though, I believe the new "meter" is one of the strongest elements, because of how well it evokes real football.

I had one other big element I worked on last week, and that's the schedule.

16-team round robin schedule with balanced home/away? Easy, right? Interestingly, it's not. There are some websites with free round-robin schedules, but they're not very good. So you can get a true round-robin schedule, but some teams will play at home/away three (or even four) weeks in a row.

So, to sum up, the schedule sucked. I knew it needed to be improved, and I also knew it needed to change from year to year. Sports games with unchanging schedules get annoying quickly.

The problem, of course, is that I had no idea how to create the schedule. It seemed to be a daunting problem, mathematically, because I didn't even understand how the creation process would work.

Fortunately, though, while Googling this subject for the tenth time in the last couple of months, I stumbled onto this site: NRICH: enriching mathematics. The subject? "Round Robin scheduling: Even number of teams."

Normally, this wouldn't help much, because I wouldn't understand the damn explanation. This time, though, "Arunachalam Y." explained the "polygon method." Here's an excerpt:
Let us schedule a round-robin tournament for 8 teams numbered from 1 to 8.

Draw a regular (N -1) sided polygon (i.e., a heptagon for 8 teams). Each vertex and the centre point represents one team.

A seven-sided polygon with numbers at each vertex.

Draw horizontal stripes as shown below. Then, join the vertex that has been left out to the centre. Each segment represents teams playing each other in the first round.

Seven-sided polygon with horizontally opposite vertices joined by lines.

So (7, 6), (1, 5), (2, 4) and (3, 8) play in the first round.

Rotate the polygon 1/(N-1)th of a circle (i.e. one vertex point). The new segments represent the pairings for round two.

Wow--even I can understand that.

Why does this work?
The restriction that no vertex has more than one segment drawn to/from it ensures that no team is scheduled for more than one game in each round.

Restricting ourselves to horizontal stripes ensures that no segment is a rotation or reflection of another segment. This means that no pairing will be repeated in a future round.

Once I realized that, against all odds, I actually understood this, I tested it to see if it would work with 16 teams. It did, and the concept was so clearly explained that I should have been able to code it in about an hour. I didn't, because I'm a hack, but several hours later, it was in, and it works. So there are now 16 possible schedules, with a random seed generated each year to assign a position to the first team.

Yes, it would have been theoretically possible to assign each team a random position on the polygon, instead of going in order, which would have meant an infinite number of possible schedules, but 16 will work just fine.

Again, like many of the other things I discuss on Mondays, changing the schedule each year probably seems like a small detail. And it is, but it's the sum of the attention paid to the small details that I hope turns Gridiron Solitaire into a special game.

Site Meter