From d7e934156858287cdb7597ad0dced97d4d279f2f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 28 Feb 2019 20:28:20 -0500 Subject: Got it bot-ready! Using C++ randomization now, along with an update to rawr-ebooks that allows it to do the same. Cleaned up the code here and there. Added in the twitter client and the config file reader. We can use librawr's histogram class now, so we don't need our own. Also why did we not name this bot "aspartame". It's a Sugar replacer. Hahaha. I'm Pink Diamond. --- histogram.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 histogram.cpp (limited to 'histogram.cpp') diff --git a/histogram.cpp b/histogram.cpp deleted file mode 100644 index 38fca45..0000000 --- a/histogram.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "histogram.h" -#include -#include - -template -void histogram::add(const T& inst) -{ - freqtable[inst]++; -} - -template -void histogram::compile() -{ - distribution.clear(); - - int max = 0; - for (auto& it : freqtable) - { - max += it.second; - distribution.emplace(max, it.first); - } - - freqtable.clear(); -} - -template -const T& histogram::next() const -{ - int max = distribution.rbegin()->first; - int r = rand() % max; - - return distribution.upper_bound(r)->second; -} - -template -void histogram::print() const -{ - for (auto& freqpair : freqtable) - { - std::cout << freqpair.first << ": " << freqpair.second << std::endl; - } -} - -template class histogram ; -- cgit 1.4.1