Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Math Topics » alt.math.undergrad.independent

Topic: Combination\Permutation with Average Constraint Question
Replies: 2   Last Post: Aug 13, 2008 9:49 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Idgarad

Posts: 20
Registered: 10/18/06
Re: Combination\Permutation with Average Constraint Question
Posted: Aug 12, 2008 3:19 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Aug 12, 12:21 pm, Idgarad <idga...@gmail.com> wrote:
> I am working on a collectable card game as a hobby. I want a
> definitive set of cards that I can plan on crafting by allocating 0 to
> 100 points to spend on creating the card in any 8 areas.
>
> Given 8 possible attributes to each card, ranging from 0 to 100 how
> many possible combinations are possible to get:
>
> -=> an average of 25 (common cards)
> -=> an average of 50 (uncommon cards)
> -=> and average of 75 (rare)
> (or from a purely formula base; How can I get the possible
> combinations of X atrributes ranging from L to H such that the average
> is exactly Y; given L,H,X, and Y are whole numbers.)
>
> The idea is that I have laid out a point system to creating a card
> giving a card designer (my friends) either 200, 400, or 600 points to
> build a card to ensure a basic balancing system in their creation.
>
> How many cards are we looking at creating?
>
> I know it's a huge number, but how huge?
>
> Not an easy task I am finding...
>
> from a function standpoint I suppose I could try a brute force check
> of
> function(a,b,c,d,e,f,g,h)
> if average(a,b,c,d,e,f,g,h) == 25 return 25;
> if average(a,b,c,d,e,f,g,h) == 50 return 50;
> if average(a,b,c,d,e,f,g,h) == 75 return 75;
>
> and then walk a-h incrementing them from 0-100 recursively...
>
> Any good mathmatics to work around a brute force approach?


Here is the perl script for those who want to see how painful the
brute force is:
-----------------------------------------------------------------------------------
use strict;
use warnings;
use Math::NumberCruncher;


my @a=(0 .. 100);
my @b=(0 .. 100);
my @c=(0 .. 100);
my @d=(0 .. 100);
my @e=(0 .. 100);
my @f=(0 .. 100);
my @g=(0 .. 100);
my @h=(0 .. 100);
my $daAverage=0;
my $iterations=0;
my $cardcount=0;
my $card25=0;
my $card50=0;
my $card75=0;

for my $alpha (@a) {
for my $beta (@b) {
for my $gamma (@c) {
for my $epsilon (@d) {
for my $zeta (@e) {
for my $eta (@f) {
for my $theta (@g) {
for my $iota (@h) {
$daAverage = ($alpha+$beta+$gamma+$epsilon+$zeta+$eta+$theta+$iota)/
8;
$iterations++;
# print "$alpha,$beta,$gamma,$epsilon,$zeta,$eta,$theta,$iota =
AVG($daAverage)\n";
if($daAverage == 25) { $card25++;$cardcount++; print "\"NameGoesHere
\",$alpha,$beta,$gamma,$epsilon,$zeta,$eta,$theta,$iota,\"A:25 I:
$iterations TC:$cardcount C:$card25 U:$card50 R:$card75\"\n";}
if($daAverage == 50) { $card50++;$cardcount++; print "\"NameGoesHere
\",$alpha,$beta,$gamma,$epsilon,$zeta,$eta,$theta,$iota,\"A:50 I:
$iterations TC:$cardcount C:$card25 U:$card50 R:$card75\"\n";}
if($daAverage == 75) { $card75++;$cardcount++; print "\"NameGoesHere
\",$alpha,$beta,$gamma,$epsilon,$zeta,$eta,$theta,$iota,\"A:75 I:
$iterations TC:$cardcount C:$card25 U:$card50 R:$card75\"\n";}
}
}
}
}
}
}
}
}

print "--------------------------------------------\n";
print "- Total Iterations Checked: $iterations\n";
print "- Total Cards Generated : $cardcount\n";
print "- Total Common Cards : $card25\n";
print "- Total Uncommon Cards : $card50\n";
print "- Total Rare Cards : $card75\n";
print "--------------------------------------------\n";



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.