4
0

Initial Commit

This commit is contained in:
Wirlaburla 2023-06-26 19:47:33 -05:00
commit d6e3823f76
5 changed files with 2785 additions and 0 deletions

22
build.zig Normal file
View File

@ -0,0 +1,22 @@
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("UroAvatarGenerator", null);
exe.addCSourceFile("src/main.cpp", &.{"-std=c++20"});
exe.setTarget(target);
exe.setBuildMode(mode);
exe.linkLibCpp();
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}

101
src/anims.txt Normal file
View File

@ -0,0 +1,101 @@
achoo
aggie
alexa
amy
aura
axel
barbra
barrelman
bigfoot
bing
birdie
bitman
bluepenguin
bones
boxman
cartoonman
cassius
chang
charlie
chloe
cobra
crane
creature
cybort
death
demon
drummajor
dude
elf
elfin
fire
george
glubber
golem
graduate
guru
habib
haining
horny
hotep
infinity
jenny
jian
jim
jing
joe
john
joker
jon
julie
kangaroo
kiwibird
leo
lian
lizard
lmbghn
loopy
macaw
mark
mei
mesmerist
ming
minotaur
mitch
monster
nightglyder
ogre
orangutan
paul
pegasus
penguin
pilgrim
porsche
prince
puffin
quail
rap
ray
roundman
roxanne
shamaness
shanubia
shred
sienna
simon
somgirl
somguy
sonya
spin
sty
sunshine
tina
tony
toucan
tre
vwbug
wei
weilui
willy
zen
zita

195
src/bods.txt Normal file
View File

@ -0,0 +1,195 @@
Gachoo
Gaee
Gaggie
Galex
Galexa
Galien
Gamy
Gangel
Gant
Gatat
Gaudry
Gaura
Gava
Gavy
Gaxel
Gaxelbwl
Gaxelwe
Gaxelwg
Gbanana
Gbar
Gbarbra
Gbarrelman
Gbear
Gbigfoot
Gbik
Gbing
Gbird
Gbirdie
Gbitman
Gbla
Gblb
Gbluepenguin
Gbob
Gbones
Gboxman
Gbug
Gbunny
Gbxel
Gcanman
Gcartoonman
Gcassius
Gchang
Gcharlie
Gchas
Gchloe
Gcin
Gcobra
Gcop
Gcrane
Gcrea
Gcreature
Gcxel
Gcybort
Gdalek
Gdan
Gdeath
Gdeer
Gdemon
Gdrum
Gdrummajor
Gdude
Gelf
Gelfin
Geva
Gevy
Gfairy
Gfarm
Gfire
Gfish
Gfoxy
Ggeorge
Gglubber
Gglyd
Ggogo
Ggolem
Ggrad
Ggraduate
Ggun
Ggunny
Gguru
Ggus
Ghabib
Ghag
Ghaining
Ghorny
Ghotep
Ginfinity
Giva
Give
Givy
Gjak
Gjeanie
Gjedi
Gjeni
Gjenny
Gjian
Gjim
Gjin
Gjing
Gjoe
Gjohn
Gjoker
Gjon
Gjulie
Gkangaroo
Gkiwi
Gkiwibird
Glee
Gleo
Glian
Glizard
Glmbghn
Glogo
Gloopy
Glucky
Glynn
Gmacaw
Gmark
Gmarvin
Gmary
Gmax
Gmei
Gmes
Gmesmerist
Gming
Gminotaur
Gmitch
Gmonster
Gmotorx
Gmouse
Gnightglyder
Gogre
Gorangutan
Gova
Gove
Govy
Gpanther
Gpaul
Gpegasus
Gpenguin
Gpilgrim
Gpingo
Gpiper
Gpit
Gplane
Gporsche
Gprince
Gpuffin
Gquail
Grap
Gray
Grex
Grod
Grosie
Groundman
Groxanne
Groy
Gsam
Gscorpion
Gshamaness
Gshanubia
Gshred
Gsienna
Gsimon
Gsmurf
Gsmurfet
Gsnowman
Gsomgirl
Gsomguy
Gsonya
Gspider
Gspin
Gstinky
Gstrum
Gsty
Gsub
Gsunshine
Gtaur
Gtina
Gtony
Gtoon
Gtoucan
Gtre
Gunicorn
Guva
Gvette
Gvwbug
Gwei
Gweilui
Gwilly
Gwitch
Gwolf
Gworm
Gzen
Gzita

315
src/main.cpp Normal file
View File

