2 – 14 Sept: Mostly about food

Last week, I did make this casserole.  Yes, a casserole using a rue and cheese in the binder instead a can of condensed soup.  The casserole was pretty good, but then it would be considering all the cheese in it.  It was easy to overcook the broccoli.

After I made that lovely schedule with all the regular housecleaning chores, I promptly ignored it last weekend.  no baking soda to make a drain volcano, and both Sprouts and Trader Joe’s sell them in sizes fine for cooking, but not for cleaning.  I’ll buy in bulk in my next Amazon order.

Well, I did do this weekend’s task: clean Bunbury’s room.  A lot of shedding and “territory marking” has accumulated, and it was good to clean it out.  I also spent this morning volunteering at SDHRS, cleaning hay and poop out of rabbit pens.  (The trick is to first sweep up the easy to reach poop so you can safely walk around without accidentally treading on it.)  It was a poopy Sunday.

Meanwhile, my ramekins arrived!  There were extra yolks, so let’s make some creme brulee!  With soy milk instead of cream.  They were good, and the fat is not missed.  Neither Sprouts nor Trader Joe’s has gelatin so, to make panna cotta, guess what else is going is in the next Amazon order?

This weekend I hit up Kiki’s Place (good fish tacos, with more fish than batter, and they have this one awesome red creamy hot sauce) and Tandoori Hut for the lunch buffet (goat curry and tandoori chicken were great, chicken tikka and mango mousse was good, it’s weird that they don’t have chai).  Meanwhile, Loving Hut now considers me a regular; they accidentally forgot to charge for a Peaceful Pink this last time, and the guy told me to just add it onto my next bill.  (Aside: Pretty sure I could make a Peaceful Pin.  In fact, any non-dairy smoothie is basically soy milk, juice, and fruit.  Remove the fruit, and you have a drink that doesn’t need a blender.)

Okay, stuff unrelated to food.  I finally made a budget, and it turns out that even without my end-of-the-year bonus and higher housing costs, I’m still in the black.  Yay.  I didn’t realized I spent that much on games though.  Now to get my investments in order…

But this week there was another Humble Android Bundle, and I have to support Android game developers (by buying their games at heavy discount… whoops).  My favorite of the lot is Color Zen (nice aesthetics, puzzles that require some thinking) even though the it is similar to KAMI.  Other notables are The Room II (nice exploratory puzzles, as usual, though I’m having trouble getting it to save my progress), Tiny Bang Story (this is my first hidden object game, at least it’s hand drawn), and Kingdom Rush Frontiers (one of the few tower defense series I will give the time of day).

This got me playing some other Android games that I’ve let languish on my phone.  I got Bullseye Boxing because of a Pocket Tactics article.  It reminds me of Devil’s Attorney, and I ended up playing that instead.  I finally beat Devil’s Attorney on hard by maxing out my Materialism stat asap and writing a Python script to use dynamic programming to find strategies that optimized the expected number of actions to finish off a target.

Speaking of writing programs to do my thinking for me, I bought Calculords, which is by far the nerdiest game I have installed right now.  However, while finding expressions in order to play cards isn’t hard, finding a partition that uses all the numbers is non-trivial, and I wrote a program to help me with that.  Except it runs incredibly slow with 7 or more cards, so I may have to rewrite it.

I also finally played Ascension.  Like Star Realms, it also has semi-permanent cards that stay in play until removed, blurring the line between deck-builders and tableau games.  This gives me ideas for my Narbonic card game, which I at first envisioned as a tableau game, but a deck-builder is an interesting mechanic for how a player develops their engine.  Combine them for the best of both worlds.  Lab equipment or personnel can be semi-permanents.  They may get damaged/injured during a fight and get sent to the discard deck until they’re repaired.

