Here you go it's pseudo code but something like this:
sub testC(cost, 'AC'r, 'BC'r, 'CD'r){ ret=(); if(cost <= 'AC'r){ push(@ret,{'AC' => cost}); }else{ cost=cost-'AC'r; if(cost <= 'BC'r){ push(@ret,{'AC' => 'AC'r, 'BC' => cost}); }else{ cost=cost-'BC'r; if(cost <= 'CD'r){ push(@ret,{'AC' => 'AC'r, 'BC' => 'BC'r, 'CD' => cost} +); }; }; if(cost < 'BC'r){ push(@ret,{'BC' => cost}) }else{ cost=cost-'BC'r; if(cost <= 'AC'r){ push(@ret,{'AC' => cost, 'BC' => 'BC'r}); }else{ cost=cost-'AC'r; if(cost <= 'CD'r){ push(@ret,{'AC' => 'AC'r, 'BC' => 'BC'r, 'CD' => cost} +); }; }; if(cost < 'CD'r){ push(@ret,{'CD' => cost}) }else{ cost=cost-'CD'r; if(cost <= 'AC'r){ push(@ret,{'AC' => cost, 'CD' => 'CD'r}); }else{ cost=cost-'AC'r; if(cost <= 'BC'r){ push(@ret,{'AC' => 'AC'r, 'BC' => cost, 'CD' => 'CD'r} +); }; }; return(@ret) } ============= sub testB(cost, 'AB'r, 'BC'r, 'BD'r, ccost, 'AC'r, 'CD'r){ ret=(); if(cost <= 'AB'r){ @tail=testC(ccost, 'AC'r, 'BC'r, 'CD'r); foreach (x in @tail){ push(@ret,{({'AB' => cost}, %tail[x])}); }; }else{ cost=cost-'AB'r; if(cost <= 'BC'r){ @tail=testC(ccost, 'AC'r, 'BC'r-cost, 'CD'r); foreach (x in @tail){ if(defined $tail[x]{'BC'}){ cost += %tail[x]{'BC'}; delete($tail[x]{'BC'}); push(@ret,{({'AB' => 'AB'r, 'BC' => cost}, %tail[x +])}); }else; }; }else{ cost=cost-'BC'r; if(cost <= 'BD'r){ @tail=testC(ccost, 'AC'r, 0, 'CD'r); foreach (x in @tail){ push(@ret,{({'AC' => 'AC'r, 'BC' => 'BC'r, 'CD' => + cost}, %tail)}); }; }; }; }; #### if(cost <= 'BC'r){ @tail=testC(ccost, 'AC'r, 'BC'r-cost, 'CD'r); foreach (x in @tail){ if(defined $tail[x]{'BC'}){ cost += %tail[x]{'BC'}; delete($tail[x]{'BC'}); }; push(@ret,{({'AB' => 'AB'r, 'BC' => cost}, %tail[x])}) +; }; }else{ cost=cost-'BC'r; if(cost <= 'AB'r){ %tail=testC(ccost, 'AC'r, 0, 'CD'r); foreach (x in @tail){ push(@ret,{({'BC' => 'BC'r, 'AB' => cost}, %tail)}); }; }else{ cost=cost-'AB'r; if(cost <= 'BD'r){ %tail=testC(ccost, 'AC'r, 0, 'CD'r); foreach (x in @tail){ push(@ret,{({'BC' => 'BC'r, 'BD' => cost}, %tail)} +); }; }; }; }; #### if(cost < 'BD'r){ @tail=testC(ccost, 'AC'r, 'BC'r, 'CD'r); foreach (x in @tail){ push(@ret,{({'BD' => cost}, %tail[x])}); }; }else{ cost=cost-'BD'r; if(cost <= 'AB'r){ @tail=testC(ccost, 'AC'r, 'BC'r, 'CD'r); foreach (x in @tail){ push(@ret,{({'AB' => cost, 'BD' => 'BD'r}, %tail[x])}) +; }; }else{ cost=cost-'AB'r; if(cost <= 'BC'r){ foreach (x in @tail){ if(defined $tail[x]{'BC'}){ cost += %tail[x]{'BC'}; delete($tail[x]{'BC'}); }; push(@ret,{({'AC' => 'AC'r, 'BC' => cost, 'BD' + => 'BD'r}, %tail[x])}); }; }; }; }; } foreach tech in edeck: if(tech.cost.lust>(her.stat.lust-lustx)){ edeck.remove(tech) }; @tech[bills]=testB($tech[cost]['B']-'B'x, $her[stat]['AB'] +, $her[stat]['BC'], $her[stat]['BD'], $tech[cost]['C']-'C'x, $her[sta +t]['AC'], $her[stat]['CD']) if(@tech[bills] == 0 ){ edeck.remove(tech) }else{ }

In reply to Re^2: How tell if you can play a card with multi type 'Mana' by Dr.Altaica
in thread How tell if you can play a card with multi type 'Mana' by Dr.Altaica

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.