Math

May. 27th, 2017 07:46 pm
nonethefewer: (Default)
[personal profile] nonethefewer
I run into wacky math things while I play my pointless games.

The setup:

I have a set of monsters I can use. They each cost a certain, different, amount of creds to play. I have a maximum amount of creds I can spend. The order of monsters I play is relevant.

What is the formula for determining all the possible permutations?

Don't tell me there isn't one, there must be one.

(no subject)

Date: 2017-05-28 02:00 pm (UTC)
vatine: Generated with some CL code and a hand-designed blackletter font (Default)
From: [personal profile] vatine
If we ignore the different costs for now, the number of permutations of N distinct items from M is M! / (M - N)!. If you can choose the same monster multiple times, it would probably end up being something like M to the power of N. Here N is approximated as "your available funds" divided by "the average cost of monsters you're going to play".

Generating all of them should boil down to looping through the set of monsters, stick it in the "list of monsters used so far" list, then pass that list and the set with the monster removed recursively done until either "all onsters used" or "funds used up".

February 2022

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728     

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 25th, 2025 10:45 pm
Powered by Dreamwidth Studios