Cannonandwall

Cannons
Each level of the cannons adds to your attack points. Leveling up cannons costs gold. Each upgrade raises the cost by 250 gold, starting from 1000 gold. Each level of a cannon adds 125 * cannon level + 500 attack points. For example:
 * Costs
 * Attack point pattern

L1 = 125 * 0 + 500 = 500 (1000 gold)

L2 = 125 * 1 + 500 = 625 (1250 gold)

L3 = 125 * 2 + 500 = 750 (1500 gold)

Total attack raised by level 3 cannons = L1 + L2 + L3 = 500 + 625 + 750 = 1875 attack points.

Walls
Each level of the walls adds to your defense points. Leveling up walls costs gold. Each upgrade raises the cost by 250 gold, starting from 1000 gold. Each level of a wall adds 125 * wall level + 500 attack points. For example:
 * Costs
 * Defense point pattern

L1 = 125 * 0 + 500 = 500 (1000 gold)

L2 = 125 * 1 + 500 = 625 (1250 gold)

L3 = 125 * 2 + 500 = 750 (1500 gold)

Total defense raised by level 3 walls = L1 + L2 + L3 = 500 + 625 + 750 = 1875 defense points.