@ -0,0 +1,315 @@
#include <iostream>
#include <fstream>
using namespace std;
char calcS(int);
char calcC(int);
void insert(string, int, string&);
void insertC(string, string&);
int main() {
srand(time(0));
int t = 0;
ifstream tex("tex.txt");
ifstream file("bods.txt");
ifstream anims("anims.txt");
ofstream output("output.txt");
int choice, maxsize;
cout << "Welcome to Urotsuki's avatar generator. Would you like to generate color avatars, or texture avatars? Enter 1 for colors, 2 for textures: ";
while (choice != 1 && choice != 2)
{
cout << "Please enter 1 or 2: ";
cin >> choice;
}
cout << "\nOkay. Now how many avatars do you want to generate? ";
cin >> maxsize;
while (t < maxsize) {
string av = "avatar:.0ERLUMVOWIXJYKBPNH0.rwg"; // 16 parts for size, 17 for color
string size, col, body, animstr;
// random animation/base body
int p = rand() % 101;
int p2 = 0;
while (getline(anims, animstr)) {
if (p2 == p) {
if (p2 != 100)
{
animstr.pop_back();
}
av.insert(7, animstr);
}
p2++;
}
anims.clear();
anims.seekg(0, ios::beg);
// insert G(body)'s, randomly selected from .txt
int max = rand() % 16;
for (int i = 0; i <= max; i++) {
int k = rand() % 195;
int k2 = 0;
while (getline(file, body)) {
if (k2 == k) {
int j = rand() % 16;
if (k2 != 194)
{
body.pop_back();
}
insert(body, j, av);
}
k2++;
}
file.clear();
file.seekg(0, ios::beg);
}
// generate and insert random sizes
max = rand() % 16;
for (int i = 0; i <= max; i++) {
size = "S";
char s;
for (int k = 0; k < 3; k++) {
int snum = rand() % 61;
while (calcS(snum) == 'S' || calcS(snum) == 'C') {
snum = rand() % 61;
}
s = calcS(snum);
size += s;
}
int j = rand() % 16;
insert(size, j, av);
}
// generate and insert random colors
if (choice == 1) {
max = rand() % 17;
for (int i = 0; i <= max; i++) {
col = "C";
char c;
for (int k = 0; k < 3; k++) {
int cnum = rand() % 64;
while (calcC(cnum) == 'S' || calcC(cnum) == 'C') {
cnum = rand() % 64;
}
c = calcC(cnum);
col += c;
}
insertC(col, av);
}
}
// insert random textures from .txt
if (choice == 2) {
max = rand() % 17;
for (int i = 0; i <= max; i++) {
int k = rand() % 2152;
int k2 = 0;
while (getline(tex, col)) {
if (k2 == k) {
if (k2 != 2151)
{
col.pop_back();
}
string tt = to_string((rand() % 9) + 1);
col.insert(1, tt);
insertC(col, av);
}
k2++;
}
tex.clear();
tex.seekg(0, ios::beg);
}
}
// insert characters of colors or textures so that most of body is textured
for (int i = 0; i <= max; i++) {
char alphaC = char(97 + i);
string alpha;
alpha += alphaC;
for (int k = 0; k < 17 / (max+1); k++) {
int j = rand() % 17;
insert(alpha, j, av);
}
}
// output final avatar code
if (av.size() <= 220 )
{
// cout << av << endl;
if (t == 0)
{
output << av;
}
else
{
output << endl << av;
}
t++;
}
}
file.close();
tex.close();
anims.close();
output.close();
return 0;
}
char calcS(int x)
{
char ret;
if (x <= 9)
{
ret = char(48+x);
}
else if (x <= 35 && x > 9)
{
ret = char(97+x-10);
}
else
{
ret = char(65+x-36);
}
return ret;
}
char calcC(int x)
{
char ret;
if (x == 0)
{
ret = char(45);
}
else if (x <= 10 && x > 0)
{
ret = char(48+x-1);
}
else if (x <= 36 && x > 10)
{
ret = char(97+x-11);
}
else if (x <= 62 && x > 36)
{
ret = char(65+x-37);
}
else
{
ret = char(43);
}
return ret;
}
void insert(string str,int i, string &av)
{
string part;
switch(i)
{
case 0:
part = 'R';
break;
case 1:
part = 'L';
break;
case 2:
part = 'U';
break;
case 3:
part = 'M';
break;
case 4:
part = 'V';
break;
case 5:
part = 'O';
break;
case 6:
part = 'W';
break;
case 7:
part = 'I';
break;
case 8:
part = 'X';
break;
case 9:
part = 'J';
break;
case 10:
part = 'Y';
break;
case 11:
part = 'K';
break;
case 12:
part = 'B';
break;
case 13:
part = 'P';
break;
case 14:
part = 'N';
break;
case 15:
part = 'H';
break;
case 16:
part = ".r";
break;
}
bool done = true;
size_t found = av.find(part);
for (int j = 0; j <= 3; j++)
{
if (av.at(found-j) == 'S' || av.at(found-j) == 'C')
{
done = false;
}
}
while (done == false) {
done = true;
found = av.find(part, found+1);
for (int j = 0; j <= 3; j++)
{
if (av.at(found-j) == 'S' || av.at(found-j) == 'C')
{
done = false;
}
}
}
if (av.at(found+1) == 'G' && str.at(0) == 'G')
{
}
else if (i == 16)
{
av.insert(found, str);
}
else
{
av.insert(found+1, str);
}
}
void insertC(string str, string &av)
{
bool done = true;
size_t found = av.find('E');
for (int j = 0; j <= 3; j++)
{
if (av.at(found-j) == 'C')
{
done = false;
}
}
while (done == false) {
done = true;
found = av.find('E', found+1);
for (int j = 0; j <= 3; j++)
{
if (av.at(found-j) == 'C')
{
done = false;
}
}
}
av.insert(found+1,str);
}

2152
src/tex.txt Normal file

File diff suppressed because it is too large Load Diff