Code Monkey home page Code Monkey logo

Comments (11)

LiamM32 avatar LiamM32 commented on July 17, 2024 1

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."

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024 1

Done with b5f502e

image

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

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,

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

So is this a bug then? I can attempt this when I'm back at my computer.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

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.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024
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"

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

Yes, but in a .cvotes file.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

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.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

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.

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

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 wikipedia_wrong.cvotes (actually wikipedia_wrong.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.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

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).

from condorcet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.