Speaking of deck-builders, I’ve been thinking about my Quidditch game.  The thing about sports games, compared to other games, is that there’s little sense of progression: generally, both sides play about as well at the end of the game as they do at the beginning.  If anything, many games model attrition as the game goes on (literally, in Blood Bowl; many racing games track wear as the race continues).  So what if, in Quidditch, each player could modify their deck to react to what their opponent was doing.  Oh, right, that’s a deck builder game.  Though I don’t know if I want a straight up deck builder where players, say, play 2 chasers for enough agility points to buy a better chaser card as accumulating slightly more powerful cards doesn’t have a strong visceral feel to it.  I still want players to move the quaffle around the pitch and counter each other’s moves.

Finally, I finished Sorcery, Part 1.  First I had to write down the the spellbook to make it easier to look up spells (honestly, do they expect you to flip page by page through the book to find spells?).   I’m so used to adventure games beating me up and teaching me lessons before I could advance that I was surprised how easy it was to finish.  I did rewind twice: once when I lost all my equipment in a village, and another time to the black lotus.  But the rewind feature allowed me to pick up my game again in seconds.  Nice feature.

I also played the demo for Pixel Defenders.  It’s like Triple Town, where you place pieces into a map and combine 3 things to make an upgraded thing.  Except instead of annoying bears getting in the way of matches, we husband actions used to slow down and defeat monsters.  It is tempting to buy the full game…

An idea I’ve been kicking around for a possible mobile game is an old idea I’ve had since middle school based off the game Hunt the Wumpus.  Except instead of wandering more-or-less blindly, you’re mapping out a 3-dimensional cavern and can deploy sensors (active and passive) and traps.  Meanwhile, an opposing team is doing the same.  But to do that, I’ll have to figure out how to procedurally generate cavern artwork.

I haven’t been keeping up with DDP Yoga.  For a few days after that first session, my back was really tense and aching.  I think all that “activating your muscles” just made them knot up.

Games in the Classroom #4: Stone Age (Part 1)

Q1. You’re playing Stone Age.  You place 2 workers on gold, 2 on brick, and 1 on food.  What is the expected amount of each resource you’ll collect?

A1.  Let G, B, and F be, respectively, the number of resources we get.  Let X, Y, and Z be the rolls.

  • P(G=0) = P(X in {2,3,4,5}) = 10/36
  • P(G=1) = P(X in {6,7,8,9,10,11}) = 25/36
  • P(G=2) = P(X=12) = 1/36
  • (AN: Sorry, can’t use summation notation in wordpress) E[G] = 0 P(G=0) + 1 P(G=1) + 2 P(G = 2) = 0(10/36) + 1(25/36) + 2(1/36) = 27/36 = 0.75 gold

Similarly, we find E[B] = 49/36 = 1.36 brick and E[F] = 9/6 = 1.5 food.  This a simple exercise in expectation for discrete random variables.

Q2. You have the same situation as before, but now you have a single tool.  Assume you roll for resources in order: gold, brick, food.  Also assume you use the tool if it will allow you to gain an additional resource but otherwise not.

A2. Let event TG be true if we have the tool before rolling for gold, and similarly for TB and TF.  (One of the problems with probability notation is using capital letter for both events and random variables.  Have to think of an alternative.  Maybe Roman and Greek letters?)  Furthermore, let TGc be the complement of event TG, and similarly for the others.  We have already calculated:

  • E[G|TGc] = 3/4
  • E[B|TBc] = 49/36
  • E[F|TFc] = 3/2

We should recalculate the expectations given the tool (the calculations are very similar to the above, so they’re omitted):

  • E[G|TG] =  33/36 = 0.92
  • E[B|TB] = 59/36 = 1.63
  • E[F|TF] = 2

Also, we should calculate the probability that we retain the tool after rolling for each resource:

  • P(TB) = P(X not in {5,11}) = 30/36
  • P(TF) = P(TF|TB) P(TB) + P(TF|TBc) P(TBc) = P(Y not in {3,7,11}) P(TB) + 0 P(TBc) = (26/36)(30/36) + 0 = 65/108

