Sunday, February 28, 2010

Saving Green by Going Green

A recent article in the Daily Illini reported on a proposed increase in the "student sustainability fee," a fund which will provide funding for energy-saving initiatives. As an example:

He pointed out that their recent project of replacing Krannert Center’s fluorescent lights with LED’S will pay for itself in three years and save the University roughly $70,000 per year. The committee funded half of the project with a $225,000 grant.

First of all, observe that this statement is mathematically incorrect. If half of the project cost $225,000, then the total cost of the project was $450,000, so it will take about 6.5 years to pay it back at $70,000 per year.

Second of all, observe the economic puzzle. Effectively, the project is an investment with a guaranteed annual rate of return of $70k/$450k = 15.5 percent. So as long as the market rate of interest is less than 15.5 percent, which I assume it is, the optimal strategy of the university is to borrow money to finance this project, and even after paying back the interest they will actually have more money - so they should do that even in the absence of any additional funding from a "sustainability fee."

(Here is an economics article discussing similar anomalies, mostly in the context of individual purchasing decisions like whether to buy a new refrigerator.)

Wednesday, February 24, 2010

Gaming Math - Problem 14

Okay, as promised, here's the one about eigenvectors:

Problem 14: Community Events

The "World of Warcraft" tabletop roleplaying game is based in part on the computer game of the same name, but also includes other features, including rules for in-game towns and communities. In the game, communities have a "community behavior map" consisting of a list of attributes, including "wealth", "greed", "happiness", "disaster", and so on, each with a numerical value. Different events can affect different attributes. Also, there are "links" going from one attribute to another, and each link has a different "intensity," which can be positive or negative. If a link goes from A to B with intensity I, then whenever an event affects attribute A, attribute B also changes by an amount equal to the amount attribute A changed, times the intensity of the link. For example maybe "wealth" and "happiness" have a link with an intensity of 0.5. Then if a group of adventurers brings back lots of treasure, increasing the "wealth" by 10, the "happiness" will increase by 10 x 0.5 = 5. Of course the intensity can be negative - an increase in the "disaster" attribute will probably reduce other attributes.

The rules specifically state that impact is only felt one link away from a factor. For example, suppose attribute A is linked to B and attribute B is linked to C. If an event affects A, then B will be affected by the link, but that change does not then continue on to affect C through its link. Suppose, however, that this rule were removed; you calculate the changes based on the initial event; then the changes based on the links; then the changes caused by the links from those links, and so on.

What conditions on the links and their intensities are necesary to ensure that this process always converges?

The answer is here.

Monday, February 22, 2010

Gaming Math - Problem 13

I previously wrote on this blog that I am talking two courses this semester: one on scientific computing and one on planning algorithms. Coincidentally, I have recently played a couple games that offer nearly perfect examples to illustrate concepts that we are learning about in these courses. Here is the one about scientific computing the other one will come up soon.

Problem 13: Characteristic Characters

In the HERO System, player characters are defined in part by a list of numerical "characteristics," such as strength, intelligence, dexterity, defensive capability, etc. When creating characters, players spend "character points" (CP) to purchase characteristics. Each characteristic costs a different number of CP per point of the characteristic. Most characteristics only cost 1 CP per point, but some cost more. For example Dexterity costs 2 CP per point because it affects important combat factors such as initiative, and Speed costs a whopping 10 CP per point because every point of speed increases the number of "phases" you get to perform actions each turn. For example if I were to buy 15 points of Dexterity and 5 points of Speed, that would cost (15*2) + (5*10) = 70 total CP. Note that you ARE permitted to buy a negative amount of a Characteristic.

The rules for purchasing Characteristics changed significantly between the 5th edition and 6th edition of the game. In 5th edition, Characteristics were divided into two categories: "base characteristics" and "figured characteristics." Base characteristics were purchased as described above. However, "figured characteristics" each had a base value that you got for free, that was a linear function of the values of the base characteristics you purchased. For example, let's say "maximum hit points" had a base value of (3 * Constitution + 2 * Strength). Then if you bought 15 Constitution and 10 Strength, you would get (3*15 + 2*10) = 65 hit points "for free", and you could then buy more for a given cost in CP per point (or buy a negative amount, effectively "selling back" the hit points you got for free.)

In 6th edition, figured characteristics were eliminated; they instead became treated the same way as base characteristics - you don't get any "free points", you just have to buy them up as normal. Some of the CP-per-point costs of the various characteristics were altered to compensate.

Now here is the question:

Prove that regardless of what the costs and "figured characteristic functions" were in the old system, that it was possible to modify it - changing costs but eliminating figured characteristics - such that every possible combination of characteristics costs exactly the same under the new system as under the old system.

The solution is here.

Saturday, February 13, 2010

More politics as usual in Illinois

Recently, the primary elections were completed. Pat Quinn, the incumbent governor (he was Blagojevich's lieutenant governor) won the Democratic primary. His running mate in the general election was going to be Scott Lee Cohen, but he had to drop out once it was revealed that he had engaged in some less-than-savory action of his own.

Pat Quinn said that he didn't know anything about the incident with Cohen until after they had become running mates. Admittedly he did not choose Cohen to be his running mate; in Illinois there is a separate primary for governor and lieutenant governor, and the winners of each join forces in the general election. Perhaps Cohen was actually a Republican sleeper agent tasked with infiltrating the Democratic primary and winning so as to discredit the Democratic candidate. However, there were five other candidates in the Democratic race, so one would expect that they would have brought Cohen's incident to light in the primary, when they were competing against Cohen. So maybe they are the real sleeper agents. (As you can see, this is another instance of realism in board games. In the Battlestar Galactica board game, players are tasked with finding out which among their number is secretly a Cylon. In real-life politics, politicians have to find out who is really working for them and who is secretly plotting against them, and that is not always simple)

Exciting Combat Action - After Action Report

So today was the "big day" with all the action. The Belegarth event was quite exciting. There were well over 100 people on the field, and it was indoors so it was close quarters. That meant that you had an unbroken line of people stretching from one end of the field to another. This made archery much different - easier to hide behind the lines to avoid getting hit, but trickier to find lines of fire that will hit enemies without being blocked by your own guys. Also you run out of arrows pretty fast, so you have to look on the ground to find arrows to pick up. But overall the event was really cool.

Then I got dropped off at the game store to play the superhero game. Unfortunately three out of the five people couldn't make it, so rather than run a whole adventure he just ran a single practice combat to get us used to the combat system (since we hadn't played Hero System before). He pit us against two opposing villains: a "blaster" (guy who shoots energy blasts) and a "brick" (strong and tough guy.) My teammate was a blaster the ability to fly and teleport. The first round of the game my teammate teleported over to the enemies to shoot them at point-blank range. He hit one of them, and tried to use the knockback to send him flying into the other one, but missed. Then the enemy brick got up and ran him over using a "Move Through" attack, knocking him unconscious. In order to save my teammate, I tried to move my support robot over and use its "Aid" power on him, but it would only work if I "hit" him with my Aid "attack." I didn't give my support robot any OCV (Offensive Combat Value; the stat that determines how good you are at hitting people) because I thought that it's an auto-hit if the target is willing. It is, but in order for the target to be "Willing" he has to be conscious. So I missed witht my Aid, but I has another trick up my sleeve - I moved my combat robot over and activated his "Flash" attack to blind both enemies. While the enemies were stuck defenseless (and mostly attack-less, too) since they couldn't see us, I used the robot to blast the enemy brick into oblivion while I myself used my "Telekinetic Field Generator" to telekinetically grab the blaster so he couldn't do anything. Finally the enemies recovered from the blindness but by then the battle was a foregone conclusion.

Wednesday, February 10, 2010

Exciting Combat Action

