#include "mad-libs.h" // Yes, these are mostly made up and/or wrong. const char madLibsNouns[NOUN_COUNT][MAD_LIBS_MAX] = { "infundibulum", "bike", "church", "pinball", "shark", "finger", "trolley", "loo", "khazi", "science", "philosophy", "math", "wingus", "fartulum", "gorilla", "glue", "turdus", "acid", "weed", "fungus", "algorithm", "schrodinger", "irregularist", "bioliquidifeazion", "arson", "art", "triangle", "fuck", "mold", "wyoming", "duck", "goose", "fish", "wheel", "gack", "poop", "vin-dit", "duffle", "otorhinolaryngology", "spaghetti", "terrorism", "membrane", "object", "cow", "sandwich", "tralfamadore" }; const char madLibsVerbs[VERB_COUNT][MAD_LIBS_MAX] = { "conpockulate", "vomit", "ejackulate", "dualmakulate", "fart", "run", "hide", "hiss", "piss", "walk", "backwards", // Yes, backwards shall be a verb! "forwards", // Again hehehe "jump", "fall", "fly", "sidewalk", "slift", "sniff", "piff", "conmanoulrlate", "quack", "yell", "spin", "spit", "fuck", "consume", "yell", "associating", "steal", "jaywalk", "burn", "moo", "eka-ka-ka", "punch" }; const char madLibsAdverbs[ADVERB_COUNT][MAD_LIBS_MAX] = { "speedi", "pacedfullili", "admorsfullili", "analsisli", "dupaleli", "quickli", "slowli", "snailenleli", "painfulli", "very", "torroe", "eispfulli", "gentli", "badli", "goodli", "bearli", "skilllessli", "systematicalli", "psychosomaticalli", "dialecticalli", "foolishli", "samanthalli", "meowfullili", "pooppfulli", "illuminatedli", "pissfuli", "poopfuli" }; const char madLibsAdjectives[ADJECTIVE_COUNT][MAD_LIBS_MAX] = { "skibidi", "neolimbpengintical", "surreal", "reverse", "chrono-synclastic", "purple", "pink", "nurple", "macro", "cracko", "dualo", "smelli", "maximus", "moronic", "mundane", "grandeural", "neon", "irregular", "stuppa", "fuck", "blissfull", "kind", "bald", "mini", "idealistic", "materialistic", "nincompoop", "granfalloon", "yellow", "mellow", "spicy", "psyadelic", "nasty", "obdormitionic", "dialectical", "cryptic", "numbing", "irregular" }; Seed getRandomMapLibsWord(char* outputString, char type, Seed seed) { // Random type. if (type == 'r') { char types[] = {'n', 'v', 'a', 'j'}; type = types[FT_RANDOM16(seed) % sizeof(types)]; } FT_RANDOM16(seed); switch (type) { case 'n': strncpy(outputString, madLibsNouns[seed % NOUN_COUNT], MAD_LIBS_MAX); break; case 'v': strncpy(outputString, madLibsVerbs[seed % VERB_COUNT], MAD_LIBS_MAX); break; case 'a': strncpy(outputString, madLibsAdverbs[seed % ADVERB_COUNT], MAD_LIBS_MAX); break; case 'j': strncpy(outputString, madLibsAdjectives[seed % ADJECTIVE_COUNT], MAD_LIBS_MAX); break; case '@': outputString[0] = '@'; outputString[1] = '\0'; break; default: outputString[0] = '\0'; break; } return seed; } Seed mapLibs(char* outputString, const char* formatString, size_t maxSize, Seed seed) { int outputStringIndex = 0; bool skipNext = false; memset(outputString, 0, maxSize); for (int index = 0; index < maxSize; ++index) { if (formatString[index] == '\0') { break; } if (!skipNext && formatString[index] == '@' && index < maxSize - 1) { skipNext = true; char type = formatString[index + 1]; char randomWord[MAD_LIBS_MAX]; seed = getRandomMapLibsWord(randomWord, type, seed); for (int index2 = 0; index2 < MAD_LIBS_MAX; ++index2) { if (randomWord[index2] == '\0') { break; } outputString[outputStringIndex] = randomWord[index2]; ++outputStringIndex; } } else { if (!skipNext) { outputString[outputStringIndex] = formatString[index]; ++outputStringIndex; } skipNext = false; } } // "Memory safe" outputString[maxSize - 1] = '\0'; return seed; }