Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Skill based Matchmaking

You are given N players who want to play a M vs M match. Each Player has an attribute Score which is a positive integer.
The program needs to find possible unique matches of M vs M players depending on their Score. The matches should be sorted based on the quality of each match. The quality of the match is defined as the closeness of the scores between the teams.


Example for quality

Let's say we have 1vs1 matches with the following scores-
Match1 100 vs 98
Match2 60 vs 40
Match3 62 vs 64

The sorted order here would be:
Match1, Match3, Match2

For matches with multiple players on one side, the average score should be used.

Input-
Number of players on each side: M

Example-
2

Input-
A blank line denotes end of input.

Example-
bleh 85
Aequitas 90
akS 87
lamiV 20

Output-
sorted list of (best to worst)
comma separated list in Team A(average score) vs comma separated list in Team B>(average score)

Example-
bleh,akS (86) vs Aequitas,lamiV (55)
bleh,Aequitas (87.5) vs akS,lamiV (53.5)
bleh,lamiV (52.5) vs Aequitas,akS (88.5)

What I have tried:

I'm unable to get the unique combinations of players.
Posted
Updated 11-Jun-20 2:29am
Comments
Rick York 10-Jun-20 15:46pm    
OK, what is your question? "Will you do this for me?" is not a valid question and the answer is NO!
Richard MacCutchan 11-Jun-20 5:05am    
The example explains it. You combine the players and check each combination for the scores which are closest to each other.

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 
You need to learn the language for some tutorial like Learn C++ and than develop some program logic and flow.

Use classes when possible, so you can design objects, constructros, operators and functions like:
C++
class Player {
string name;
int score;
}
Good luck with your homework.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900