Original Post — Direct link
about 4 years ago - /u/wotc_aaronw - Direct link

The party size calculation is surprisingly complex to do efficiently- we joked about it being a potential interview problem for new engineers. I wonder if any redditors can figure it out?

#wotcstaff

about 4 years ago - /u/wotc_aaronw - Direct link

Originally posted by somebroyouknow

You just have them on the battlefield. The set is likely going to be geared towards class types and creatures having multiple. For instance this card would trigger twice off a potential ‘human cleric wizard’ creature card on the battlefield.

EDIT: After reading some other threads it seems each creature can only be used for up to one creature type in the party. So a human wizard cleric could count for your wizard OR cleric designation but not both.

You just have them on the battlefield.

Yep. #wotcstaff

about 4 years ago - /u/wotc_aaronw - Direct link

Originally posted by ApolloFireweaver

The only potential issue with this psuedo-code approach is making sure that multi-type items only count for one time when there aren't any duplicates.

ex. You have a Human Warrior, a Elf Thief Cleric, and an Orc Wizard - Your count should be three.

I'm not quite sure I follow the idea above, but a good test case is:

  • Rogue Wizard Warrior
  • Rogue Cleric
  • Cleric Wizard
  • Warrior Wizard

Edit: introduced a fourth creature and type to be more clear.

#wotcstaff

about 4 years ago - /u/wotc_aaronw - Direct link

Originally posted by wotc_aaronw

The party size calculation is surprisingly complex to do efficiently- we joked about it being a potential interview problem for new engineers. I wonder if any redditors can figure it out?

#wotcstaff

Y'all are awesome!

Of the two solutions I could grok and passed my test cases:

/u/ApolloFireweaver - yours is pretty close to /u/WotC_BenFinkel's initial sketch! By my reckoning, this could work in O(n) time if you're very conscious about your data structures. Since you're doing so much data manipulation, choosing the wrong structure could really cost you.

/u/archy_7 - yours was the closest to what we're actually doing, assuming your recursive swap tracks previously seen slots. Yours also performs in O(n) time. This version can be neatly formulated as graph theory problem by casting creatures/classes as nodes on a bipartite graph- then clever use of an adjacency matrix keeps the implementation super light.

For those interested in the underlying problem: see geeks for geeks.

#wotcstaff






Recent Magic The Gathering: Arena Posts