Dr. Smith.rb- A Curation Trail Bot That Deals in Absolutes (based on Dr. Doogie by @inertia)

in ruby •  7 years ago 
Dr. Smith is a fork of @inertia's Dr. Doogie curation trail bot that allows your account to vote with an absolute percentage rather than scale your votes based on the weight of the votes of the account you trail.

About a month ago, I posted a two-part blog series on how to use @inertia's Dr. Doogie to set up your own curation trailing bot. If you want to read the motivation on why I decided to set up my own trailing bot, check out Part 1 of the series, and if you'd like a step-by-step tutorial of how to set up a bot of your own, check out Part 2.

If you've used Dr. Doogie before, you'll note that it operates on scaled votes, that is, your account will vote at a percentage of the voting weight of the account you are trailing. For example, if you were trailing curie at 5% and it voted at 50%, your account would vote at 1% (5% of 50%). After asking @inertia some questions about the bot, I realized one feature that I desired was the ability to specify an absolute voting percentage for my account. I wanted to trail several accounts, but since they varied their voting percentages, I had to compromise on a percentage setting, which resulted in non-integer voting percentages and put an extra strain on my voting power.

My desire for an absolute voting percentage motivated me to try to modify the code myself to make it happen. After several hours of trial and error (I'm not a programmer. My first encounter with Ruby was when I set up Dr. Doogie the first time), I was able to make it happen by changing two lines of code and a parameter name. I'll explain the exact changes I made in the next section, so if you're only interested in running the bot for yourself, you can follow the link below:

In the spirit of @inertia's bot releases, I've given this bot a cartoon mascot:

Explanation of Code Changes

Dr. Doogie allows the user to input a parameter, scale_votes which determines the scaling of the votes (the percentage of the percentage). Then the code assigns your account's voting percentage using the following lines:

scale = options[:scale_votes].to_f / 100
weight = (trailing_vote.weight * scale).to_i

The variable scale takes the scale_votes value and divides it by 100 to get a scale factor. Then scale is multiplied by trailing_vote.weight, which is the percentage that the account you are trailing voted at to get the final variable weight, which is passed along to the actual voting command.

Dr. Smith does the math a bit differently, while still taking the trailing_vote.weight into consideration. My first modification was changing the parameter scale_votes to voting_weight. This was just an aesthetic change to make changing the parameter sound more logical. Then I replaced the two lines of code above with the following:

scale = trailing_vote.weight / (options[:voting_weight].to_f * 100)
weight = (trailing_vote.weight / scale).to_i

We still calculate a scale factor for the final vote weight, but it's done a bit differently. The program receives the trailing_vote.weight as a value from 0 to 10000; 10000 is a 100% vote, 100 is a 1% vote. We desire our final voting weight to be the parameter voting_weight that we defined in the configuration file, so we solve a simple equation:

weight = scale * trailing_vote.weight

The scale factor is the unknown, so rearranging, we get:

scale = weight / trailing_vote.weight

This is the first line of code, where we pull the value for weight from our configuration parameter voting_weight and multiply by 100 since we are inputting the number as a simple percentage to move the values to the 0 to 10000 scale.

Now all that's left is to define our final value for weight, so the second line divides the trailing_vote.weight by the scale, and we arrive back at the desired voting value.

It does seem simpler just to parse in a value from the configuration file from 0 to 10000, however, the code requires that the trailing_vote.weight be taken into consideration. I'm not a programmer, so someone may be able to explain why this is. It took me several rounds of troubleshooting to perfect this equation, but I have been able to run my curation trails with absolute voting percentages with no issues now.

Running Your Own Curation Trail Bot

If you're locked out of Streemian like me, or you just want to protect your own keys to your account, running your own instance of Dr. Smith or Dr. Doogie is a great way to trail other accounts to appreciate their curation skills. I've already outlined how to create your own instance of Dr. Doogie in my previous tutorial post, and the instructions do not change much at all from that tutorial. You will just need to clone my fork of @inertia's code via the link:

https://gist.github.com/45af1abb7eb11f87574f6c51e3a2d3a4.git

There are also specific instructions in the Readme.md file included on the Github Gist page for my version of the bot, which you may find here.

If you have questions on getting the bot set up, I'll do my best to answer them in the comments.

I would also like to enlist help in figuring out how to get one instance of the bot to trail multiple accounts. I've tried adding more, but the bot doesn't seem to work when I do. If anyone has any thoughts on this, please let me know!

Thank You, @inertia

This modification would not be possible without the programming skills of @inertia, so I want to thank him for his contributions to the Steem community and specifically for developing Dr. Doogie. I've shared this post on ChainBB in one of his forums in appreciation of his contributions. Please consider upvoting this post to support further development of these bots.

Be sure to check out all of his contributions:

I look forward to using Dr. Smith to further my curation efforts across the platform. I'm always looking for new curation trails to follow, so if you have a unique curation trail, please let me know. I'm always open to supporting new causes.

Modifying this bot has been a great learning experience for me. I had no prior experience with Ruby, so I had to Google syntax and other things to make this happen. I look forward to interacting more with the Ruby forum on ChainBB.

Here's to more great curation in the future!

Footer

Unmentionables

Footer

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

It's too bad it can't go back in time and preempt the vote ;)

