summaryrefslogtreecommitdiff
path: root/blarandom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'blarandom.cpp')
-rw-r--r--blarandom.cpp60
1 files changed, 46 insertions, 14 deletions
diff --git a/blarandom.cpp b/blarandom.cpp
index 33555c8..fda149c 100644
--- a/blarandom.cpp
+++ b/blarandom.cpp
@@ -16,21 +16,23 @@
/*
Copyright 2012 Blatech <http://www.blatech.co.uk>
- Author: Joe Robinson <joe@lc8n.com>
+ Author: Joe Robinson <joe@lc8n.com> (JR)
+ Co-Author: Phil Burton <philbeansburton@gmail.com> (PGB)
Changelog:
- v0.1 - Initial release
- v0.2 - Added Makefile
- v0.3 - Added help
- v0.31 - Changed help description
- v0.4 - Added coin & dice presets
- v0.5 - Added 8ball preset
- v0.6 - Can now use count with presets
- v0.61 - Added error handling for 8ball, removed ability to count
- v0.62 - Fixed 8ball handling more than one word
- v0.7 - Added thebluelist (this should really be a separate file)
- v0.71 - Added more thebluelist options
+ v0.1 - Initial release (JR)
+ v0.2 - Added Makefile (JR)
+ v0.3 - Added help (JR)
+ v0.31 - Changed help description (JR)
+ v0.4 - Added coin & dice presets (JR)
+ v0.5 - Added 8ball preset (JR)
+ v0.6 - Can now use count with presets (JR)
+ v0.61 - Added error handling for 8ball, removed ability to count (JR)
+ v0.62 - Fixed 8ball handling more than one word (JR)
+ v0.7 - Added thebluelist (this should really be a separate file) (JR)
+ v0.71 - Added more thebluelist options (JR)
+ v0.8 - Added 'internet' function (PGB)
*/
@@ -43,7 +45,7 @@
int main() {
- std::string version = "0.71";
+ std::string version = "0.8";
RandomLib::Random r; // Create r
r.Reseed(); // and give it a unique seed
@@ -94,6 +96,7 @@ int main() {
bool dice = false;
bool d20 = false;
bool wolf = false;
+ bool internet = false;
if (args[0].empty()) {
min = 1;
max = 10;
@@ -136,9 +139,13 @@ int main() {
min = 0;
max = 120;
wolf = true;
+ } else if (!args[0].compare("internet")) {
+ min = 0;
+ max = 120;
+ internet = true;
}
- if (coin || dice || letter || d20 || wolf) {
+ if (coin || dice || letter || d20 || wolf || internet) {
if (args[1].empty()) {
count = 1;
} else {
@@ -293,6 +300,29 @@ int main() {
"Timepiece burger",
"Ram burger"
};
+
+std::string theInternetList[19] = {
+"http://www.xkcd.com",
+"http://www.thedailymash.co.uk",
+"http://www.cad-comic.com/cad/",
+"http://www.slashdot.org/",
+"http://www.bbc.co.uk/news",
+"http://www.thedailywtf.com",
+"http://news.ycombinator.com",
+"http://www.reddit.com/r/todayilearned",
+"http://whatif.xkcd.com",
+"http://www.w3schools.com",
+"http://stackoverflow.com/questions/194812/list-of-freely-available-programming-books",
+"http://andreehansson.se/the-basics-of-jquery/",
+"http://tldp.org/LDP/tlk/tlk.html",
+"http://www.regexpal.com/",
+"http://git.or.cz/course/svn.html",
+"http://try.github.com/",
+"http://jsfiddle.net/",
+"http://gskinner.com/RegExr/",
+"http://www.jslint.com/"
+};
+
for (int i = 0; i < count; i++) {
intResult = r.IntegerC(min, max);
if (coin) {
@@ -307,6 +337,8 @@ int main() {
strResult = eightBallStr[intResult];
} else if (wolf) {
strResult = theBlueList[intResult];
+ } else if (internet) {
+ strResult = theInternetList[intResult];
} else {
std::stringstream ss;
ss << intResult;