5
\$\begingroup\$

Introduction

Congratulations! You've been selected to do research a a newly discovered animal called a fuzzy, a docile, simple creature that strongly resembles a cotton ball. Fuzzies love to be near other fuzzies, but not all fuzzies want to be near each other.

There are 6 types of fuzzies, 1a, 1b, 2a, 2b, 3a, and 3b. Each obeys different rules.

  • Type 1a fuzzies want to be near any type b fuzzy. (vice versa for 1b)

  • Type 3a fuzzies want to be near any type a fuzzy. (vice versa for 3b)

  • Finally, type 2 fuzzies want to be near any fuzzy type, a or b.

  • Perfect pairings are matches in which both fuzzies want to be near each other (ex. 1a and 1b)

  • Semiperfect pairings are matches in which only one fuzzy wants to be near the other (ex 3a and 1b)

  • Imperfect pairings are matches in which neither fuzzy wants to be with the other (ex. 3a and 3b)

Your Challenge

Given a list of fuzzies:

  1. Output the total number of perfect pairings. If there are any left:
  2. Output the number of semiperfect pairings. If there are any left:
  3. Output how many leftover bachelors there are.

Output and input format don't matter as long as you state them both.

Test cases

1a, 1b:
1a and 1b are a perfect match
> 1 perfect, 0 semiperfect, 0 bachelors
1a, 2b, 2a, 3b:
1a and 2b are a perfect match
2a and 3b are a semiperfect match
> 1 perfect, 1 semiperfect, 0 bachelors
1a, 1b, 2a, 3a, 3b, 3b:
1a and 1b are a perfect match
2a and 3a are a perfect match
3b and 3b are an imperfect match
> 2 perfect, 0 semiperfect, 1 bachelor
1b, 2a, 3a
1b and 2a are a perfect match
3a is left over
(note: could also be:
2a and 3a are a perfect match
1b is left over
for the same result)
> 1 perfect, 0 semiperfect, 1 bachelor

Scoring

This is , so shortest in bytes wins.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ "Type 1a fuzzies want to be near any type b fuzzy. (vice versa for 1b) Type 3a fuzzies want to be near any type a fuzzy. (vice versa for 3b)" Doesn't this mean 1a and 3b are actually equivalent, and 1b and 3a are actually equivalent? You should expand on what you mean by "vice versa". \$\endgroup\$
    – Lynn
    Jan 2 at 15:22
  • 3
    \$\begingroup\$ "Output the total number of perfect pairings" Do you mean "Output the maximum number of pairings possible"? It seems to be implied by the fact that something could be left over. But normally I would interpret this to mean "Of all the possible ways to pair two fuzzies how many are perfect" \$\endgroup\$
    – Wheat Wizard
    Jan 2 at 15:45
  • 3
    \$\begingroup\$ What do we maximize? The test cases suggest that we need to maximize from all the pairings first the perfect, then the semiperfect, then imperfect. Also, in the third test case 3b-3b looks like a perfect pair to me. \$\endgroup\$
    – pajonk
    Jan 2 at 19:28

0

Browse other questions tagged or ask your own question.