You are on page 1of 3

Lets do a problem solving episode.

This question has dumbfounded me several times in the past, but only now do I have the formal skills to take on this problem. The context of the problem is also a personal intrest of mine, so Im excited to discuss a topic in my domain. The reasoning behind this problem solving question is to nd out how to get as much money as possible. My question is: In a simulated game of Advance Wars, what is the closed form for the amount of money obtained by a passive player when he/she adopts the strategy of having troops capture all cities only after all have been landed on?
1. UNDERSTANDING THE PROBLEM

Advance Wars is a turn-based strategy war game. The goal of the game is to build an army to defeat the opponent, but lets simplify the game. In each turn, each player takes a phase. In a phase, a player can do one or more of the following: Build troops from a player owned factory. Each troop costs $1000, and once built on the turn, cannot move until the next turn. The factory can build one troop a day. Move troops, where each troop can move anywhere up to three spaces (not including the space it is on) a day. Troops can move past each other, but cannot occupy the same space. A troop on a city can capture it in two turns, including the turn they land on it. When a troop is done its phase, it will take on a shaded color rather than a highlighted color. Each turn may be counted as a Day. As part of his/her income, a player earns $1000 a day per building, including his/her headquarters, factory, and cities. He gets this money at the beginning of the turn and cannot spend more than he has. By the nature of the passive player, we dont care how long (i.e. how many days) it takes for the cities to be captured, only how much money will be earned when he decides to take them all.

The simulation is at: http://s1306.beta.photobucket.com/user/cateagleowl/media/awt1/ScreenShot2012-12-04at png.html?sort=3&o=48. This is the game map. Disregard the orange army. The blue army, led by Max, is a passive player. He controls blue buildings and troops. The building at the very left is a headquarters, but does nothing for this problem. The building immediately right of it is a factory, where troops can be built. The four grey structures at two space intervals right of the headquarters and factory are neturally controlled cities. Maxs troops may take over the cities to his right (but none of those above). When a troop is half-way capturing a city, it will have a c mark next to it. The picture denoted by o=47 at the end of the html tag shows intel. This table gives intel regarding the amount of money each player has on a certain Day (the current day is given in the top right section of the table). Focus on the column headers Incoming Funds and Avaliable Funds and on the row Blue Moon. Let the former denote the amount of money a player will have at the beginning of the next turn. Let the latter denote the amount of money a player has. To make the problem solving question more accurate, lets work with money obtained only at the end of a turn. Note that every photo in this album that has this intel table will always carry the state of the games information at the end of a players turn if the next intel table in the album (if one exists) clearly gives information regarding the next days intel. Lets denote relevant variables. Let Mn be the amount of money a player has at the end of the nth day. M0 is the amount of money a player starts with before the rst day begins. Mn corresponds to the column Avaliable Funds. Let In be the income a player has at the end of the nth day and will receive at th end of the In+1 th day, if such a day exists. In corresponds to the column Incoming Funds. Let X be the number of netural cities on this map at the beginning of day 1. Players want to obtain as many cities as they can to increase their income to build a larger army. For this simulation, assume that there is no army to ght and that Max simply wants to capture the cities right of him. Since he is a passive player, he will focus on building and moving troops to land on all these cities before he captures any of them. When he nally positions troops so as to be able to start capturing cities on a next day, he will no longer need to build additional troops on the respective current day.

2. DEVISING A PLAN My plan to nd this closed form is to simulate and analyze Maxs troops movements per day. As can be seen by the photos, I have already greatly simplied the problem by creating a map that will suit our anayltical needs. This question comes up in a great many situations in gameplay, and so I sought to analyze and simulate it though this map. This map has four neutral cities that Max wants to capture. As we will see later, we will not need to work with a larger number of cities to come up with a proper closed form because of Maxs passive behavior. Because the amount of money for a particular day relies on the amouny money and income of its previous day, I will analyze the intel table at the end of each day. Then I will create a recursive denition for Mn that I will unwind and nd a closed form for. 3. CARRYING OUT THE PLAN First, we gather info from the intel table from day 1 to the nal day 8. Assume all numbers are in $. M0 = 0. I0 = 2000. M1 = 1000. I1 = 2000. At this point, I see that M1 = 1000 because Max gained income from the previous day, i.e. I0 = 2000, and used it to purchase a troop, which costs 1000. So we continue: M1 M2 M3 M4 = M0 + I 0 = M1 + I 1 = M2 + I 2 = M3 + I 3 1000 = 0 + 2000 1000 = 1000. I1 = 2000. 1000 = 1000 + 2000 1000 = 2000. I2 = 2000. 1000 = 2000 + 2000 1000 = 3000. I3 = 2000. 1000 = 3000 + 2000 1000 = 4000. I4 = 2000.

