Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

MLP - Shipping Determinator

By: Erb1tux on Apr 7th, 2014  |  syntax: C++  |  size: 16.34 KB  |  views: 61  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Download current build here https://www.dropbox.com/s/fi2fkn68uixgkw1/Shipping-Determinator.exe
  2. //This source code will remain unchanged to ensure reproduceability
  3. //You might need to install .NET Framework & Visual C++ Redistributable to run this
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8.  
  9. #include <iostream>
  10. #include <sstream>
  11. #include <string>
  12. #include <fstream>
  13. using namespace std;
  14.  
  15. #define NAMES 819
  16.  
  17.  
  18.  
  19. int main(void){
  20.         char *names[NAMES] = { "Applejack", "Pinkie Pie", "Fluttershy", "Rainbow Dash", "Rarity", "Twilight Sparkle", "Apple Bloom", "Scootaloo", "Sweetie Belle", "Big McIntosh", "Braeburn", "Dr. Caballeron", "Caramel", "Mr. Carrot Cake", "Cheerilee", "Cheese Sandwich", "Coco Pommel", "Mrs. Cup Cake", "Filthy Rich", "Goldie Delicious", "Granny Smith", "Ms. Harshwhinny", "Hoity Toity", "Mane-iac", "Mayor Mare", "Ms. Peachbottom", "Photo Finish", "Prim Hemline", "Earth pony royal guards", "Sapphire Shores", "Silver Shill", "Suri Polomare", "Toe-Tapper", "Torch Song", "Daring Do", "Derpy", "Lightning Dust", "Flash Sentry", "Pegasus royal guards", "Fleetfoot", "Soarin", "Spitfire", "Princess Cadance", "Princess Celestia", "Princess Luna", "Fancy Pants", "Flam", "Flim", "Joe", "King Sombra", "Prince Blueblood", "Shining Armor", "The Great and Powerful Trixie", "Sunset Shimmer", "Unicorn royal guards", "Trenderhoof", "Babs Seed", "Diamond Tiara", "Featherweight", "Pipsqueak", "Pound Cake", "Pumpkin Cake", "Silver Spoon", "Snails", "Snips", "Twist", "Zipporwhill", "Aunt Orange", "Uncle Orange", "Pinkie's momCloudy Quartz", "Pinkie's dadIgneous Rock", "Pinkie's sisterMaud Pie", "Granny Smith's father", "Pokey Oaks", "Granny Smith's mother", "Sew 'n Sow", "Stinkin' Rich", "Apple Brown Betty", "Apple Bumpkin", "Apple Cider", "Apple Cinnamon", "Apple Cobbler", "Apple Dumpling", "Apple Fritter", "Apple Honey", "Apple Leaves", "Apple Pie", "Apple Rose", "Apple Split", "Apple Strudel", "Apple Top", "Auntie Applesauce", "Bushel", "Candy Apples", "Caramel Apple", "Florina", "Gala Appleby", "Golden Delicious", "Half Baked Apple", "Happy Trails", "Hayseed Turnip Truck", "Jonagold", "Lavender Fritter", "Magdalena", "Peachy Sweet", "Prairie Tune", "Red Delicious", "Red Gala", "Sundowner", "Wensley", "Twilight's dadNight Light Twilight's dad", "(poll)", "Twilight's momTwilight Velvet", "Rarity's dad", "Magnum", "Rarity's mom", "Pearl", "Pinkie's sisterLimestone Pie", "Pinkie's sisterMarble Pie", "Apple Bud", "Apple Crumble", "Apple Flora", "Apple Mint", "Apple Squash", "Liberty Belle", "Red June", "Sweet Tooth", "Ace", "Action Shot", "Affero", "All Aboard", "Aloe", "Amaranthine", "Ambrosia", "Amira", "Apple Bottom", "Apple Bread", "Apple Munchies", "Apple Slice", "Apricot Bow", "Baritone", "Beauty Brass", "Bell Perin", "Belle Star", "Berry Dreams", "Berry Frost", "Berry Icicle", "Berryshine", "Big Top", "Big Wig", "Professor Bill Neigh", "Bitta Blues", "Black Stone", "Blue Bonnet", "Blue Bows", "Bonnie", "Bottlecap", "Mr. Breezy", "Brindle Young", "Burnt Oak", "Caboose", "Caesar", "Candy Mane (poll)", "Candy Twirl", "Charcoal Bakes", "Charged Up", "Charlie Coal", "Chelsea Porcelain", "Cherry Berry", "Cherry Fizzy", "Cherry Jubilee", "Cherry Punch", "Cherry Strudel", "Chilly Puddle", "Chocolate Haze", "Classy Clover", "Cloudy Haze", "Cobalt", "Cobalt Shade", "Coco Crusoe", "Concerto", "Cormano", "Cornflower", "Creme Brulee", "Crescendo", "Crest Crown", "Dainty Dove", "Daisy", "Flashy Pony", "Dance Fever", "Davenport", "Doseydotes", "Dosie Dough", "Dry Wheat", "Eiffel", "Elphaba Trot", "Emerald Beacon", "Emerald Green", "Evening Star", "Felix", "Fiddly Faddle", "Filli Mellow", "Flounder", "Flurry", "Forest Spirit", "Frederick Horseshoepin", "Full Steam", "Fuzzy Slippers", "G. Raff", "Geri", "Gingerbread", "Ginger Gold", "Giselle", "Gizmo", "Golden Harvest", "Goldengrape", "Grace", "Grape Crush", "Grape Delight", "Green Jewel", "Mr. Greenhooves", "Haakim", "Harry Trotter", "Hay Fever", "Haymish", "Hazel Harvest", "The Headless Horse", "Herald", "Hercules", "Hinny of the Hills", "Hippocrates", "Dr. Hooves", "Hugh Jelly", "Icy Drop", "Jangles", "Jeff Letrotski", "Jesús Pezuña", "Jim Beam", "John Bull", "Jubileena", "Junebug", "Karat", "Kazooie", "Klein", "Lady Justice", "Lavender Blush", "Lavenderhoof", "Lemon Chiffon", "Lilac Links", "Lily Valley", "Lincoln", "Linked Hearts", "Little Po", "Lotus Blossom", "Lucky Clover", "Lyrica Lilac", "Majesty", "Dr. Mane Goodall", "Mango Juice", "Marigold", "Maroon Carrot", "Masquerade", "Master", "Maybelline", "Meadow Song", "Melilot", "Midnight Fun", "Millie", "Mint Swirl", "Mjölna", "Morton Saltworthy", "Night Watch", "Noteworthy", "Nurse Redheart", "Nurse Snowheart", "Nurse Sweetheart", "Nurse Tenderheart", "Oakey Doke", "Obscurity", "Octavia Melody", "Ol' Salt", "The Olden Pony", "Oregon Trail", "Orion", "Paisley Pastel", "Pampered Pearl", "Parish Nandermane", "Peachy Cream", "Pearly Stitch", "Persnickety", "Petunia", "Picture Perfect", "Pigpen", "Pine Breeze", "Pipe Down", "Pish Posh", "Pitch Perfect", "Play Write", "Post Haste", "Powder Rouge", "Pretty Vision", "Purple Haze", "Purple Wave", "Masseuse Pony", "Quake", "Raggedy Doctor", "Ragtime", "Randolph", "Reflective Rock", "Regal Candent", "Rick Shaw", "Roma", "Rose", "Rough Tumble", "Rough Wrangler", "Roxie", "Royal Riff", "Sam", "Savoir Fare", "Screwball", "Screwy", "Seasong", "Serena", "Shamrock", "Sheriff Silverstar", "Shoeshine", "Shortround", "Sir Pony Moore", "Sky View", "Smokestack", "Snappy Scoop", "Soigne Folio", "Soot Stain", "Spring Forward", "Spring Water", "Squeaky Clean", "Star Gazer", "Starlight", "Steamer", "Steel Wright", "Stella", "Sterling Silver", "Strawberry Cream", "Strawberry Ice", "Sun Streak", "Sunny Smiles", "Sunset Bliss", "Surf", "Swan Dive", "Sweetberry", "Sweetie Drops", "Symphony", "Temple Chant", "Theodore Donald \"Donny\" Kerabatsos", "Toffee", "Tourist Trap", "Tree Sap", "Tropical Spring", "Turf", "Twilight Sky", "Uncle Wing", "Vanilla Sweets", "Vera", "Vidala Swoon", "Wacky Hair Day and Spray", "Mr. Waddle", "Bowling Pony", "Walter", "Welch", "Welly", "Wetzel", "Wildwood Flower", "William Wright", "Wilma", "Winter Withers", "Wisp", "Mr. Zippy", "Earth Crystal Pony royal guards", "Agatha", "Amber Waves", "Amberlocks", "Arctic Lily", "Ardent", "Autumn Gem", "Berry Splash", "Castle", "Check Mate", "Crystal Arrow", "Dandy Brush", "Esmeralda", "Fleur de Verre", "Golden Glitter", "Goldilocks", "Honey Tone", "Honeycomb", "Ivory", "Jade", "Long Jump", "Night Knight", "Paradise", "Purple Polish", "Quicksilver", "Rapid Rush", "Rose Quartz", "Rubinstein", "Sapphire Rose", "Sugar Glass", "Sunshine Splash", "Toastie", "Winnow Wind", "Zirconic", "Pegasus Crystal Pony royal guards", "Glass Slipper", "Hope", "Opal Bloom", "Blaze", "Fire Streak", "High Winds", "Lightning Streak", "Misty Fly", "Silver Lining", "Surprise", "Wave Chill", "Crescent PonyCrescent Moon", "Manerick", "Whiplash", "April Showers", "Big Shot", "Blossomforth", "Blue October / Blueberry Muffin", "Bluebell", "Blueberry Cloud", "Blueberry Punch", "Bluebird Happiness", "Bon Voyage", "Brolly", "Buddy", "Bulk Biceps", "Candy Floss", "Cappuccino / Luke", "Cerulean Skies", "Chocolate Blueberry", "Cinnamon Swirl", "Cloud Break", "Cloud Kicker (poll)", "Cloud Showers", "Cloudchaser", "Cosmic", "Crafty Crate", "Cream Tangerine", "Deep Blue", "Descent", "Dewdrop", "Dizzy Twister (poll)", "Downdraft", "Drizzle", "Dumb-Bell", "Dust Devil", "Eff Stop", "Electric Blue", "Endless Clouds", "Flitter", "Golden Glory", "Graceful Falls", "Grape Soda", "Great Scott", "Helia", "High Note", "High Spirits", "Honey Rays", "Hoops", "Jack Hammer", "Jetstream", "Juicy Fruit", "Laurette", "Lavender Skies", "Lightning Bolt (poll)", "Cloudsdale Cheer Pony", "Lilac Sky", "Lime Jelly", "Lucy Packard", "Madden", "Merry May", "Midnight Strike", "Milky Way", "Nana Knits", "Nightingale", "Pegasus Dad", "Nightjar", "Northern Lights", "Orange Box", "Parasol (poll)", "Parula", "Pink Cloud", "Pizzelle", "Prism Glider", "Pumpkin Tart", "Q. T. Prism", "Rain Dance", "Rainbow Drop", "Rainbow Strike", "Rainbow Swoop", "Rainbowshine", "Ralph", "Riverdance", "Rivet", "Rosewing", "Sandstorm", "Sassaflash", "Score", "Serenity", "Sightseer", "Silver Script", "Silverspeed", "Silverwing", "Sky Flower", "Skyra", "Slipstream", "Snow Flight", "Snowslide", "Special Delivery", "Spring Showers", "Spring Skies", "Sprinkle Medley", "Star Hunter", "Starburst", "Stardancer", "Starsong / Sugar Apple", "Stormfeather", "Strawberry Sunrise", "Sugar Twist", "Sunburst", "Sunlight", "Cloudsdale Cheer Pony", "Sunlight Spring", "Sunny Rays", "Sunshower Raindrops", "Sunstone", "The Tenth Doctor / Doctor Whooves #3", "Thorn", "Thunderlane", "Tiger Lily", "Tin Tailor", "Tracy Flash / Shutterfly", "Tropical Storm", "Wild Fire", "Cadet #2", "Wild Flower", "Wind Chill", "Wing Wishes", "Allie Way", "Amethyst Star", "Apple Polish", "Apple Stars", "Arpeggio", "Ballad", "Banana Fluff", "Black Marble", "Blue Belle", "Blue Moon", "Brass Blare", "Bright Bulb", "Charm", "Chocolate Sun", "Chocolate Tail", "Cinnabelle", "Cold Front", "Comet Tail", "Crystal Clear", "Diamond Mint", "DJ Pon-3", "Doctor Stable", "Earl Grey", "Eliza", "Faraday", "Film Reel", "Flank Sinatra", "Fleur Dis Lee", "Fly Wishes", "Fuchsia Fizz", "Gold Slipper", "Graphite", "Holly Dash", "Hors D'oeuvre", "The Inquisitor", "Jet Set", "Lemon Hearts", "Lemony Gem", "Lyra Heartstrings", "Marey Fetlock", "Maxie / Madmax", "Minuette", "Monochrome Sunset", "Nixie", "Noble Laureate", "Nook", "Ocean Breeze", "Orchid Dew", "Banner VendorPeachy Pitt", "Perfect Timing", "Perry Pierce", "Pinprick", "Pixie", "Ponet", "Poppycock", "Precious", "Primrose", "Pristine", "Rare Find", "Raven", "Red Rose", "Rhythm / Night Shade", "Rising Star", "Rosewood Brook", "Royal Ribbon (poll)", "Sea Spray", "Sea Swirl", "Silver Spanner", "South Pole", "Spring Fresh", "Star Bright", "Star Dream / Sky Dream", "Strawberry Lime", "Sugarberry", "Sweet Dreams", "Top Notch", "Twinkleshine", "Upper Crust", "Vance Van Vendington", "Violet Velvet", "Written Script", "Amethyst Beat", "Apple Bytes", "Archer", "Atlas", "Aura", "Bee Bop", "Berry Pinch (poll)", "Bloo", "Blueberry Cake", "Brown Sugar", "Button Mash", "Caramel Coffee", "Cheery", "Chip Mint", "Coronet", "Cotton Cloudy (poll)", "Cotton Top", "Cream Puff", "Cyan Skies", "Dinky Doo (poll)", "Dipsy", "Finish Line", "Firelock", "Fruitbasket", "Grace Lightning", "Green Daze", "Honey Drop", "Hot Wheels", "Key Lime", "Lance", "Lemon Daze", "Lemon Scratch", "Lickety Split", "Lily Dache", "Mango Dash", "Melody", "Noi (poll)", "Nursery Rhyme", "Peachy Petal", "Peachy Pie", "Pinkie Feather", "Piña Colada (poll)", "Pomegranate", "Princess Erroria (poll)", "Purpletastic / Purpleskies", "Rainy Feather", "Royal Blue", "Rumble", "Shady Daze", "Shining Star", "Strike", "Sugar Plum", "Sun Glimmer", "Sunny Daze", "Sweet Pop", "Sweet Tart", "Tootsie Flute (poll)", "Tornado Bolt (poll)", "Treasure", "Teacher's Pet", "Truffle Shuffle", "Cosmic", "Crafty Crate", "Crescent Moon", "Fluttershy", "Helia", "Jack Hammer", "Lightning Bolt (poll)", "Lyra Heartstrings", "Minuette", "Rainbow Dash", "Rainbow Swoop", "Rarity", "Raven", "Rivet", "Sassaflash", "Sprinkle Medley", "Star Hunter", "Sunburst", "The Tenth Doctor / Doctor Whooves #3", "Thunderlane", "Tin Tailor", "Twilight Sparkle", "Berryshine", "Caramel", "Emerald Green", "Golden Harvest", "Dr. Hooves", "Lucky Clover", "Master", "Meadow Song", "Noteworthy", "Peachy Sweet", "Tourist Trap", "Twilight Sky", "Twilight Sparkle", "Wisp", "Goldengrape", "Lucy Packard", "Master", "Orion", "Red Gala", "Savoir Fare", "Sir Pony Moore", "Snails", "Swan Dive", "Applejack", "Aura", "Aura", "Berry Pinch (poll)", "Big McIntosh", "Cheerilee", "Cheese Sandwich", "Cloudchaser", "Cotton Cloudy (poll)", "Derpy", "Flitter", "Fluttershy", "Liberty Belle (poll)", "Lyra Heartstrings", "Maud Pie", "Minuette", "Pinkie Pie", "Piña Colada (poll)", "Princess Erroria (poll)", "Rainbow Dash", "Rainy Feather", "Rarity", "Red June (poll)", "Scootaloo", "Strawberry Ice", "Sweetie Belle", "Sweetie Drops", "Tootsie Flute (poll)", "Tornado Bolt (poll)", "Twilight Sparkle", "Cabbie", "Bellhop", "Astro Pony", "Security Guard", "Little Pony", "Prince Blue Dream", "Chancellor Puddinghead", "Smart Cookie", "Commander Hurricane", "General Blazing Donut Glaze", "Private Pansy", "Princess Golden Dream", "Clover the Clever", "Moondancer", "Princess Platinum", "Star Swirl the Bearded", "Unicorn King", "Apple Brioche", "Apple Cinnamon Crisp", "Apple Tart", "Uncle Apple Tart", "Babs Seed's big sis", "Baked Apples", "Bumpkin", "Calamity Mane", "Colonel Waffle", "Crystal Queen", "Ernie", "Fili-Second", "Flourish Prose", "Granny Pie", "Masked Matter-Horn", "Mistress Mare-velous", "Mr. Kingpin", "Namby-Pamby", "Nana Pinkie", "Aunt Pine Apple", "Quilland Ink", "Radiance", "Saddle Rager", "Thornhoof", "Wild Bull Hickok", "Zapp", "Admiral Fairweather", "Admiral Fairy Flight", "Colonel Purple Dart", "Commander Easyglider", "Flaire De Mare", "General Firefly", "General Flash", "Rapidfire" };
  21.         char *namebuffer = { "" };
  22.         size_t roll, swapcount, count, count2, mem1, mem2,mem3;
  23.         long float scforprint;
  24.         long unsigned int lel;
  25.         char buffer[81], filename[81] = { "TTTS-" };
  26.         clock_t estTime = 0;
  27.         FILE *file;
  28.  
  29.         //Getting post number, creating filename, calculating total swaps
  30.         printf("Enter OP:");
  31.         gets_s(buffer, 81);
  32.         for (count = 0; buffer[count] != '\0'; count++)
  33.                 filename[count + 5] = buffer[count];
  34.         filename[count + 5] = '.';
  35.         filename[count + 6] = 't';
  36.         filename[count + 7] = 'x';
  37.         filename[count + 8] = 't';
  38.         filename[count + 9] = '\0';
  39.         sscanf(buffer, "%d", &roll);
  40.         printf("Initalising rand with >>%d\n", roll);
  41.         srand(roll);
  42.         swapcount = (((rand() % roll)*(rand() % roll))*(rand() % roll) % (roll*roll))*roll;
  43.         scforprint = (long float(swapcount) / 1000000000) * 60;
  44.         lel = swapcount * 60;
  45.         //Measuring time for 10M swaps to estimate the time
  46.         estTime = clock();
  47.         for (count = 0; count < 10000000; count++)
  48.         {
  49.                 namebuffer = names[mem1 = rand() % NAMES];
  50.                 names[mem1] = names[mem2 = rand() % NAMES];
  51.                 names[mem2] = namebuffer;
  52.         }
  53.         estTime = (clock() - estTime) * 100 * scforprint;
  54.  
  55.         //Printing the Information to the screen
  56.         printf("Swap Count: ~%.3lf billion\n", scforprint);
  57.         printf("EST: %d min %d sec\n", estTime / 60000, (estTime - ((estTime / 60000) * 60000)) / 1000);
  58.         printf("Press enter to start swapping");
  59.         gets_s(buffer, 81);
  60.         //Swapping
  61.         mem3 = 1;
  62.         estTime = clock();
  63.         for (count2 = 0; count2 < 60; count2++){
  64.                 for (count = 0; count < swapcount; count++)
  65.                 {
  66.                         namebuffer = names[mem1 = rand() % NAMES];
  67.                         names[mem1] = names[mem2 = rand() % NAMES];
  68.                         names[mem2] = namebuffer;
  69.  
  70.                         if ((count % 1000000 == 0) && count != 0)
  71.                                 printf("Swap: %dM\n", mem3++);
  72.                 }
  73.         }
  74.         //Displaying elapsed time
  75.         estTime = clock() - estTime;
  76.         //DONE message
  77.         for (count = 0; count < 160; count++)
  78.                 printf("#");
  79.         printf("\t\t\t\tDONE\n");
  80.         for (count = 0; count < 160; count++)
  81.                 printf("#");
  82.         //Printing elapsed time
  83.         printf("Time passed: %d min %d sec %d ms\n", estTime / 60000, (estTime - ((estTime / 60000) * 60000)) / 1000, estTime - ((estTime - ((estTime / 60000) * 60000)) / 1000) * 1000);
  84.         printf("Press Enter to get the ship-list\n");
  85.         gets_s(buffer, 81);
  86.         //Printing top 5 + worst ship + lone wolf
  87.         for (count = mem1 = 0; count < 10; count += 2)
  88.         {
  89.                 printf("Rank #%d\n%s X %s\n\n", mem1 + 1, names[count], names[count + 1]);
  90.                 mem1++;
  91.         }
  92.         printf("Worst Ship: %s X %s\n\n", names[NAMES - 3], names[NAMES - 2]);
  93.         printf("Lone wolf: %s\n\n", names[NAMES - 1]);
  94.         printf("Reference can be found here:\nhttp://mlp.wikia.com/wiki/List_of_ponies/fast\n\nEnter to write the complete list into %s", filename);
  95.         gets_s(buffer, 81);
  96.         //Creating new file with filename created before
  97.         file = fopen(filename, "w");
  98.         //Writing complete list into the file
  99.         fprintf(file, "The true shipment ranking for Thread #%d\n", roll);
  100.         fprintf(file, "Reference List: http://mlp.wikia.com/wiki/List_of_ponies/fast \n\n");
  101.         fprintf(file, "Swapped %d times\nResults generated in %d min %d sec %d ms\n\n", lel, estTime / 60000, (estTime - ((estTime / 60000) * 60000)) / 1000, estTime - ((estTime - ((estTime / 60000) * 60000)) / 1000) * 1000);
  102.         for (count = mem1 = 0; count + 1 < NAMES; count += 2)
  103.         {
  104.                 fprintf(file, "Rank #%d\n%s X %s\n\n", mem1 + 1, names[count], names[count + 1]);
  105.                 mem1++;
  106.         }
  107.         fprintf(file, "Lone Wolf: %s", names[NAMES - 1]);
  108.         //closing file
  109.         fclose(file);
  110.         printf("DONE\n");
  111.         //
  112.         printf("Enter to close\n");
  113.         gets_s(buffer, 81);
  114.         printf("Later faggit\n");
  115. }