Slashdot Mirror


Obfuscated Vote Counting Contest

Daniel Horn writes "In a flash of inspiration coming from the Obfuscated C code contest and the current E-voting scandals, I wondered if there shouldn't be a similar code obfuscation contest based on obfuscating voting results, that is, C code that appears correct but does the wrong thing when counting votes. Submit your obfuscated vote-counting code now, and the two winners will be selected on November 2 and will receive a free Vega Strike CD. Obviously incorrect code, however, is not welcome."

10 of 223 comments (clear)

  1. I WIN! by AmigaAvenger · · Score: 5, Funny

    Quick, someone post some of the Diebold voting machine code, you certainly will have a winner in there!

    1. Re:I WIN! by anonymous+cowherd+(m · · Score: 4, Funny

      Did anyone notice the irony in the fact that the email address for submissions is dyebold@gmail.com? LOL.

      --
      http://neokosmos.blogsome.com
    2. Re:I WIN! by Phillup · · Score: 4, Funny
      You gotta do it right (like... FAR right ;-))
      switch (c) {
      case YADA_YADA:
      yada_yada += 1;
      case NADER:
      nader += 1;
      case KERRY:
      kerry += 1;
      case BUSH:
      bush += 1;
      }
      That will more likely pass the "first glance" test... and give the big guys the numbers they "deserve".

      And, I'm sure Bush would believe he really does have that much more "support" from "his" citizens than Kerry.
      --

      --Phillip

      Can you say BIRTH TAX
    3. Re:I WIN! by JUSTONEMORELATTE · · Score: 4, Funny

      You're missing something more important than a default case.
      Aww c'mon, give the guy a break already!

      --
      free gmail invites -- only one left!

  2. Damn by antifoidulus · · Score: 4, Funny

    I was going to submit the Diebold code till I read:Obviously incorrect code, however, is not welcome.

  3. Patent pending by GrAfFiT · · Score: 5, Funny

    "C code that appears correct but does the wrong thing when counting votes"
    Beware of Diebold suing you for infringing one of their patents !

  4. Re:Summary of this year's election by tomhudson · · Score: 4, Funny
    More efficient code, to avoid all the suspense. It is guaranteed to return the correct outcome every time!
    #define AMERICALOSES 0x00

    int main() {
    return AMERICALOSES;
    }
  5. ok. by photon317 · · Score: 4, Funny

    /* Global vote tallies */
    int KerryVotes=0;
    int BushVotes=0;

    void ParseVote(const char* v) {
    if(!strcmp(v,"Kerry")) {
    KerryVotes++;
    } else if(strcmp(v,"Bush")) {
    BushVotes++;
    }
    }

    --
    11*43+456^2
  6. my submission by SamBeckett · · Score: 4, Funny
    /* Current population proportion polls show: */
    #define BUSH 0.512
    #define KERRY 0.481
    #define UNDECIDED (1.0 - BUSH - KERRY)

    #define NBC 0
    #define ABC 1
    #define CBS 2
    #define FOX 3

    int main() {

    int bush = 0;
    int kerry = 0;
    int nader = 0;
    int i;
    int vote;
    int broadcast_network = rand() % 4;

    for ( i = 0; i < 260000000; ++i) {
    vote = rand() % 10000;

    if ( vote < 10000.0*BUSH ) ++bush;
    else if ( vote < 10000.0*(BUSH+KERRY) ) ++kerry;
    else {
    if ( broadcast_network == NBC || broadcast_network == ABC ||
    broadcast_network == CBS )
    ++kerry;
    else if ( broadcast_network == FOX )
    ++bush;
    else
    ++nader;
    }
    }

    printf("Bush :%9d\nKerry:%9d\nNader:%9d\n", bush, kerry, nader);
    return 0;
    }
  7. Re:last election by Anonymous Coward · · Score: 5, Funny

    Surely you know that C and C++ don't give a damn if there are new lines and carriage returns in the whitespace or not.

    Only newbie programmers use new lines and carriage returns.

    Real programmers don't use new lines and carriage returns as it detracts from being able to glance at the whole program at once and immediately understand it's intent, purpose, and spot any bugs in a holistic fashion.