Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#Shanhaijing simulator
import random
directions = ["north", "south", "east", "west"]
mountains = ['Cangyan', 'Danxia', 'Dingjun', 'Du', 'Emei', 'Erlang', 'Everest', 'Genyen', 'Gongga', 'Heng', 'Heng', 'Hua', 'Huangbo', 'Jianglang', 'Jiuhua', 'Jizu', 'Kailash', 'Langya', 'Lao', 'Liang', 'Lingyan', 'Li', 'Longhu', 'Luofu', 'Lu', 'Lushan', 'Jinfo', 'Longmen', 'Mian', 'Mogan', 'Pan', 'Pomiu', 'Putuo', 'Qingcheng', 'Qiyun', 'Sanqing', 'Song', 'Taibai', 'Tai', 'Tangjia', 'Tiandang', 'Tiantai', 'Tianzhu', 'Wangwu', 'Wutai', 'Xiqiao', 'Siguniang', 'Xuebaoding', 'Tian']

def randentry(arr):
  return arr[random.randint(0,len(arr)-1)]
  
mod = ["abundant with", "devoid of", "covered in"]
feature = ["jade", "gold", "silver", "iron", "copper", "vegetation", "strange plants", "strange beasts", "strange fish", "streams", "rocks", "thorny plants", "fire", "apes", "giant snakes", "insects"]
def genDescription():
  res = randentry(mod) + " " + randentry(feature)
  if(random.randint(0,1)):
    res += " and " + randentry(mod) + " " + randentry(feature)
  return res
  
syllables = """
    a, ai, an, ang, ao
    ba, bai, ban, bang, bao, bei, ben, beng, bi, bian, biao, bie, bin, bing, bo, bu
    ca, cai, can, cang, cao, ce, cei, cen, ceng, cha, chai, chan, chang, chao, che, chen, cheng, chi, chong, chou, chu, chua, chuai, chuan, chuang, chui, chun, chuo, ci, cong, cou, cu, cuan, cui, cun, cuo
    da, dai, dan, dang, dao, de, dei, den, deng, di, dian, diao, die, ding, diu, dong, dou, du, duan, dui, dun, duo
    e, ê, ei, en, er
    fa, fan, fang, fei, fen, feng, fo, fou, fu
    ga, gai, gan, gang, gao, ge, gei, gen, geng, gong, gou, gu, gua, guai, guan, guang, gui, gun, guo
    ha, hai, han, hang, hao, he, hei, hen, heng, hm, hng, hong, hou, hu, hua, huai, huan, huang, hui, hun, huo
    ji, jia, jian, jiang, jiao, jie, jin, jing, jiong, jiu, ju, juan, jue, jun
    ka, kai, kan, kang, kao, ke, kei, ken, keng, kong, kou, ku, kua, kuai, kuan, kuang, kui, kun, kuo
    la, lai, lan, lang, lao, le, lei, leng, li, lia, lian, liang, liao, lie, lin, ling, liu, long, lou, lu, luo, luan, lun, lü, lüe
ma, mai, man, mang, mao, mei, men, meng, mi, mian, miao, mie, min, ming, miu, mo, mou, mu, na, nai, nan, nang, nao, ne, nei, nen, neng, ng, ni, nian, niang, niao, nie, nin, ning, niu, nong, nou, nu, nuo, nuan, nü, nüe
    o, ou
    pa, pai, pan, pang, pao, pei, pen, peng, pi, pian, piao, pie, pin, ping, po, pou, pu
    qi, qia, qian, qiang, qiao, qie, qin, qing, qiong, qiu, qu, quan, que, qun
    ran, rang, rao, re, ren, reng, ri, rong, rou, ru, rua, ruan, rui, run, ruo
    sa, sai, san, sang, sao, se, sei, sen, seng, sha, shai, shan, shang, shao, she, shei, shen, sheng, shi, shou, shu, shua, shuai, shuan, shuang, shui, shun, shuo, si, song, sou, su, suan, sui, sun, suo
    ta, tai, tan, tang, tao, te, teng, ti, tian, tiao, tie, ting, tong, tou, tu, tuan, tui, tun, tuo
    wa, wai, wan, wang, wei, wen, weng, wo, wu
    xi, xia, xian, xiang, xiao, xie, xin, xing, xiong, xiu, xu, xuan, xue, xun
    ya, yan, yang, yao, ye, yi, yin, ying, yong, you, yu, yuan, yue, yun
    za, zai, zan, zang, zao, ze, zei, zen, zeng, zha, zhai, zhan, zhang, zhao, zhe, zhei, zhen, zheng, zhi, zhong, zhou, zhu, zhua, zhuai, zhuan, zhuang, zhui, zhun, zhuo, zi, zong, zou, zu, zuan, zui, zun, zuo """.replace(",", "").split()
def genName():
  res = ""
  for i in range(random.randint(1,2)):
    res += randentry(syllables)
  return res.capitalize();

animal = ["grebe", "cat", "bear", "wolf", "horse", "pheasant", "bull", "hawk", "snake", "carp", "goat", "rat", "boar", "magpie", "lamprey"]

descriptor = ["no", "three", "six", "eight", "yellow", "red", "black", "bald", "long"]
appendage = ["eyes", "legs", "markings", "tails", "heads", "horns", "ears", "wings"]
effect = ["flesh cures leprosy", "flesh cures fevers", "flesh cures boils", "flesh cures delirium", "flesh cures chest pains", "hide brings good fortune to the wearer", "hide brings ill fortune to the wearer", "hide conceals the bearer", "presence heralds rain", "presence heralds drought", "presence heralds strife", "presence heralds prosperity", "gaze paralyzes", "presence disturbs the mind"]

sent = "{} li {} there is a mountain called {} which is {}. There is a beast called {}, shaped like a {} but with {} {}. It cries \"{}\" and its {}.".format(
    str(random.randint(5, 50)*10),
    randentry(directions),
    randentry(mountains),
    genDescription(),
    genName(),
    randentry(animal),
    randentry(descriptor),
    randentry(appendage),
    randentry(syllables),
    randentry(effect)
  )
print(sent)
Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux