summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--CMakeLists.txt11
-rw-r--r--data.txt802
-rw-r--r--pokepronouns.cpp115
m---------vendor/libtwittercpp0
m---------vendor/yaml-cpp0
6 files changed, 934 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8aa7292 --- /dev/null +++ b/.gitmodules
@@ -0,0 +1,6 @@
1[submodule "vendor/libtwittercpp"]
2 path = vendor/libtwittercpp
3 url = git@github.com:hatkirby/libtwittercpp.git
4[submodule "vendor/yaml-cpp"]
5 path = vendor/yaml-cpp
6 url = git@github.com:jbeder/yaml-cpp.git
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8800bbc --- /dev/null +++ b/CMakeLists.txt
@@ -0,0 +1,11 @@
1cmake_minimum_required (VERSION 3.1)
2project (pokepronouns)
3
4add_subdirectory(vendor/libtwittercpp)
5add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL)
6
7include_directories(vendor/libtwittercpp/src vendor/yaml-cpp/include)
8add_executable(pokepronouns pokepronouns.cpp)
9set_property(TARGET pokepronouns PROPERTY CXX_STANDARD 11)
10set_property(TARGET pokepronouns PROPERTY CXX_STANDARD_REQUIRED ON)
11target_link_libraries(pokepronouns yaml-cpp twitter++)
diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..f494dd4 --- /dev/null +++ b/data.txt
@@ -0,0 +1,802 @@
1Nidoran♂, male
2Nidorino, male
3Nidoking, male
4Hitmonlee, male
5Hitmonchan, male
6Tauros, male
7Hitmontop, male
8Volbeat, male
9Mothim, male
10Gallade, male
11Throh, male
12Sawk, male
13Rufflet, male
14Braviary, male
15Tyrogue, male
16Latios, male legend
17Tornadus, male legend
18Thundurus, male legend
19Landorus, male legend
20Bulbasaur, both
21Ivysaur, both
22Venusaur, both
23Charmander, both
24Charmeleon, both
25Charizard, both
26Squirtle, both
27Wartortle, both
28Blastoise, both
29Eevee, both
30Vaporeon, both
31Jolteon, both
32Flareon, both
33Omanyte, both
34Omastar, both
35Kabuto, both
36Kabutops, both
37Aerodactyl, both
38Snorlax, both
39Chikorita, both
40Bayleef, both
41Meganium, both
42Cyndaquil, both
43Quilava, both
44Typhlosion, both
45Totodile, both
46Croconaw, both
47Feraligatr, both
48Togetic, both
49Espeon, both
50Umbreon, both
51Treecko, both
52Grovyle, both
53Sceptile, both
54Torchic, both
55Combusken, both
56Blaziken, both
57Mudkip, both
58Marshtomp, both
59Swampert, both
60Lileep, both
61Cradily, both
62Anorith, both
63Armaldo, both
64Relicanth, both
65Turtwig, both
66Grotle, both
67Torterra, both
68Chimchar, both
69Monferno, both
70Infernape, both
71Piplup, both
72Prinplup, both
73Empoleon, both
74Cranidos, both
75Rampardos, both
76Shieldon, both
77Bastiodon, both
78Combee, both
79Lucario, both
80Togekiss, both
81Leafeon, both
82Glaceon, both
83Snivy, both
84Servine, both
85Serperior, both
86Tepig, both
87Pignite, both
88Emboar, both
89Oshawott, both
90Dewott, both
91Samurott, both
92Pansage, both
93Simisage, both
94Pansear, both
95Simisear, both
96Panpour, both
97Simipour, both
98Tirtouga, both
99Carracosta, both
100Archen, both
101Archeops, both
102Zorua, both
103Zoroark, both
104Chespin, both
105Quilladin, both
106Chesnaught, both
107Fennekin, both
108Braixen, both
109Delphox, both
110Froakie, both
111Frogadier, both
112Greninja, both
113Tyrunt, both
114Tyrantrum, both
115Amaura, both
116Aurorus, both
117Sylveon, both
118Rowlet, both
119Dartrix, both
120Decidueye, both
121Litten, both
122Torracat, both
123Incineroar, both
124Popplio, both
125Brionne, both
126Primarina, both
127Salandit, both
128Togepi, both
129Munchlax, both
130Riolu, both
131Growlithe, both
132Arcanine, both
133Abra, both
134Kadabra, both
135Alakazam, both
136Machop, both
137Machoke, both
138Machamp, both
139Electabuzz, both
140Magmar, both
141Makuhita, both
142Hariyama, both
143Electivire, both
144Magmortar, both
145Timburr, both
146Gurdurr, both
147Conkeldurr, both
148Elekid, both
149Magby, both
150Caterpie, both
151Metapod, both
152Butterfree, both
153Weedle, both
154Kakuna, both
155Beedril, both
156Pidgey, both
157Pidgeotto, both
158Pidgeot, both
159Rattata, both
160Raticate, both
161Spearow, both
162Fearow, both
163Ekans, both
164Arbok, both
165Pikachu, both
166Raichu, both
167Sandshrew, both
168Sandslash, both
169Zubat, both
170Golbat, both
171Oddish, both
172Gloom, both
173Vileplume, both
174Paras, both
175Parasect, both
176Venonat, both
177Venomoth, both
178Diglett, both
179Dugtrio, both
180Meowth, both
181Persian, both
182Psyduck, both
183Golduck, both
184Mankey, both
185Primeape, both
186Poliwag, both
187Poliwhirl, both
188Poliwrath, both
189Bellsprout, both
190Weepinbell, both
191Victreebel, both
192Tentacool, both
193Tentacruel, both
194Geodude, both
195Graveler, both
196Golem, both
197Ponyta, both
198Rapidash, both
199Slowpoke, both
200Slowbro, both
201Farfetch'd, both
202Doduo, both
203Dodrio, both
204Seel, both
205Dewgong, both
206Grimer, both
207Muk, both
208Shellder, both
209Cloyster, both
210Gastly, both
211Haunter, both
212Gengar, both
213Onix, both
214Drowzee, both
215Hypno, both
216Krabby, both
217Kingler, both
218Exeggcute, both
219Exeggutor, both
220Cubone, both
221Marowak, both
222Lickitung, both
223Koffing, both
224Weezing, both
225Rhyhorn, both
226Rhydon, both
227Tangela, both
228Horsea, both
229Seadra, both
230Goldeen, both
231Seaking, both
232Mr. Mime, both
233Scyther, both
234Pinsir, both
235Magikarp, both
236Gyarados, both
237Lapras, both
238Dratini, both
239Dragonair, both
240Dragonite, both
241Sentret, both
242Furret, both
243Hoothoot, both
244Noctowl, both
245Ledyba, both
246Ledian, both
247Spinarak, both
248Ariados, both
249Crobat, both
250Chinchou, both
251Lanturn, both
252Natu, both
253Xatu, both
254Mareep, both
255Flaaffy, both
256Ampharos, both
257Bellossom, both
258Marill, both
259Azumarill, both
260Sudowoodo, both
261Politoed, both
262Hoppip, both
263Skiploom, both
264Jumpluff, both
265Aipom, both
266Sunkern, both
267Sunflora, both
268Yanma, both
269Wooper, both
270Quagsire, both
271Murkrow, both
272Slowking, both
273Misdreavus, both
274Wobbuffet, both
275Girafarig, both
276Pineco, both
277Forretress, both
278Dunsparce, both
279Gligar, both
280Steelix, both
281Qwilfish, both
282Scizor, both
283Shuckle, both
284Heracross, both
285Sneasel, both
286Teddiursa, both
287Ursaring, both
288Slugma, both
289Magcargo, both
290Swinub, both
291Piloswine, both
292Remoraid, both
293Octillery, both
294Delibird, both
295Mantine, both
296Skarmory, both
297Houndour, both
298Houndoom, both
299Kingdra, both
300Phanpy, both
301Donphan, both
302Stantler, both
303Smeargle, both
304Larvitar, both
305Pupitar, both
306Tyranitar, both
307Poochyena, both
308Mightyena, both
309Zigzagoon, both
310Linoone, both
311Wurmple, both
312Silcoon, both
313Beautifly, both
314Cascoon, both
315Dustox, both
316Lotad, both
317Lombre, both
318Ludicolo, both
319Seedot, both
320Nuzleaf, both
321Shiftry, both
322Taillow, both
323Swellow, both
324Wingull, both
325Pelipper, both
326Ralts, both
327Kirlia, both
328Gardevoir, both
329Surskit, both
330Masquerain, both
331Shroomish, both
332Breloom, both
333Slakoth, both
334Vigoroth, both
335Slaking, both
336Nincada, both
337Ninjask, both
338Whismur, both
339Loudred, both
340Exploud, both
341Nosepass, both
342Sableye, both
343Mawile, both
344Aron, both
345Lairon, both
346Aggron, both
347Meditite, both
348Medicham, both
349Electrike, both
350Manectric, both
351Plusle, both
352Minun, both
353Roselia, both
354Gulpin, both
355Swalot, both
356Carvanha, both
357Sharpedo, both
358Wailmer, both
359Wailord, both
360Numel, both
361Camerupt, both
362Torkoal, both
363Spoink, both
364Grumpig, both
365Spinda, both
366Trapinch, both
367Vibrava, both
368Flygon, both
369Cacnea, both
370Cacturne, both
371Swablu, both
372Altaria, both
373Zangoose, both
374Seviper, both
375Barboach, both
376Whiscash, both
377Corphish, both
378Crawdaunt, both
379Feebas, both
380Milotic, both
381Castform, both
382Kecleon, both
383Shuppet, both
384Banette, both
385Duskull, both
386Dusclops, both
387Tropius, both
388Chimecho, both
389Absol, both
390Snorunt, both
391Glalie, both
392Spheal, both
393Sealeo, both
394Walrein, both
395Clamperl, both
396Huntail, both
397Gorebyss, both
398Bagon, both
399Shelgon, both
400Salamence, both
401Starly, both
402Staravia, both
403Staraptor, both
404Bidoof, both
405Bibarel, both
406Kricketot, both
407Kricketune, both
408Shinx, both
409Luxio, both
410Luxray, both
411Roserade, both
412Burmy, both
413Pachirisu, both
414Buizel, both
415Floatzel, both
416Cherubi, both
417Cherrim, both
418Shellos, both
419Gastrodon, both
420Ambipom, both
421Drifloon, both
422Drifblim, both
423Buneary, both
424Lopunny, both
425Mismagius, both
426Honchkrow, both
427Stunky, both
428Skuntank, both
429Chatot, both
430Spiritomb, both
431Gible, both
432Gabite, both
433Garchomp, both
434Hippopotas, both
435Hippowdon, both
436Skorupi, both
437Drapion, both
438Croagunk, both
439Toxicroak, both
440Carnivine, both
441Finneon, both
442Lumineon, both
443Snover, both
444Abomasnow, both
445Weavile, both
446Lickilicky, both
447Rhyperior, both
448Tangrowth, both
449Yanmega, both
450Gliscor, both
451Mamoswine, both
452Probopass, both
453Dusknoir, both
454Patrat, both
455Watchog, both
456Lillipup, both
457Herdier, both
458Stoutland, both
459Purrloin, both
460Liepard, both
461Munna, both
462Musharna, both
463Pidove, both
464Tranquill, both
465Unfezant, both
466Blitzle, both
467Zebstrika, both
468Roggenrola, both
469Boldore, both
470Gigalith, both
471Woobat, both
472Swoobat, both
473Drilbur, both
474Excadrill, both
475Audino, both
476Tympole, both
477Palpitoad, both
478Seismitoad, both
479Sewaddle, both
480Swadloon, both
481Leavanny, both
482Venipede, both
483Whirlipede, both
484Scolipede, both
485Cottonee, both
486Whimsicott, both
487Basculin, both
488Sandile, both
489Krokorok, both
490Krookodile, both
491Darumaka, both
492Darmanitan, both
493Maractus, both
494Dwebble, both
495Crustle, both
496Scraggy, both
497Scrafty, both
498Sigilyph, both
499Yamask, both
500Cofagrigus, both
501Trubbish, both
502Garbodor, both
503Solosis, both
504Duosion, both
505Reuniclus, both
506Ducklett, both
507Swanna, both
508Vanillite, both
509Vanillish, both
510Vanilluxe, both
511Deerling, both
512Sawsbuck, both
513Emolga, both
514Karrablast, both
515Escavalier, both
516Foongus, both
517Amoonguss, both
518Frillish, both
519Jellicent, both
520Alomomola, both
521Joltik, both
522Galvantula, both
523Ferroseed, both
524Ferrothorn, both
525Tynamo, both
526Eelektrik, both
527Eelektross, both
528Elgyem, both
529Beheeyem, both
530Litwick, both
531Lampent, both
532Chandelure, both
533Axew, both
534Fraxure, both
535Haxorus, both
536Cubchoo, both
537Beartic, both
538Shelmet, both
539Accelgor, both
540Stunfisk, both
541Mienfoo, both
542Mienshao, both
543Druddigon, both
544Pawniard, both
545Bisharp, both
546Bouffalant, both
547Heatmor, both
548Durant, both
549Deino, both
550Zweilous, both
551Hydreigon, both
552Larvesta, both
553Volcarona, both
554Bunnelby, both
555Diggersby, both
556Fletchling, both
557Fletchinder, both
558Talonflame, both
559Scatterbug, both
560Spewpa, both
561Vivillon, both
562Skiddo, both
563Gogoat, both
564Pancham, both
565Pangoro, both
566Furfrou, both
567Espurr, both
568Meowstic, both
569Honedge, both
570Doublade, both
571Aegislash, both
572Spritzee, both
573Aromatisse, both
574Swirlix, both
575Slurpuff, both
576Inkay, both
577Malamar, both
578Binacle, both
579Barbaracle, both
580Skrelp, both
581Dragalge, both
582Clauncher, both
583Clawitzer, both
584Helioptile, both
585Heliolisk, both
586Hawlucha, both
587Dedenne, both
588Goomy, both
589Sliggoo, both
590Goodra, both
591Klefki, both
592Phantump, both
593Trevenant, both
594Pumpkaboo, both
595Gourgeist, both
596Bergmite, both
597Avalugg, both
598Noibat, both
599Noivern, both
600Pikipek, both
601Trumbeak, both
602Toucannon, both
603Yungoos, both
604Gumshoos, both
605Grubbin, both
606Charjabug, both
607Vikavolt, both
608Crabrawler, both
609Crabominable, both
610Cutiefly, both
611Ribombee, both
612Rockruff, both
613Lycanroc, both
614Wishiwashi, both
615Mareanie, both
616Toxapex, both
617Mudbray, both
618Mudsdale, both
619Dewpider, both
620Araquanid, both
621Fomantis, both
622Lurantis, both
623Morelull, both
624Shiinotic, both
625Stufful, both
626Bewear, both
627Oranguru, both
628Passimian, both
629Wimpod, both
630Golisopod, both
631Sandygast, both
632Palossand, both
633Pyukumuku, both
634Komala, both
635Turtonator, both
636Togedemaru, both
637Mimikyu, both
638Bruxish, both
639Drampa, both
640Jangmo-o, both
641Hakamo-o, both
642Kommo-o, both
643Pichu, both
644Wynaut, both
645Budew, both
646Chingling, both
647Bonsley, both
648Mime Jr., both
649Mantyke, both
650Heatran, both
651Clefairy, both
652Clefable, both
653Vulpix, both
654Ninetales, both
655Jigglypuff, both
656Wigglytuff, both
657Snubbull, both
658Granbull, both
659Corsola, both
660Skitty, both
661Delcatty, both
662Luvdisc, both
663Glameow, both
664Purugly, both
665Minccino, both
666Cinccino, both
667Gothita, both
668Gothorita, both
669Gothitelle, both
670Oricorio, both
671Comfey, both
672Cleffa, both
673Igglybuff, both
674Azurill, both
675Litleo, both
676Pyroar, both
677Nidoran♀, female
678Chansey, female
679Kangaskhan, female
680Jynx, female
681Miltank, female
682Blissey, female
683Illumise, female
684Wormadam, female
685Vespiquen, female
686Froslass, female
687Petilil, female
688Lilligant, female
689Vullaby, female
690Mandibuzz, female
691Flabébé, female
692Floette, female
693Florges, female
694Salazzle, female
695Bounsweet, female
696Steenee, female
697Tsareena, female
698Nidorina, female
699Nidoqueen, female
700Smoochum, female
701Latias, female legend
702Happiny, female
703Cresselia, female legend
704Magnemite, genderless
705Magneton, genderless
706Voltorb, genderless
707Electrode, genderless
708Staryu, genderless
709Starmie, genderless
710Porygon, genderless
711Porygon2, genderless
712Shedinja, genderless
713Lunatone, genderless
714Solrock, genderless
715Baltoy, genderless
716Claydol, genderless
717Beldum, genderless
718Metang, genderless
719Metagross, genderless
720Bronzor, genderless
721Bronzong, genderless
722Magnezone, genderless
723Porygon-Z, genderless
724Rotom, genderless
725Phione, genderless
726Manaphy, genderless
727Klink, genderless
728Klang, genderless
729Klinklang, genderless
730Cryogonal, genderless
731Golett, genderless
732Golurk, genderless
733Carbink, genderless
734Minior, genderless
735Dhelmise, genderless
736Ditto, genderless
737Articuno, genderless
738Zapdos, genderless
739Moltres, genderless
740Mewtwo, genderless
741Mew, genderless
742Unown, genderless
743Raikou, genderless
744Entei, genderless
745Suicune, genderless
746Lugia, genderless
747Ho-Oh, genderless
748Celebi, genderless
749Regirock, genderless
750Regice, genderless
751Registeel, genderless
752Kyogre, genderless
753Groudon, genderless
754Rayquaza, genderless
755Jirachi, genderless
756Deoxys, genderless
757Uxie, genderless
758Mesprit, genderless
759Azelf, genderless
760Dialga, genderless
761Palkia, genderless
762Regigigas, genderless
763Giratina, genderless
764Darkrai, genderless
765Shaymin, genderless
766Arceus, genderless
767Victini, genderless
768Cobalion, genderless
769Terrakion, genderless
770Virizion, genderless
771Reshiram, genderless
772Zekrom, genderless
773Kyurem, genderless
774Keldeo, genderless
775Meloetta, genderless
776Genesect, genderless
777Xerneas, genderless
778Yveltal, genderless
779Zygarde, genderless
780Diancie, genderless
781Hoopa, genderless
782Volcanion, genderless
783Type: Null, genderless
784Silvally, genderless
785Tapu Koko, genderless
786Tapu Lele, genderless
787Tapu Bulu, genderless
788Tapu Fini, genderless
789Cosmog, genderless
790Cosmoem, genderless
791Solgaleo, genderless
792Lunala, genderless
793Nihilego, genderless
794Buzzwole, genderless
795Pheromosa, genderless
796Xurkitree, genderless
797Celesteela, genderless
798Kartana, genderless
799Guzzlord, genderless
800Necrozma, genderless
801Magearna, genderless
802Marshadow, genderless \ No newline at end of file
diff --git a/pokepronouns.cpp b/pokepronouns.cpp new file mode 100644 index 0000000..974889e --- /dev/null +++ b/pokepronouns.cpp
@@ -0,0 +1,115 @@
1#include <iostream>
2#include <string>
3#include <vector>
4#include <map>
5#include <twitter.h>
6#include <random>
7#include <chrono>
8#include <thread>
9#include <fstream>
10#include <yaml-cpp/yaml.h>
11
12int main(int argc, char** argv)
13{
14 if (argc != 2)
15 {
16 std::cout << "usage: pokepronouns [configfile]" << std::endl;
17 return -1;
18 }
19
20 std::string configfile(argv[1]);
21 YAML::Node config = YAML::LoadFile(configfile);
22
23 twitter::auth auth;
24 auth.setConsumerKey(config["consumer_key"].as<std::string>());
25 auth.setConsumerSecret(config["consumer_secret"].as<std::string>());
26 auth.setAccessKey(config["access_key"].as<std::string>());
27 auth.setAccessSecret(config["access_secret"].as<std::string>());
28
29 twitter::client client(auth);
30
31 std::vector<std::string> pokemon;
32 std::map<std::string, std::string> genders;
33 std::ifstream datafile(config["data"].as<std::string>());
34 if (!datafile.is_open())
35 {
36 std::cout << "Could not find data file." << std::endl;
37 return 1;
38 }
39
40 bool newgroup = true;
41 std::string line;
42 std::string curgroup;
43 while (getline(datafile, line))
44 {
45 if (line.back() == '\r')
46 {
47 line.pop_back();
48 }
49
50 int divider = line.find_first_of(",");
51 std::string name = line.substr(0, divider);
52 std::string gender = line.substr(divider + 2);
53
54 pokemon.push_back(name);
55 genders[name] = gender;
56 }
57
58 std::random_device randomDevice;
59 std::mt19937 rng{randomDevice()};
60 std::uniform_int_distribution<int> dist(0, pokemon.size() - 1);
61
62 for (;;)
63 {
64 std::cout << "Generating tweet" << std::endl;
65
66 std::string choice = pokemon[dist(rng)];
67 std::string gender = genders[choice];
68
69 std::string result;
70 if (gender == "both")
71 {
72 result = "Because not all {POKE} are male, it is incorrect to refer to a generic {POKE} as \"he\". Only a specific {POKE} may be a \"he\".";
73 } else if (gender == "male")
74 {
75 result = "As there are multiple {POKE}, it is incorrect to refer to a generic one as \"he\". It is acceptable to refer to a specific one as such.";
76 } else if (gender == "female")
77 {
78 result = "As there are multiple {POKE}, it is incorrect to refer to a generic one as \"she\". It is acceptable to refer to a specific one as such.";
79 } else if (gender == "male legend")
80 {
81 result = "Because {POKE} is legendary and gendered, it is acceptable to refer to it as \"he\".";
82 } else if (gender == "female legend")
83 {
84 result = "Because {POKE} is legendary and gendered, it is acceptable to refer to it as \"she\".";
85 } else if (gender == "genderless")
86 {
87 result = "{POKE} is genderless. It is incorrect to ever refer to it as \"he\" or \"she\".";
88 }
89
90 int tknloc;
91 while ((tknloc = result.find("{POKE}")) != std::string::npos)
92 {
93 std::string token = result.substr(tknloc+1, result.find("}")-tknloc-1);
94
95 result.replace(tknloc, result.find("}")-tknloc+1, choice);
96 }
97
98 result.resize(140);
99
100 try
101 {
102 client.updateStatus(result);
103 } catch (const twitter::twitter_error& e)
104 {
105 std::cout << "Twitter error: " << e.what() << std::endl;
106 }
107
108 std::cout << result << std::endl;
109 std::cout << "Waiting..." << std::endl;
110
111 std::this_thread::sleep_for(std::chrono::hours(11));
112
113 std::cout << std::endl;
114 }
115}
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp new file mode 160000
Subproject df906121dd862c0f704e44f28ee079158c431c4
diff --git a/vendor/yaml-cpp b/vendor/yaml-cpp new file mode 160000
Subproject beb44b872c07c74556314e730c6f20a00b32e8e