That last line comes from the law of total probability in conditional probability since {TB,TBc} is a partition of the event space.  Finally, we can use the analog of the law of total probability for condition expectation:

  • E[B] = E[B|TB] P(TB) + E[B|TBc] P(TBc) = (59/36)(5/6) + (49/36)(1/6) = 344/216 = 1.59 brick
  • E[F] = E[F|TF] P(TF) + E[F|TFc] P(TFc) = (2)(65/108) + (3/2)(43/108) = 389/216 = 1.80 food

In summary, by adding 1 tool, a player in this situation can expect 0.17 extra gold, 0.23 brick, 0.30 food, which I estimate to be worth 2.6 pips that turn, and you get to use the tool every turn.  This is why tools are a good investment.

Q3. Instead of having 1 tool, say you now have 5 and then you roll a 7 for gold.  Do you use all 5 tools to get an extra gold, or do you save the tools for the other rolls?  Because it possible to get as many as 8 pips (1-2 tools for one brick, 3-4 tools for two food).  This is a trickier problem which I’ll save for Part 2.

Games in the Classroom #3: Can’t Stop

Here’s an example of using conditional probability to solve for a result in Can’t Stop.

Q. What is the probability of rolling at least one 7?

A. Let A, B, C, and D represent the four dice rolls.  Because of symmetry, it doesn’t matter what A is.

There are 3 cases to consider for B:

  1. B = 7 – A, a 1-in-6 probability, in which we have failed to not roll a 7.
  2. B = A, a 1-in-6 probability.
  3. Otherwise, a 4-in-6 probability.

Therefore, after 2 dice, we have 3 cases:

  1. 7 has been rolled: probability 1/6
  2. Only 1 unique number has been rolled: probability 1/6
  3. 2 unique numbers have been rolled (that don’t add up to 7, which I’ll leave implied): probability 2/6

Let’s add a third die:

  1. P(7 has been rolled after 3 dice) = P(7 has been rolled after 3 dice | 7 has been rolled after 2 dice) P(7 has been rolled after 2 dice) +  P(7 has been rolled after 3 dice | 1 unique number after 2 dice) P(1 unique number after 2 dice) +  P(7 has been rolled after 3 dice | 2 unique numbers after 2 dice) P(2 unique numbers after 2 dice) = (1)(1/6) + (1/6)(1/6) + (2/6)(4/6) = 15/36
  2. P(1 unique number after 3 dice) =  P(1 unique number after 3 dice | 1 unique number after 2 dice) = (1/6)(1/6) = 1/36
  3. P(2 unique numbers after 3 dice) =  P(2 unique numbers after 3 dice | 1 unique number after 2 dice) P(1 unique number after 2 dice) +  P(2 unique numbers after 3 dice | 2 unique numbers after 2 dice) P(2 unique numbers after 2 dice) = (4/6)(1/6) + (2/6)(4/6) = 12/36
  4. P(3 unique numbers after 3 dice) =  P(3 unique numbers after 3 dice | 2 unique numbers after 2 dice) P(2 unique numbers after 2 dice) = (2/6)(4/6) = 8/36

Sanity check: these add up to 1.  Finally, the 4th die:

  •   P(7 has been rolled after 4 dice) = P(7 has been rolled after 4 dice | 7 has been rolled after 3 dice) P(7 has been rolled after 3 dice) +  P(7 has been rolled after 4 dice | 1 unique number after 4 dice) P(1 unique number after 4 dice) +  P(7 has been rolled after 4 dice | 2 unique numbers after 3 dice) P(2 unique numbers after 3 dice) +  P(7 has been rolled after 4 dice | 3 unique numbers after 3 dice) P(3 unique numbers after 3 dice) = (1)(15/36) + (1/6)(1/36) + (2/6)(12/36) + (3/6)(8/36) = 139/216 = 59.7%

Of course, all this should be rewritten in the usual mathematical notation so it’s a bit easier to read.

However, I’m having trouble coming up with an elegant solution to what is the likelihood of busting if your columns are 6,7,8 or 5,7,8, etc.  I think it becomes a rather tedious counting problem, not much better than just having a computer exhaustively check every possibility.  Even the probability of rolling any other number (like 8 ) becomes complicated once we lose the symmetry.  That may be an important lesson in itself.

