View Single Post
Old 01-25-2013, 08:19 PM   PM User | #14
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
I like this better.
Code:
//new data structure:
var rarity ={ common: 6,  uncommon:2, rare:2 };
var weapons ={ sword:4, bow:2,  staff:2 };
It "reads" clearer (to me, at least!) and feels easier to make changes to. Actually, amazing how such a relatively minor rewrite helps the clarity so much.

But it still requires the user to understand the combinatorial math. Not at all difficult, but probably too much for a lot of the newbies we get here.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote