The Official Unstable Vote Equilibrium Topic



  • Rules:

    1. If the post is at 1 or more, you must upvote that post.
    2. If the post is at -1 or less, you must downvote that post.


  • @Maciejasjmj Wouldn't this mean all posts stay at 0?



  • @coldandtired said in The Official Unstable Vote Equilibrium Topic:

    @Maciejasjmj Wouldn't this mean all posts stay at 0?

    You're not forbidden to vote for a post that's at 0.



  • Ugh... this means now I'll have to update my script; it lacks the capability to use the post's current score in deciding whether it should upvote or downvote.

    edit: done. It's not too pretty, but it'll work...

    0_1492179726035_upload-b4bc5a7d-b60a-42ea-9b51-bde63139e896

    0_1492183872650_upload-5d734144-e58c-4752-8dcf-412e6b5ee038

    ...I could probably just use dir = eval(dir) there, but that seems slightly more WTF-y than what I did, by encapsulating it in a function and forcing it to be an expression...



  • @anotherusername said in The Official Unstable Vote Equilibrium Topic:

    Ugh... this means now I'll have to update my script; it lacks the capability to use the post's current score in deciding whether it should upvote or downvote.

    edit: done. It's not too pretty, but it'll work...

    0_1492179726035_upload-b4bc5a7d-b60a-42ea-9b51-bde63139e896

    0_1492183872650_upload-5d734144-e58c-4752-8dcf-412e6b5ee038

    ...I could probably just use dir = eval(dir) there, but that seems slightly more WTF-y than what I did, by encapsulating it in a function and forcing it to be an expression...

    Why not just put the function in the array directly?



  • @ben_lubar ... um, originally because I was passing that from inside GreaseMonkey's sandbox to outside GreaseMonkey's sandbox (most of the code in my userscript needs to run outside the sandbox, because trying to use the page's socket function from inside the sandbox causes security violations). And the only way that I could figure out to get it outside the sandbox when it was defined in the sandbox was by passing it in JSON form, and JSON doesn't much like functions.

    Basically... this...

    0_1492205233418_upload-18d45301-fcaa-4b10-96f5-8eac9b9b3bdc

    But now that I look... it actually doesn't look like I'm using it inside the sandbox, other than to pass it to the function that runs outside it.

    I definitely thought I needed it somewhere, but I'm not seeing it now. So I could just move the definition a few lines down and then I could use a function there, no problem.

    edit: now I remember... my previous inception of an upvote script ran in the sandbox. I deleted all that code, so it's not being used anywhere else now.


  • Winner of the 2016 Presidential Election

    This is a strange idea for a thread


  • area_can

    :haircut:



  • @Jaloopa said in The Official Unstable Vote Equilibrium Topic:

    This is a strange idea for a thread

    I don't think we have a strange ideas thread. But nothing is stopping you from making one!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.