Tuesday, May 20, 2014

Clash of Clans has Algebra!!!

I like to play the games that my students are playing.  A few weeks ago, they introduced me to Clash of Clans.

At first I thought the game was okay, it must be a teenager thing.  But then I was hooked.  I just need a few more coins so that I could upgrade my elixir storage, and if I upgraded my elixir storage then I could upgrade my gold storage, and if I upgrade my gold storage I could upgrade my elixir collector.  You see what they did there?  Yes, one variable depends on the other.  Right now I'm saving up my gold so that I can upgrade my wizard tower to level 2 (a whopping 360,000 coins) and my elixir so that I can upgrade my barracks to level 7 (240,000 elixir).  

Last night I asked myself if it was worth it.  Should I upgrade my gold mine or let it go?  When you upgrade a goldmine, you are unable to collect any gold during that time.  Here are the details:  My one goldmine is at level 7 and collects 1600 coins per hour.  It costs 28,000 elixir to upgrade to level 8 and takes 24 hours to do this.  Once I'm at level 8 the goldmine will collect 1900 coins per hour.  I thought to myself "Do I really want to upgrade and not have any coins collected in this 24 hour period?  Is it worth it?"  And then it hit me.....this is ALGEBRA!!!

Let x represent the number of hours and let y represent the coins collected.

Equation without upgrading:  y = 1600x + 38400    (the 38400 is the amount collected during the 24 hr period)

Equation without upgrading:  y = 1900x + 0  (0 because you are unable to collect coins from that mine during the upgrade)

At what time with the coins be equal in amount?



1600x + 38400 = 1900x

38400 = 300x

128 = x
5 1/3 days!!!

I need 360,000 coins to upgrade my wizard tower.  

It would take 128 hours (or 5 1/3 days) for this upgrade to be worth it.  
You can see from this screen shot that I have 201,785 coins right now.

Now my question is, "Will it be faster to collect these 360,000 coins by upgrading this goldmine or by leaving it alone?"

I have a total of 5 goldmines:

Goldmine 1     Level 8     1900 coins per hour
Goldmine 2     Level 8     1900 coins per hour
Goldmine 3     Level 7     1600 coins per hour (thinking about upgrading this one)
Goldmine 4     Level 8     1900 coins per hour
Goldmine 5     Level 3      500 coins per hour
I collect a total of 7800 coins per hour without the upgrade.  I need 360,000 - 201,785 = 158,215 more coins to upgrade my wizard tower.  That would take 158215 / 7800 = 20.3 hours.

Since this would take less than 24 hours to do, it wouldn't make sense to upgrade the gold mine.

I haven't tried any of this with my students yet, but I can't wait to see what individual questions they come up with for their own villages.