Forum archives » Regarding Stripcreator » How many votes is that?

evil_d
March 26, 2009 9:24 AM

If you're like me, I'm sorry.  But if you're like me, you sometimes find yourself looking at a comic's rating and wondering what kind of votes it took to get that particular number, what its rating would be if the next person voted a certain way, etc.  I'm bad at math, so I wrote some JavaScript to help me play around with the numbers.

Instructions:

1. Save this code as an HTML file.
2. Open it in a web browser.
3. Figure it out your damn self.
4. Skip those steps and use http://www.comicsauce.com/votes.html">Injokester's hosted copy.

 

<html>
<head>
<title>How Many Votes Is That?</title>
<style type="text/css">
  body { line-height: 1.7em; }
</style>
<script type="text/javascript">
function recalculate()  {

  numgood = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) : 0);
  numokay = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) : 0);
  numbad  = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) : 0);
  numvotes = numgood + numokay + numbad;
  document.f.r.value = Math.round((((numgood * 10) + (numokay * 5)) / numvotes) * 100) / 100;
  document.f.v.value = numvotes;

}
</script>
</head>
<body>
<form name="f">

Good: <input type="text" name="g" value="0" size="3" onChange="recalculate();">
<input type="button" value="+" 
       onClick="document.f.g.value = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) + 1 : 1); recalculate();">
<input type="button" value="&minus;" 
       onClick="document.f.g.value = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) - 1 : 0); recalculate();">
<br>

Okay: <input type="text" name="o" size="3" value="0" onChange="recalculate();">
<input type="button" value="+" 
       onClick="document.f.o.value = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) + 1 : 1); recalculate();">
<input type="button" value="&minus;" 
       onClick="document.f.o.value = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) - 1 : 0); recalculate();">
<br>

&ensp;Bad: <input type="text" name="b" size="3" value="0" onChange="recalculate();">
<input type="button" value="+" 
       onClick="document.f.b.value = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) + 1 : 1); recalculate();">
<input type="button" value="&minus;" 
       onClick="document.f.b.value = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) - 1 : 0); recalculate();">
<br>

<br>
Rating: <input type="text" name="r" size="3">&ensp;
Votes: <input type="text" name="v" size="3">

</form>
</body>
</html>

Post #269619link

Aylear
March 26, 2009 1:55 PM

Okay, my love for you right now is like a river of puppies and unicorn hair. You're bad at math, so you wrote some JavaScript. Holy shit.

Welp, thanks for being just like me. I sympathise.

Post #269623link

evil_d
March 26, 2009 4:14 PM

I appreciate your love as well as your colorful simile for it.

Post #269626link

Injokester
March 26, 2009 7:09 PM

Nice!

I took the liberty of hosting it here for the technically challenged.

Post #269632link

evil_d
March 26, 2009 9:00 PM

Good thinking; thanks.

Post #269643link

Injokester
March 26, 2009 9:38 PM

Of course, I doubt the technically challenged will read past the first post, but that's their loss :)

Post #269645link

Tterb
March 26, 2009 10:04 PM

This is real hopefully thanks Evil and Injokester. This is some good stuff.

Post #269646link

Brad
March 28, 2009 11:02 AM

Fascinating -- now you should try to improve on my crappy algorithm!

Post #269688link

evil_d
March 28, 2009 10:13 PM

quote:

Brad wrote:
Fascinating -- now you should try to improve on my crappy algorithm!

if (username == "evil_d")  {
  score = 10;
else {
  score = 0;

Post #269713link

TheGovernor
March 29, 2009 9:05 AM

This is by no means perfect and occasionally spits out some wacky numbers, but appears for the most part to work. Using evil_ds work as a base, and having a lazy sunday afternoon in which to tinker Ive made a simple calculator that attempts to backwards engineer possible voting combos based on a comics rating and votes.

 


How Many Votes Is That?

  body { line-height: 1.7em; }


function recalculate()  {

  numgood = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) : 0);
  numokay = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) : 0);
  numbad  = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) : 0);
  numvotes = numgood + numokay + numbad;
  document.f.r.value = Math.round((((numgood * 10) + (numokay * 5)) / numvotes) * 100) / 100;
  document.f.v.value = numvotes;

}


function uncalculate() {

rating = document.shakedown.rat.value
votes = document.shakedown.votes.value

if (rating=="0" || votes=="0")
document.shakedown.combos.value = "Either they're all bad or you ain't grasped the concept of entering numbers in the boxes yet";
else
{
//origgoods = rating *votes /5-votes;
goods = Math.round((rating * votes)/5-votes);
//document.shakedown.combos.value = goods;

output = "Potential Voting combinations that could lead to these values \n\nGood Okay Bad\n"

oks = votes - goods;
bads= 0;
//output += Math.round((((goods * 10) + (oks * 5)) / votes) * 100) / 100 + "\n";  //test line
if (Math.round((((goods * 10) + (oks * 5)) / votes) * 100) / 100 != rating)
output += "I don't think its possible but here are ratings that would be in the ballpark \n";

do {

newline = goods + "  -  " + oks + "  -  " + bads + "\n";
output += newline;

oks = oks -2
goods += 1
bads +=1
} while (oks > -1)


document.shakedown.combos.value = output;
}
}




Good:

       onClick="document.f.g.value = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) + 1 : 1); recalculate();">

       onClick="document.f.g.value = (parseInt(document.f.g.value) ? parseInt(document.f.g.value) - 1 : 0); recalculate();">



Okay:

       onClick="document.f.o.value = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) + 1 : 1); recalculate();">

       onClick="document.f.o.value = (parseInt(document.f.o.value) ? parseInt(document.f.o.value) - 1 : 0); recalculate();">



 Bad:

       onClick="document.f.b.value = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) + 1 : 1); recalculate();">

       onClick="document.f.b.value = (parseInt(document.f.b.value) ? parseInt(document.f.b.value) - 1 : 0); recalculate();">





Rating:  
Votes:


---------------


Enter your rating and number of votes below





Rating:  
Votes:

       onClick="uncalculate();">



Possible combinations of voting that would lead to that rating

<br />Enter votes and rating above<br />



 

Post #269730link

TheGovernor
March 29, 2009 9:11 AM

sorry looks like the preview button screwed it up in mozilla.

 

included a link, feel free to copy it over to comicsauce if you like injokester

 

 valcalc

Post #269731link

evil_d
March 29, 2009 9:25 PM

Nicely done, Gov.

At the moment, our highest rated comic, pita's "Adam and Eve", is either 18-3-0 or 19-1-1.  My money's on the former.

Post #269746link

Zaster
March 30, 2009 6:41 AM

Comics have ratings?

Post #269754link

AngryAmerican
April 3, 2009 9:33 AM

I thought th apex of mathematics was long division.

In general I approve of math until it gets all uppity and starts using letters and whatnot. Then it needs to be lynched.

Post #269902link

Forum archives » Regarding Stripcreator » How many votes is that?

stripcreator
Make a comic
Forums
featuring
diesel sweeties
jerkcity
exploding dog
goats
ko fight club
penny arcade
chopping block
also
Brad Sucks