Yes. Sometimes that could result in some fantastic rewards!

Dr. Doogie (and Dr. Smith) has the next best thing. You can set it to mode: head so it votes earlier than some other bots trailing the same account.

Great post, bud! Running bots is over my head, let alone changing the code to make it do something else. Good work man!

I thought bots were over my head, too. Then I found posts on Steemit that helped me gain the background knowledge necessary. It's been a fun learning experience, so if you are ever interested in setting up your own bots, I'm sure you could do it!

Thanks for stopping by!

I am sure with enough patients I could do it. My brother Adam is a whiz at that kind of stuff, but I still can't get him interested in the platform.... Oh well. The only real thing stopping me from setting my own bots is I need a better computer. I am working on upgrading the one I have, but there is little left that can be done, I need a whole new motherboard and start from scratch, and I just don't have the funds at the moment.

That's understandable. I recently got a new PC, so I've been using my old one to run these bots. It has worked surprisingly well, and I've enjoyed playing around with Linux. If you ever do get an upgrade, I'd be happy to help with any questions you might have!

You're a superstar! Hopefully one of my posts takes a rocket past the moon and I can get a few more upgrades. I will definitely be hitting you up when I have the hardware needed to run your software! Thanks again, man!

I love, love, love this article, @ethandsmith! I'm going to need to give it a re-read, and more study to understand the technical stuff, but this one's a keeper for me. I was actually going to message you, and ask for more details about the bot you mentioned you were using, but this is way better than a reply post answer.

I, like you, feel let down by Streemian's performance. I would always rather be in charge, and learn the skills needed to develop and run the things I want to use. It takes a lot more time and effort, but then I have the skills developed to help others learn how to do it. And the customer support to myself is second to none!

I want to be able to offer people a different option than Streemian, and that is the problem I will be working to solve with this bot resource.

I have upvoted and resteemed this deserving article.
I found it on Curation With Style: The Best of the Unmentionables Ep. 31 (01/12/17)
Cheers!
@mitneb

I want to say that I really appreciate your comment! I'm glad you found such utility in the post. I've been following your mission to promote content from users who are learning English, and I think that's a fantastic initiative!

I really hope you'll be able to take advantage of the things bots can do for you as you get farther along in the Steemit world. Certainly my tutorial posts are a great place to start, but I'm sure I've forgotten something along the way, so please, by all means, message me if you have any questions. I'm more than happy to help you get some bots set up.

The unfortnate part about this bot is that it does take some knowledge of Linux, coding, and command line proficiency to be able to get it going. However, if you have a spare PC that you can throw Linux on, it would make a great server for this bot since each instance does not use up many system resources.

Again, thanks for stopping by, and feel free to message me on Discord any time!

Good job on this one! It's nice to see someone doing something different instead of just making their own version of something which has already been done over and over!

Thanks for stopping by to read my post!

I think @inertia's bots are some of the best ones out there, so I'm glad that I could take part in improving one of them, or at least changing it so that people have more options if they want to run their own bots. It's been great to set up my own curation trails without having to worry about signing up for a 3rd party service.

Thanks for telling me about @simgirl, as well! I'm going to go engage some of her posts and check out her gameplay!

Interesting but to be honest over my head when you got into the coding side been so many years since I played with any code

I had never really attempted to alter any code other than the configuration settings, but I have been using this bot for a while and decided to put my mind to it today. Glad I did!

Thanks so much for stopping by!

clearly you set your mind to itcand made good progress cheers

Great to hear you got it sorted out and working, I'm sure this can be a benefit for others who like working with bots.

Now if I can only get the Unmentionable Discord bot working haha. Thanks for stopping by!

Sweet! The voting by percentage makes so much more sense to me. Glad to see the fresh look at the voting.

Nice job!

The scaling votes worked fine for most purposes, but my voting power depletion could become unpredictable depending on how the other accounts vote. This also gives me more control over my voting, so it'll be useful in the future!

Thanks for stopping by!

Good info! I usually manually vote, but this will be useful to many!

I certainly hope so!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by ethandsmith from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP. Be sure to leave at least 50SP undelegated on your account.

Qurator
Your Quality Content Curator
This post has been upvoted and given the stamp of authenticity by @qurator. To join the quality content creators and receive daily upvotes click here for more info.

Qurator's exclusive support bot is now live. For more info click HERE or send some SBD and your link to @qustodian to get even more support.

You've received an upvote from #TheUnmentionables - a SteemIt community full of members who like to kick ass, take names, and occasionally do it wearing (or forgetting to wear) our unmentionables...

Unmentionables

Please upvote this comment so we can help our members grow faster!

tip! 6.0