Games in the classroom #1: Rallyman

Lately, I’ve been thinking about how I would teach various classes I may be called to teach.  Frankly, I’m uncertain how to design a project-based course on, say, linear algebra or calculus.  But for probability and statistics, I have some ideas: games.  There are 2 reasons I want to use games: 1) Games are fun, which I hope will engage students.  I want them to want to learn more, to explore a problem and try to solve it for themselves, something I find lacking in many math students.  2) I like games and can talk about them all day.  I hope that will give my lessons that little extra fizz since I’m not the most charismatic teacher.

One excellent game that comes to mind is Rallyman.  I don’t have time to summarize the rules, but it is an excellent mix of risk management and planning.  Here are some ways the game can be used to illustrate various concepts:

Intro.  If people don’t know what rally driving is, show them a video of Ken Block or something.  Will this turn off people who aren’t interested in cars?  Maybe.  Have to work on that.

Probability and events.  Start with a time attack roll, when all dice are rolled together.  What is the probability that 3 hazard symbols come up and you lose control?  Well, that depends on the mix of dice being rolled.  Start with simple problems of all dice having the same probability of hazards (1-in-6 or 2-in-6), then move onto mixtures.  This can lead to discussion of counting (how many ways are there to roll 2 hazards with 4 dice?) and/or making use of the probabilities of the events they just calculated.

Another concept that’s very important here is independent events: the result of one dice doesn’t affect the other dice.  Furthermore, say you’re rolling 1 gas and 3 gear dice.  We can create events A, one hazard is rolled on the gas die; B, 2 or more hazards are rolled on the gear dice; C, 3 hazards are rolled on the gear dice.  Event A is independent of B and C, which makes it easier to calculate probabilities of intersections of events.

Conditional probability.  I’m pretty sure there’s an example of conditional probability, but a lot of the simple events (i.e. die rolls) are independent, and the only example I can think of (how one turn impacts the ones after it) is probably better done after discussing expectation.

Random variables and expectation.  The bottom line in Rallyman are seconds spent, which is an example of a random variable: if we make this move, we have an 80% chance of using only 10 seconds but a 20% chance of using a whole minute.  From this, we can talk about expectation: on average, how many seconds will this take?  (Of course, maybe taking only 10 seconds will win you the race while 60 seconds will lose it, so depending on the context, asking about expected number of seconds is the wrong question, but that will have to wait until we talk about cost functions and decision theory.)  From there, we can extend this to conditional expectations: if you spin out, that screws up your next turn, which affects the number of seconds that will take.

Big picture.  I don’t expect Rallyman to be solved by any student without a computer.  I think if Rallyman were used in a classroom, its role would be to illustrate various concepts and to show sample calculations.  For evaluation, students would instead use these ideas to study something else.

Dominion Contest #1

Who can devise the best Dominion Strategy?

  1. Download this.
  2. Create one strategy using only cards from the list and send the strategy to me (send in an email so I don’t read it until I finish my own strategy).
  3. I’ll run simulations (all possible 3-player combinations, random setup), and the person whose strategy wins the most games wins.
For the first contest, let’s use the First Game setup: Cellar, Market, Militia, Mine, Moat, Remodel, Smithy, Village, Woodcutter, Workshop.

Dominion Problem #1

You know how the newspapers have chess and bridge columns which are basically puzzles?  There should be something like that for Dominion.  This was the deck tonight:

  • 2: Cellar
  • 3: Chancellor, Workshop
  • 4: Militia, Spy, Thief
  • 5: Council Room, Festival, Laboratory, Market

Questions:

  1. What would you do with a 4/3 or 5/2 split?
  2. What would your ideal build be?
  3. How would you react to opponents?

RAF: Raid / interception analysis

In order to make decisions for raid composition and interception in RAF from a game theory standpoint, we have to estimate the utility of different decisions.  Analysis can be found here.  Summary: it appears that both sides are better off playing on the extremes: Germans either commit Me 109s to a strong hunt or a strong close escort; British should aim to overwhelm one or more raids and let the others by.