diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-17 22:41:09 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-17 22:41:09 -0400 |
commit | 67c2c87a437afafb18cf0d8b969a3302d3a626be (patch) | |
tree | f0ea808b655d6653a14eee42a8b633e61f4b7747 /blessed.cpp | |
parent | 64c87158afe212d73e5007d48097c4877d56b19b (diff) | |
download | blessed-67c2c87a437afafb18cf0d8b969a3302d3a626be.tar.gz blessed-67c2c87a437afafb18cf0d8b969a3302d3a626be.tar.bz2 blessed-67c2c87a437afafb18cf0d8b969a3302d3a626be.zip |
Added newlines to separate emojis from exclamation if there are too many emojis
Diffstat (limited to 'blessed.cpp')
-rw-r--r-- | blessed.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/blessed.cpp b/blessed.cpp index 367d0d1..f3d90c4 100644 --- a/blessed.cpp +++ b/blessed.cpp | |||
@@ -44,6 +44,8 @@ int main(int argc, char** argv) | |||
44 | emojis.push_back(line); | 44 | emojis.push_back(line); |
45 | } | 45 | } |
46 | 46 | ||
47 | emojifile.close(); | ||
48 | |||
47 | for (;;) | 49 | for (;;) |
48 | { | 50 | { |
49 | std::cout << "Generating tweet" << std::endl; | 51 | std::cout << "Generating tweet" << std::endl; |
@@ -66,14 +68,22 @@ int main(int argc, char** argv) | |||
66 | 68 | ||
67 | std::string emojibef; | 69 | std::string emojibef; |
68 | std::string emojiaft; | 70 | std::string emojiaft; |
71 | int emn = 0; | ||
69 | do | 72 | do |
70 | { | 73 | { |
74 | emn++; | ||
71 | std::string em = emojis[rand() % emojis.size()]; | 75 | std::string em = emojis[rand() % emojis.size()]; |
72 | emojibef += em; | 76 | emojibef += em; |
73 | emojiaft = em + emojiaft; | 77 | emojiaft = em + emojiaft; |
74 | } while (rand() % 4 < 3); | 78 | } while (rand() % 2 == 0); |
75 | 79 | ||
76 | std::string result = emojibef + " " + exclamation + " " + emojiaft; | 80 | std::string result; |
81 | if (emn > 3) | ||
82 | { | ||
83 | result = emojibef + "\n" + exclamation + "\n" + emojiaft; | ||
84 | } else { | ||
85 | result = emojibef + " " + exclamation + " " + emojiaft; | ||
86 | } | ||
77 | result.resize(140); | 87 | result.resize(140); |
78 | 88 | ||
79 | std::string replyMsg; | 89 | std::string replyMsg; |