A few exciting things are coming up this Saturday. First I am going to Wolfpack Opener, a Belegarth fighting event. Then I am going straight to Armored Gopher Games for the first session of our superhero adventure game. Wil my superior archery skills dominate the battlefield at Wolfpack, or will the enemy break through our lines and overrun me? Will "Robotic Man" and his army of flying robots defeat the forces of evil, or will the enemy discover and exploit his secret weakness? Full reports coming up soon after these events!

While we are on the topic, remember that back at Maryland I wrote that students didn't have to leave campus to participate in exciting combat action. Apparently, the same thing is true at UIUC.

Thursday, February 4, 2010

Winter War, Part II

Battlestar Galactica, Game 2:
On Sunday Morning, I played Battlestar Galactica again. This game there wasn't nearly as much intrigue as the first one. However, at the beginning of the game, we got unlucky draws from the Crisis Deck and drew lots of cylon attack cards, so we were soon mobbed by Cylon ships and boarding parties. Then we got a crisis card that gave the Admiral (Helena Cain) a chance to take the title from the President (Laura Roslin). In this game, Roslin is actually one of the worst Presidents because she has to discard two skill cards every time she activates a location - and the President is going to be activating the "President's Office" location a lot to draw quorum cards. So I thought Cain made the correct move by taking it (there was no need to worry about her being a Cylon - it was a 4 player game, so there was only one cylon, who had already revealed himself). But Roslin wasn't very happy, and used her once-per-game ability to look at the top four quorum cards and play one in order to put Cain in the brig. Then later she spent more cards getting Cain out of the brig, and giving herself the President title back. All this distracted us while the Cylon was able to advance the boarding parties up the "Boarding Party Track" and get to the end to kill us.

