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

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

H2
H3
H4
3 columns
2 columns
1 column
26 Comments