Max does not want to purchase a fth troop on the fourth day (or any future days), because there are only four cities he wants to control. We continue: M5 = M4 + I4 = 3000 + 2000 = 4000. I5 = 2000. At the start of Maxs phase on day 6, we see that he is ready to nish capturing the cities. This will greatly increase his income: M6 = M5 + I5 = 4000 + 2000 = 6000. I6 = 6000. By the end of day 6, Max is nish building his troops and is nish capturing the desired cities, so his money simply accumulates. Notice that 6000 = 2000 + C(1000), where each city contributes $1000 to income since Max captured these cities (here, C = 4). So we have: M7 = M6 + I6 = 6000 + 2000 = 8000. I7 = 2000 + C(1000). M8 = M7 + I7 = 8000 + 6000 = 14000. I8 = 2000 + C(1000). Second, we try to form a recursive dention for In , and then Mn . Again, let n denote the day number with In and Mn denoting income and avaliable funds, respectively, at the end of the nth day. ( 2000 if n 5 In = , and 2000 + C(1000) if n > 5
8 >0 < M (n) = M (n > : M (n 1) + In 1) + In
1 1

1000

if n = 0 if 1 n 4 . if n > 4

Third, we unwind. Assume n >> 4. Then M (n) = M (n 1) + In


1

= (M (n 2) + In 2 ) + In 1 # by defn of M (n 1) when n > 4. = (M (n 3) + In 3 ) + In 2 + In 1 . . . P = M (n k) + k In j # Here, we want n k = 4 because we want unwind until we can apply the j=1 denition of M (n) for 1 n 4. . . . P = M (4) + n 4 In j j=1 = (M (3) + I3 1000) + (I4 + I5 + I6 + I7 + + In 2 + In 1 ) # by defn of M (n 1) when 1 n 4. = ((M (2) + I2 1000) + I3 1000) + ((2000) + (2000) + ((n 1) (6) + 1)(2000 + C(1000))) # by defn of In . = ((M (1) + I1 1000) + I2 + I3 + 2000 + (n 6)(2000 + C(1000)) = (M (0) + I0 1000) + I1 + I2 + I3 + 1000 + (n 6)(2000 + C(1000)) = I0 + I1 + I2 + I3 + (n 6)(2000 + C(1000)) # by defn of M (n) when n = 0. = 8000 + (n 6)(2000 + C(1000)) # by defn of In when n 5.

Fourth, in order to have a reliable number, we will want to prove that this closed form is equal to the recursive denition of Mn through complete induction. For simplicity, we take C = 4 as before. Let P(n): M (n) = 8000 + (n
Proof: 6)(2000 + C(1000)).

Prove 8n 2 N.P (n) by complete induction. Assume n 2 N. # n arbitrary


Assume 8k 2 N.0 k < n.P (k). # assume IH. Then n = 0 1 n < 4 n = 4 n > 4. # do a proof by cases. Case 1: n = 0 Then M(0) = 0 =? Then P(n). Then n = 0 =) P (n). Case 2: 1 n < 4 Then M (n) = M (n 1) + In 1 1000 = 8000 + ((n 1) 6)(2000 + C(1000)) + In 1 1000 # by IH, P (n = 8000 + ((n 7)(2000 + 4(1000)) + 2000 1000 = ? Then P(n). Then 1 n < 4 =) P (n). Case 3: n = 4 Then M (n) = ? Case 4: n > 4 Then M (n) = ? Then in all cases, P(n). Then [8k 2 N.0 k < n.P (k)] =) P (n). Then 8n 2 N.[8k 2 N.0 k < n.P (k)] =) P (n). # since n arbitrary.

1) since 0 n

1 < n.

Then 8n 2 N.P (n). # by complete induction.

Im having a little trouble with unwinding summations - hence the ?s. I have to do some review on them. But the general idea for the proof holds. Of course, while we proved this for only C = 4, it will work for any C 2 N because by the nature of Maxs behavior, C is a constant. 4. LOOKING BACK Actually, I wish that I made n and C formal parameters for both I and M , so that everything is consistent. Other than that, I am satised with this result. I can use it extensively as I nd more things to prove related to this game. For example, how does this strategy compare to that of a greedy algorithm to capturing cities. And how about capturing bases? These are some of the questions I wish to tackle in the future... 3

You might also like