This game is a starship battle game. The scenario was that there are two players, the attacker and the defender. The idea is that the defender is defending a "planet" (not actually on the game board, but supposedly off behind his side of the game board) and the attacker is trying to destroy it. The attacker had far more ships (1000 points worth of ships to the defender's 600) but the defender has time on his side - if the attacker doesn't kill the defender within 5 turns, the defender wins. In the first game I was the defender, and soon realized that if I engaged them head on I would be at a large disadvantage, and figured that the best option was to scatter, forcing the enemy to chase me down. The person running the game said that that option wasn't allowed, because the point was to "defend the planet" and the planet would be lost if I moved far away from it.
Him: If you just run away over to the other end of the board, the enemy ships will just ignore you and attack the planet, so you don't win.
Me: So you're saying that if the enemy reaches mu edge of the board, then I lose?
Him: No, it's just that you have to stay and defend, not run away.
Me: I'm still confused. I mean, if the planet is off my edge of the board, can I go sideways to the corner, and I'm still near the planet? Where exactly is the boundary that I have to stay inside?
Despite the fact that he was never explicitly clear on where the boundary was , I was still able to damage the enemy capital ship's engines, then back up each turn, making it so by the time his main capital ship got into range it was too late to make a difference.
We had time for another game so this time I was the attacker. I knew that I would have to strike hard and fast in order to win, so I chose ships that had powerful engines and also ships that had fighter wings (since fighters move fast and so they can close distance). This strategy worked - my fighters surrounded the enemy ships and too one of them out, then I hit his big capital ship with my powerful "spinal mount" weapon, and he conceded. My main comment on this game was that 5 turns seem way too short, because it takes 2-3 turns just to get in range to even shoot most of your weapons.

Miniatures Wargame:
I forget exactly what this game was called, but it was a miniatures game where there were "humans" fighting against "demihumans" like elves and dwarves. The backstory was that humans had invaded the demihumans' lands and cut down their trees, so they were fighting back. I played the humans. The way the game worked was interesting. There were a few kinds of units. Aside from the basic infantry, cavalry, and archers, there were the following special units:
1. Siege weapons, such as cannons. These have a "bowling ball" effect, meaning that during the "missile fire" phase when you fire them, you draw a line out to maximum range in the direction the weapon is pointing, and you made an attack roll against each model it contacts. Also, it has an interesting rule: if the first unit that the line touches is a unit that's engaged in melee combat, the shot has no effect. But if the first unit in the line is a unit not in melee, it will continue through to hit units in melee. I asked the person running the game if it could hit friendly units, and he said yes. The next turn there were lots of enemies lined up perfectly for me to shoot at, but they were all in melee. So I deliberately positioned the very corner of a friendly unit in the line of sight, hoping to sacrifice that one model to allow the shot to go through. He said that it wasn't allowed to do this (I think he interpreted my question as what happens if the friendly unit is one of the later units in the path, not if it's the first unit.) Also another thing is that the sequence of play is missile fire, then movement, then melee, then morale checks, and you aim your cannons during the movement phase. So during the movement phase you have to try to predict what is going to happen in the melee phase and who will be viable targets when the missile phase comes around again. Also sometimes you want your units to fail their morale checks, so they will back up and the enemy will be a legal missile fire target.

2. Spellcasters - each side has a wizard and a cleric. At the end of each turn, each spellcaster can cast one spell from a list, and they can cast it anywhere they can see. Also the cleric can resurrect any one dead model on the battlefield. That again makes movement interesting because you have to try to position your spellcaster so they can cast a spell at the target they want to cast. One of the mage's spells is a "teleportation" spell that will teleport a friendly unit to anywhere within the caster's lne of sight. One thing you have to remember to do is to avoid letting your enemy teleport their unit right next to your caster so they can kill your caster. One time my ally needed help on the other side of the battlefield so I carefully positioned my caster to have a line of sight over to the other end of the battlefield to teleport my unit there, but at the end of the turn I realized that I didn't have teleport, because I controlled the cleric, not the mage.

Anyway this was a fun game. It was 2 on 2 - each player controlled half their side's army. I controlled he right half and my ally controlled the left half. The battle was on and I successfully took control of the right flank, while the enemy pushed my ally back on the left flank, leaving his large archer unit exposed. However, strategic spell use on our part enabled us to block him from attacking that flank for a couple turns, letting me complete the conquest of the right flank and start to wheel around. As I did that, I realized the enemy had left his cleric in the open, and I ran him down. At this point, the enemy counted up the number of units each side had, realized they had no chance for comeback, and conceded.

Monday, February 1, 2010

Winter War, part 1

Last weekend I went to Winter War, a gaming convention held every year in Champaign. There were games going on from Friday evening through Sunday evening so there were plenty of chances for exciting action. Here are the games I played:

Age of Conan: This game is a 4 player game set in the time of Conan, and each player controls a different kingdom and attempts to get victory points by conquering other provinces, completing special objectives, collecting gold, and taking control of Conan on his adventures in order to collect "adventure tokens" representing the three types of rewards - monsters, treasures, and women. At the beginning of the game, when our armies weren't big enough to conquer anything, I took the initiative to focus on collecting adventure tokens and get ahead in that area. Most of the other players tried instead to send out emissaries to ally with nearby provinces in order to acquire gold. In this game whenever you try to ally with or conquer a province, there is a die roll to see if you succeed, and there are "sorcery tokens" that let you reroll die rolls. One thing that was not clear from the rules is whether or not if you use a sorcery token and don't like the result of the reroll, you can use another sorcery token to reroll it again. The rules say that "only one sorcery token may be used per roll" but other players interpreted that as meaning that once you use a sorcery token to reroll, the reroll is a "different roll" so you can keep using sorcery tokens. This interpretation actually helped me at the beginning, as other players wasted lots of sorcery tokens on rolls that I could clearly calculate had very little chance of success. In the middle of the game, I used my adventure tokens to "bid" for an artifact, the Sword of Atlantis, that significantly improves offensive capability. I used this to conquer several territories and get ahead. Unfortunately near the end of the game, I overextended myself and got myself caught between two opponents, and got attacked from both sides and lost lots of territory. With time running out, I had an army stranded in enemy territory, and I had to strike out and make a desperation move to attack the nearest enemy territory hoping to conquer it. First I had to get rid of the enemy that was there to turn it neutral, then do a "campaign" to conquer it. I expected the initial siege to be a pushover because I had a bigger army and the Sword of Atlantis, but it didn't turn out that way. During the siege, there were three times where my opponent had a 1 in 27 chance of rolling well enough to kill one of my guys - and he succeeded two of those times. Fortunately I managed to get him, and with just two out of five soldiers left, completed the campaign on my last turn of the game, which gave me just enough victory points for the win.

Heroscape: This is a hex-based collectible miniature game where you build your army with points, and unfortunately this did not turn out as favorably. The mission was a 3-on-3 battle where there was a central castle in the middle that we were both competing for. There were six premade armies that we drew from, and the army I drew was the only army with no ranged attackers. The opposing team managed to get inside the castle and shut all four doors in the first couple turns, and then they could get on the castle walls and attack us with large height bonuses. We had no flying creatures, so the only way it would even be possible for us to retake the castle is to break down the doors, which have extremely high defenses (and of course to break down the doors you have to stand in front of them, out in the open, which is a very vulnerable position). Also my army started in the corner opposite from where all the action was, so by the time I was even able to get my army over to the action (remember, I had no ranged attackers, so I had to close to hand-to-hand distance) the battle was basically over (we lost).

Battlestar Galactica: This board game, based on the television series, features players as crew of the Battlestar Galactica trying to get to Kobol. However some players are secretly Cylons, robots disguised as humans that are programmed to destroy humanity. At the beginning of the game each player is secretly dealt a "loyalty card" indicating if they are human or Cylon, and then halfway through the game there is a "sleeper agent phase" where everyone gets another loyalty card, so you can think you are human and then turn into a Cylon. Each player chooses a different character from the show, and each character has three special abilities - one which can be used every turn, one which can be used only once per game, and one which limits them in some way. I chose Gaius Baltar, whose once-per-game ability is "Cylon Detector" which lets him look at any other player's loyalty cards. Also in this game there are two special titles - President and Admiral. The President gets control of the "quorum cards" which can help humanity deal with problems (or which can be used by a clever Cylon to sabotage them), and the Admiral gets control of Galactica's nuclear arsenal as well as choosing which of two destinations they jump to at each hyperspace jump. Also, some "crisis cards" come up that force the President or Admiral to make a decision. I started out as the President and Helena Cain started out as Admiral. Near the beginning a crisis card came up that forced both me and the Admiral to discard most of our "skill cards" and draw "treachery cards," a type of skill card that is useful mainly to Cylons. A couple turns later a crisis card came up that forced the Admiral to make a choice: either the Admiral and President each discard two skill cards, or the President has to give up his title to the Admiral. I argued that Cain should choose the first option: it's too dangerous to have all the power in the hands of one person if he turns out to be a Cylon, and discarding cards would give him a chance to prove his loyalty to humanity by discarding the treachery cards. I threatened to check him using my Cylon Detector:

Baltar: If you make me give up my Presidency, I'm going to check you. Normally I wouldn't use my power until the sleeper phase (because that way I get to see both loyalty cards rather than just one) but this seems really suspicious.

Cain: I have be best interests of humanity at heart. It's always a good idea to have the titles for yourself.

Baltar: Actually, let's see. I think I'll give you another chance. We're about to jump, so if you pick a 1-distance then I'll check you, otherwise maybe not. (Destination cards have "distance" values from 1 to 3 that indicate how far you've jumped. In general you want to jump as far as possible, so picking a low distance destination helps the Cylons.)

Another player: See, Baltar, you're not very decisive. I think it's good that we don't have you as President.

For the rest of the first half of the game, me and Cain want back and forth accusing each other of being Cylons. After the sleeper phase I checked her - "nothing personal," just that she could have gotten a cylon card and I want to make sure. Guess what, she was human all along. The game continued with a race to the finish line, and we eked out a victory.
The game is so fun that it makes me want to watch the show. Unfortunately, the DVD box set costs $250, so I'm not sure if that will happen...

(Part 2 coming soon!)