Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F628475
name_generator.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
798 B
Referenced Files
None
Subscribers
None
name_generator.h
View Options
#pragma once
#include
<string>
#include
<map>
#include
<unordered_map>
#include
<vector>
#include
<set>
//Second order markov chain name generator
class
NameGenerator
{
public
:
struct
ProbData
{
int
occurances
;
std
::
unordered_map
<
int
,
int
>
nextCount
;
};
std
::
map
<
std
::
pair
<
int
,
int
>
,
ProbData
>
data
;
std
::
vector
<
std
::
string
>
names
;
std
::
map
<
std
::
pair
<
int
,
int
>
,
int
>
nameStarts
;
std
::
set
<
std
::
string
>
usedNames
;
float
mutationChance
;
bool
useGeneration
;
bool
preventDuplicates
;
NameGenerator
();
void
clear
();
void
read
(
const
std
::
string
&
filename
);
void
write
(
const
std
::
string
&
filename
);
bool
hasName
(
const
std
::
string
&
name
);
void
addName
(
const
std
::
string
&
name
);
void
addAssociation
(
int
first
,
int
second
,
int
next
);
unsigned
getNameCount
();
std
::
string
generate
();
};
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 4:14 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
130321
Default Alt Text
name_generator.h (798 B)
Attached To
Mode
R80 StarRuler2-Source
Attached
Detach File
Event Timeline