Wizard Kings Army Raising

Cost: 0

Description

One of my favorite hobbies is playing board games. I'm a member of BoardGameGeek which is an excellent resource for information and helps for board games. I learned about the game Wizard Kings there and was thrilled with my purchase when it arrived. I first played it out with my sister and we noticed that it was difficult or at least cumbersome to figure out the costs of the armies. I looked on BGG for some kind of tool but couldn't find any.

Still needing a solution, I decided to make one myself. I got out a piece of paper and jotted down a few ideas. I would scan in the blocks from the game and use JavaScript to advance the steps of the units and automatically calculate the costs. When I started I saw that the project would be a lot easier using custom JavaScript objects.

I created one base object called Unit that kept track of cost, name, current step, and the maximum allowed step of the unit. The object also has two methods. One contain the function to step either up or down. Clicking on the object rotates it up and step while a shift-click will rotate it down a step. The other method is used to report the new cost of the unit based on its current step and price per step of the unit. This information is then used to figure out the total cost of the army.

The custom JavaScript objects greatly reduce the complexity of the code and allow you to insert a new unit onto the page with a single line of code. Everything else has already been taken care of. The end result is a well coded page that allows you to easily keep track of how much your raised army will cost.

Copyright © 2005 - 2008, Russell S. Ahlstrom