Stock Market Simulator main e8c3612
A game that provides a realistic stock buying experience with unpredictable trends to test investment strategies.
Loading...
Searching...
No Matches
names.cpp
Go to the documentation of this file.
1/// @file names.cpp
2/// Implementation of the stock name generation functions.
3/*
4This program is free software: you can redistribute it and/or modify it under the
5terms of the GNU Lesser General Public License as published by the Free Software
6Foundation, either version 3 of the License, or (at your option) any later version.
7
8This program is distributed in the hope that it will be useful, but WITHOUT ANY
9WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
12You should have received a copy of the GNU Lesser General Public License along with this
13program. If not, see <https://www.gnu.org/licenses/>.
14*/
15#include "names.h"
16
17#include "random_price.h"
18
19#include <algorithm>
20using namespace std;
21
22string const category_list[category_list_size] = {"Adv&Market", "Aero&Def", "Airlines",
23 "RenewEnergy", "Auto", "Banks", "Biotech", "Broadcast", "Casinos&Gaming",
24 "E-Commerce", "FinServices", "Food&Beverage", "Healthcare", "Tech", "RealEstate",
25 "Retail", "Telecom"};
26
27/**
28 * @brief Generates a set of unique stock names based on the specified category and
29 * quantity.
30 * @param category The category index `[0 to category_list_size-1]` indicating the stock
31 * category.
32 * @param num The number of stock names to generate.
33 * @return A vector of unique stock names.
34 * @note There is a possibility of having an infinite loop if we called
35 * `generate_names(0,99999999999999)`.
36 */
37vector<string> generate_name(unsigned int category, unsigned int num) {
38 // List of suffixes for stock names
39 vector<string> const suffixes = {"Holdings", "Ltd", "Group", "Corp", "Inc",
40 "Enterprises", "Solutions", "Services"};
41 vector<string> companyNames;
42
43 switch (category) {
44 case 0: { // Generate a name for Adv&Market category
45 vector<string> words = {"Alpha", "Beta", "Gamma", "Delta", "Epsilon",
46 "Innovate", "Solutions", "Strategies", "Impact", "Growth", "Creative",
47 "Digital", "Marketing", "Brand", "Communications", "Buzz", "Genius",
48 "Company", "Tech", "Global", "Dynamic", "Infinite", "Revolution",
49 "Evolution", "Power", "Innovation", "Inspire", "Transform", "Future",
50 "Vision", "Progress", "Solutions", "Excellence", "Advantage", "Success",
51 "Fortune", "Ventures", "Endeavor", "Pioneers", "Prosperity", "Synergy",
52 "Advertising", "Media", "Promotion", "Campaign", "Creative", "Strategy",
53 "Market", "Audience", "Brand", "Digital", "Social", "Influencer"};
54
55 pickUniqueNames(num, words, suffixes, companyNames);
56 break;
57 }
58 case 1: { // Generate a name for Aero&Def category
59 vector<string> words = {"Zeus", "Thor", "Hulk", "Loki", "Ironman",
60 "Captain", "America", "Valkyrie", "Odin", "Hawkeye", "Levi",
61 "Black Widow", "Vegeta", "Buu", "Sasuke", "Hephaestus", "Ares",
62 "Poseidon", "Apollo", "Hera", "Athena", "Artemis", "Hades", "Hercules",
63 "Mjolnir", "Stormbreaker", "Goku", "Shield", "Infinity", "Aizen",
64 "Panther", "Anya", "Yor", "Goalkeeper", "Itachi", "Web", "Ant", "Man",
65 "Groot", "Zhongli", "Lord", "Naruto", "Gojo", "Ichigo", "Kakashi",
66 "Saitama", "Witch", "Air", "Wings", "Flight", "Rocket", "Defender",
67 "Zeon", "Defense", "Airborne", "Aerospace", "Missile", "Anaheim",
68 "Supersonic", "Bomber", "Interceptor", "Pilot", "Sukuna", "Stealth",
69 "Warrior", "Aircraft", "Airman", "Seiya", "Sanji", "Airbase",
70 "Stratosphere", "Airshow", "Combat", "Zoro"};
71
72 pickUniqueNames(num, words, suffixes, companyNames);
73 break;
74 }
75 case 2: { // Generate a name for Airlines category
76 vector<string> words = {"Sky", "Wings", "Fly", "Jet", "Air", "Cloud",
77 "Aviation", "Aero", "Flight", "High", "Travel", "Skyward", "Lift",
78 "Airborne", "Airline", "Birds", "Wingman", "Up", "Glide", "Airbus",
79 "Propel", "Cmefly", "Airfield", "Skyline", "Airspeed", "Aircrew",
80 "Airshow", "Airspace", "Airway", "Aviator", "Airworthy", "Airstrip",
81 "Airman", "Airfare", "Airbag", "Airbus", "Airtime", "Takeoff",
82 "Landing", "Pilot", "Cabin", "Cockpit", "Airlift", "Airflow",
83 "Airliner", "Jetsetter", "Airship", "Airterminal", "Airsteward",
84 "Airstrike", "Airtaxi", "Airway"};
85
86 pickUniqueNames(num, words, suffixes, companyNames);
87 break;
88 }
89 case 3: { // Generate a name for RenewEnergy&storage category
90 vector<string> words = {"Solar", "Wind", "Eco", "Green", "Renew", "Sunny",
91 "Breezy", "Clean", "Efficient", "Power", "Sustainable", "Energize",
92 "Hydro", "Turbine", "Electric", "Sunshine", "Gust", "Nature", "Windy",
93 "Responsible", "Bio", "Geothermal", "Radiant", "Planet", "Emission",
94 "Sizzle", "Zap", "Wave", "Harvest", "Air", "Biomass", "Carbon",
95 "Efficiency", "Giga", "Innovate", "Mega", "Neutron", "Photon",
96 "Renewable", "Revolve", "Spark", "Thermal", "Vortex", "Watt", "Zero",
97 "PowerPunch", "JoltJester", "BatteryBanter", "EnergeticLaughs",
98 "StorageSpark", "ChargeChuckler", "HumorHavoc", "FunnyFuel",
99 "ZappyZingers", "WittyWatt", "EnergyVault", "PowerCell",
100 "StorageSolutions", "ChargeMaster", "BatteryTech", "PowerHub",
101 "EcoStorage", "RenewableEnergy", "EfficientEnergies", "EnergyVault",
102 "PowerCell", "StorageSolutions", "ChargeMaster", "BatteryTech",
103 "PowerHub", "EcoStorage", "RenewableEnergy", "EfficientEnergies"};
104
105 pickUniqueNames(num, words, suffixes, companyNames);
106 break;
107 }
108 case 4: { // Generate a name for Auto category
109 vector<string> words = {"Speed", "Drive", "Auto", "Wheel", "Car", "Turbo",
110 "Vroom", "Cruise", "Road", "Engine", "Flash", "Dom", "OnTheRoad",
111 "Lightning", "Muskla", "Sleek", "Gizmo", "Adrenaline", "Fuel", "Bumper",
112 "Sprint", "Beep", "Honk", "Mile", "Highway", "Chassis", "Rev", "Piston",
113 "Gear", "Accelerate", "Tyre", "Brake", "Transmission", "Steering",
114 "Ignition", "Convertible", "Stallion", "Cruiser", "Scooter", "Gadget",
115 "Horsepower", "Dashboard", "Gearshift", "Muscle", "Auto", "Toyopa",
116 "Honba", "Niisan", "Chevrolay", "Audio", "Mercidez", "BMX", "Lexxus",
117 "Subaro", "Kio", "Cadillax", "Mitsubi", "Folksvagen", "Porshee", "Jeep",
118 "Lambor", "Bentleey", "sherrari", "Rolling Roy", "Astton Lafite",
119 "Mazdah", "Volvo", "Infinitii", "Alfa Romeo", "Lexus", "Sloth",
120 "Land Hover", "Lincollin", "GMC", "Aubii", "Buddatti", "Maserahhi",
121 "McLaren", "Rage Rover"};
122
123 pickUniqueNames(num, words, suffixes, companyNames);
124 break;
125 }
126 case 5: { // Generate a name for Banks category
127 vector<string> words = {"Capital", "Trust", "Secure", "Savings", "Finest",
128 "Elite", "Prosper", "Advance", "Global", "Infinite", "Vault", "Wealth",
129 "First", "Premier", "Prime", "Harmony", "Velocity", "Pinnacle", "Noble",
130 "Fortune", "Evergreen", "Summit", "Frontier", "Excellence", "Sovereign",
131 "Centric", "Vantage", "Opus", "Paragon", "Zenith", "Crest", "Apex",
132 "Aegis", "Legacy", "Crown", "Krupt", "Meridian", "Encompass", "Equity",
133 "Stellar", "Eclipse"};
134
135 pickUniqueNames(num, words, suffixes, companyNames);
136 break;
137 }
138 case 6: { // Generate a name for Biotech category
139 vector<string> words = {"GeneWorks", "BioSolutions", "CellTech", "InnoGene",
140 "BioGenius", "VitaLab", "BioFusion", "GeneSynth", "EcoGene", "LifeTech",
141 "BioMedix", "GenoInnovate", "BioNova", "GeneQuest", "BioSpark",
142 "InnoCell", "BioRevolution", "GeneSense", "BioVital", "GeneXcel",
143 "BioMatrix", "GeneScribe", "InnoGene", "BioNexus", "GeneLink",
144 "BioTechne", "SynthoGene", "GeneWave", "BioGenome", "InnoBio",
145 "GenePrime", "BioSpectra", "InnoCell", "BioPlasma", "GeneTech",
146 "BioQuest", "GeneGenius", "InnoGene", "BioCure", "GeneCraft"};
147
148 pickUniqueNames(num, words, suffixes, companyNames);
149 break;
150 }
151 case 7: { // Generate a name for Broadcast category
152 vector<string> words = {"SoundBlast", "MediaMania", "EchoFiesta",
153 "ChannelChaos", "AudioCircus", "GlobalGiggles", "TalkTunes",
154 "Listen2Laughs", "WaveWhimsy", "LiveLaughs", "Listen2Me",
155 "StreamSmiles", "VoiceVortex", "RadioRuckus", "BroadcastBanter",
156 "SonicSilliness", "AudioAmusement", "MediaMirth", "TalkTickles",
157 "AudioWhoopee", "ListenUpLaughs", "StreamSilliness", "SoundPulse",
158 "ChannelChuckles", "RadioRoars", "VoiceVibe", "EchoEntertainment",
159 "AudioStreamers", "MediaLaughs", "TalkTrek", "WaveWire",
160 "BroadcastBliss", "SonicStreamers", "SoundSerendipity",
161 "AudioAmusement", "ListenInLaughs", "StreamCenter", "VoicePulse",
162 "RadioRadar", "ChannelWave", "SoundSync", "SoundWave", "MediaCast",
163 "EchoStream", "ChannelConnect", "AudioVision", "GlobalBroadcast",
164 "TalkTime", "Listen2me", "WaveLink", "LiveAudio", "StreamSquad",
165 "VoiceVortex", "RadioRevolution", "BroadcastHub", "SonicSignal",
166 "AudioSphere", "MediaMingle", "TalkBox", "AudioWave", "ListenUp",
167 "StreamStation", "SoundPulse", "ChannelChatter", "RadioRealm",
168 "VoiceVibe", "EchoChannel", "AudioStream", "MediaVox", "TalkTrek",
169 "WaveWire", "BroadcastBox", "SonicStream", "SoundSphere", "AudioMingle",
170 "ListenIn", "StreamCenter", "VoicePulse", "RadioRadar", "ChannelWave",
171 "SoundSync"};
172
173 pickUniqueNames(num, words, suffixes, companyNames);
174 break;
175 }
176 case 8: { // Generate a name for Casinos&Gaming category
177 vector<string> words = {"LuckyBets", "GameGalore", "SpinToWin",
178 "CasinoCraziness", "JackpotJamboree", "DiceyDelight", "GamblingGiggles",
179 "CardComedy", "WagerWhimsy", "WinningLaughs", "ChipsChuckles",
180 "PlayfulPoker", "SlotSilliness", "BingoBonanza", "RouletteRiot",
181 "CasinoComedy", "GamingGalore", "BetBloopers", "GamblingGalore",
182 "LaughingLottery", "SpinSmiles", "JokerJapes", "BlackjackBliss",
183 "GameGiggles", "LuckyLaughter", "Splash of Clans", "DiceDelirium",
184 "WagerWhoopee", "CardCapers", "WinningWhimsy", "ChipsChortle",
185 "GTB VII", "GTC V", "HunterXHunter", "PlayfulPoker", "SlotSilliness",
186 "BingoBanter", "RouletteRomp", "CasinoChuckles", "Monster Cooker World",
187 "GamingGalore", "BetBloopers", "GamblingGalore", "LaughingLottery",
188 "SpinSniggers", "Defence on Titan", "LuckyCasino", "GameCentral",
189 "SpinWin", "CasinoHub", "JackpotCity", "Denshin Impact",
190 "Splash Royale", "DiceGaming", "GamblingClub", "CardMaster",
191 "WagerZone", "WinningStreak", "Road Fighter XI", "ChipsPalace",
192 "PlayfulGaming", "SlotParadise", "BingoEmpire", "RouletteRealm",
193 "Sudoku", "CasinoWorld", "GamingZone", "BetMasters", "GamblingKingdom",
194 "LuckyLottery", "Cooking Papa", "SpinPalace", "JokerCasino",
195 "BlackjackElite", "GameMaster", "LuckyWin", "ForNight", "WeCraft",
196 "DiceGaming", "WagerZone", "CardMaster", "WinningStreak", "ChipsPalace",
197 "Hokemon", "PlayfulGaming", "SlotParadise", "BingoEmpire",
198 "RouletteRealm", "CasinoWorld", "MustLose", "GuaranteedWin",
199 "GamingZone", "BetMasters", "GamblingKingdom", "LuckyLottery",
200 "SpinPalace", "Nario"};
201
202 pickUniqueNames(num, words, suffixes, companyNames);
203 break;
204 }
205 case 9: { // Generate a name for E-Commerce category
206 vector<string> words = {"Shopaholic", "Buy-o-matic", "DealDiva",
207 "CartoonCraze", "SaleSensation", "Hundredcents", "Thousandcents",
208 "DiscountDelight", "BargainBonanza", "OnlineOlympics", "ShipShop",
209 "PricelessPurchases", "SkyDog", "Bmazon", "ClickComedy", "eBayLaughs",
210 "AmazonAmusement", "ShoppingShenanigans", "VirtualVortex",
211 "SaleSlapstick", "Buyer'sBliss", "DealDazzle", "CartoonCapers",
212 "ShopSmart", "SkyCat", "BuyDirect", "DealFinder", "CartConnect",
213 "SaleSpot", "DiscountMart", "BargainHunt", "OnlinePlaza", "ShipRight",
214 "PricePoint", "ClickCentral", "eBayDeals", "AmazonEmporium",
215 "ShoppingSolutions", "VirtualMarket", "SaleSolutions",
216 "Buyer'sParadise", "DealHaven", "CartConnect"};
217
218 pickUniqueNames(num, words, suffixes, companyNames);
219 break;
220 }
221 case 10: { // Generate a name for FinServices category
222 vector<string> words = {"CashComedy", "Dollar Dazzle", "FinanceFunnies",
223 "WealthWhimsy", "MoneyMaster", "InvestmentLaughs", "Savings Smiles",
224 "FunnyFunds", "PennyPunchlines", "BillsBanter", "CapitalConsulting",
225 "WealthManagement", "FinancialSolutions", "MoneyMatters",
226 "InvestmentAdvisors", "SecureBanking", "SmartFunds",
227 "EconomicConsultancy", "FinancialExperts"};
228
229 pickUniqueNames(num, words, suffixes, companyNames);
230 break;
231 }
232 case 11: { // Generate a name for Food&Beverage category
233 vector<string> words = {"Tasty", "Delicious", "Yummy", "Flavorful",
234 "Gourmet", "Savor", "Flavors", "Satisfy", "Cuisine", "Culinary",
235 "Taste", "Palate", "Savoring", "Bites", "Mouthwatering", "Bakery",
236 "Cafe", "Catering", "Dining", "Juicy", "Zesty", "Fresh", "Spice", "Sip",
237 "Brew", "Crave", "Snack", "Seasoned", "Saucy", "Wholesome", "Nourish",
238 "Treats", "Feast", "Chew", "Munch", "Appetite", "Sip", "Gobble", "Gulp",
239 "Plate", "Yum", "Morsel", "Nibble", "Digest", "Mouthful", "Bistro",
240 "Savor", "Crunch", "Sizzle", "Devour"};
241
242 pickUniqueNames(num, words, suffixes, companyNames);
243 break;
244 }
245 case 12: { // Generate a name for Healthcare&Pharm category
246 vector<string> words = {"Health", "Wellness", "Care", "Medical", "Life",
247 "Apple/Day", "Vital", "Active", "Healthy", "Cure", "Recover", "Pay4Med",
248 "Nourish", "Thrive", "Restore", "Revive", "Fit", "Strong", "Balance",
249 "Medi", "Pharma", "Sana", "Sano", "Salute", "Pulse", "Vita",
250 "Healthcare", "Wellbeing", "Medic", "Clinic", "Well", "Doctor", "Nurse",
251 "Heal", "Surgery", "Wellness", "Rx", "Pharm", "Lab", "Medical",
252 "Caring", "Healing", "Rehab", "Recovery", "Dose", "MediCare", "Medix",
253 "Pharma", "Pharmaceutical", "Medi", "Health", "Care", "Wellness", "Rx",
254 "Med", "Vita", "Sana", "Sano", "Salute", "Pulse", "Pharmacy",
255 "Medicine", "Drugs", "Wellbeing", "Cure", "Heal", "Remedy", "Prescribe",
256 "Relief", "Recovery", "Dose", "MediCare", "Medix", "Healthy", "Fit",
257 "Strong", "Balance"};
258
259 pickUniqueNames(num, words, suffixes, companyNames);
260 break;
261 }
262 case 13: { // Generate a name for Tech category
263 vector<string> words = {"Tech", "Digital", "Innovate", "Byte", "Code",
264 "Data", "Logic", "Connect", "Smart", "Cyber", "Net", "Cloud", "Web",
265 "Nerd", "Geek", "Infinite", "System", "Guru", "Genius", "Solve",
266 "Pixel", "Bit", "Invent", "KKGarden"};
267
268 pickUniqueNames(num, words, suffixes, companyNames);
269 break;
270 }
271 case 14: { // Generate a name for RealEstate category
272 vector<string> words = {"Real", "Estate", "Property", "Homes", "Realty",
273 "Invest", "Buy", "Sell", "House", "Land", "Residential", "Commercial",
274 "Development", "Build", "Investment", "Acres", "Estates", "Brokers",
275 "Agents", "Mortgage", "Rent", "Lease", "Property", "Assets", "Housing",
276 "Tower", "Plaza", "Villa", "Condo", "Develop", "Society", "Park",
277 "Living", "Urban", "Suburban"};
278
279 pickUniqueNames(num, words, suffixes, companyNames);
280 break;
281 }
282 case 15: { // Generate a name for Retail category
283 vector<string> words = {"Obsidian", "Velvetine", "Stellar", "Luminary",
284 "Nebula", "Zephyr", "Elixir", "Intrigue", "Sapphire", "Crimson",
285 "Aurora", "Celestial", "Enigma", "Mystique", "Euphoria", "Radiance",
286 "Galaxy", "Harmonia", "Opulence", "Ethereal", "Curio", "Boutique",
287 "Ethereal", "Nook", "Vivid", "Enchant", "Whimsy", "Delight",
288 "Serendipity", "Wander", "Charm", "Spruce", "Eclectic", "Rustic",
289 "Vintage"};
290
291 pickUniqueNames(num, words, suffixes, companyNames);
292 break;
293 }
294 case 16: { // Generate a name for Telecom category
295 vector<string> words = {"Connect", "Link", "Wireless", "Tele", "Net",
296 "Signal", "Comm", "Telecom", "Tech", "Mobile", "Global", "Data", "Wave",
297 "Teleconnect", "Swift", "Talk", "Voice", "Fiber", "Reach", "OnCall",
298 "Echo", "Pulse", "Synapse", "Velocity", "Empower", "Amplify",
299 "Momentum", "Infinite", "Nexus", "Stream", "Sync", "Telepath",
300 "Radiant", "Blaze", "Quantum"};
301
302 pickUniqueNames(num, words, suffixes, companyNames);
303 break;
304 }
305 default:
306 /** "Group 88" is the fallback value for input category out of [0,
307 * category_list_size - 1] */
308 return std::vector<std::string>(1, "Group 88");
309 break;
310 }
311 return companyNames;
312}
313
314void pickUniqueNames(const unsigned int & num, const vector<string> & words,
315 const vector<string> & suffixes, vector<string> & companyNames) {
316 /// @todo: add a test case or assertion
317 /// @todo: use unordered_set instead of vector since we are checking for uniqueness
318 decltype(num) pickedNamesAmount = num;
319 while (companyNames.size() < pickedNamesAmount) {
320 string name = words[random_integer(words.size())] + " " +
321 suffixes[random_integer(suffixes.size())];
322 const bool companyNameAlreadyPresent =
323 find(companyNames.begin(), companyNames.end(), name) == companyNames.end();
324 if (companyNameAlreadyPresent) {
325 companyNames.emplace_back(name);
326 }
327 }
328}
@ category
This event will apply to stocks within the specified category.
Definition events.h:92
vector< string > generate_name(unsigned int category, unsigned int num)
Generates a set of unique stock names based on the specified category and quantity.
Definition names.cpp:37
void pickUniqueNames(const unsigned int &num, const vector< string > &words, const vector< string > &suffixes, vector< string > &companyNames)
Generates a vector of company names by combining words and suffixes.
Definition names.cpp:314
string const category_list[category_list_size]
List of stock categories.
Definition names.cpp:22
Declaration of the name generating function.
const int category_list_size
The size of the category list.
Definition names.h:27
unsigned int random_integer(unsigned int max_integer)
python randint like function
Header file for random related functions.