Closed LiamM32 closed 1 year ago
Hi @LiamM32,
Can you illustrate this with a real example? Or better, write a failed test to resolve it. (in this file: https://github.com/julien-boudry/Condorcet/blob/master/Tests/src/Tools/Converters/CondorcetElectionFormatTest.php )
Thanks,
So is this a bug then? I can attempt this when I'm back at my computer.
So is this a bug then? I can attempt this when I'm back at my computer.
Not sure to understand well your problem. I prefer to execute the same as yours, It will be quicker to really capture the point.
Enter the candidates
====================
Candidates: Enter each candidate names
Please register candidate N°1 (or press enter to continue):
> A,B,C
Please register candidate N°2 (or press enter to continue):
>
Should the votes be interpreted implicitly (candidates not mentioned come last)? (yes/no) [yes]:
>
Enter the votes
===============
Format: Candidate B > CandidateName D > CandidateName C = CandidateName A
Please register vote N°1 (or press enter to continue):
> A>B
Please register vote N°2 (or press enter to continue):
>
Enter the methods
=================
Voting methods: Choose by entering their numbers separated by commas. Press enter for the default method.
Select methods [Schulze Winning]:
[0 ] ALL
[1 ] BordaCount
[2 ] Copeland
[3 ] Dodgson Quick
> 2
-------------------------------------------
1 candidate registered || 1 vote registered
Configuration
=============
------------------------------------------------------------- -------
Is vote weight allowed? FALSE
------------------------------------------------------------- -------
Votes are evaluated according to the implicit ranking rule? TRUE
------------------------------------------------------------- -------
Is vote tie in rank allowed? TRUE
------------------------------------------------------------- -------
Results per methods
===================
===============================
| |
| Vote Method Copeland |
| |
===============================
★ Condorcet Winner || ⚐ Condorcet Loser
+----------------------+----- Results: Copeland ----------------------------+
| Rank | Candidates |
+----------------------+----------------------------------------------------+
| 1 | A,B,C ★ |
+----------------------+----------------------------------------------------+
Look like that?
The fact is that Vote 1 is invalid, and there is only one candidate named "A,B,C"
Yes, but in a .cvotes file.
It should be the same case, not specific to c.votes files. In my example, if you use a semicolon instead commo, it's working as you want.
I've changed the separators in the console display to use semi-colons instead of commas. It's more consistent with the inputs and makes it impossible to mix up readings in those ambiguous (but unlikely) cases where candidate names contain commas and can match.
I was wrong when I said that using commas instead of semicolons causes the results to be in the order that they were written in. Actually, using the attached file _wikipediawrong.cvotes (actually _wikipediawrong.txt) makes only one candidate called "A, B, C, D, E". Being the only candidate, they are the winner. But someone who made this mistake may think that this is a list of candidates from first place to last place. wikipedia_wrong.txt wikipedia.txt
I'm not closing with this comment, as it's a suggestion, not a bug report. Though I think this is a low priority.
In some cases, someone may want to write candidate names like "Eby, David", which is a justification for only accepting semicolons. Perhaps it can allow commas as the separator only if there are no semicolons present.
Perhaps it can allow commas as the separator only if there are no semicolons present.
It would be horribly ambiguous. I think of it's only a display problem, and only for command line render. It's more logic since commit above, using semilicolon as well for display (tie candidates name and tags).
Alright. Maybe the most cost-effective solution would be a warning that says "Warning: There is only one candidate in this election. Make sure to separate candidates with semicolons."
Done with b5f502e
If you write a .cvotes file, but you separate the candidates with commas rather than semicolons, something strange happens. All candidates will be registered, but the votes won't count. Instead, the program will appear to run properly, but the votes will be ignored, and the candidate's rankings will be the order they were listed in the .cvotes file.
I think it would be best to allow either semicolons or commas to separate candidates in .cvotes files, as this would make the program more user-friendly, and reduce the probability of unnoticed user error.