-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.py
44 lines (32 loc) · 951 Bytes
/
generator.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
import random
import json
with open('emoji-items.txt') as f:
items = f.readlines()
items = [x.strip() for x in items]
with open('emoji-forest.txt') as g:
forest = g.readlines()
forest = [x.strip() for x in forest]
def unicode2String(emoji):
emoji = emoji[:1] + "000" + emoji[2:]
uniPyString = "\\" + emoji
return uniPyString
def convertCharacter(emoji):
return chr(int(emoji[2:], 16))
forestString = ""
def generateForest():
global forestString
for z in range(1500):
r = random.randint(0,15)
if r == 0:
forestString += convertCharacter(random.choice(items))
if r > 0 and r < 13:
# forestString += random.choice((" ", "🌲"))
forestString += " "
if r >= 13:
forestString += convertCharacter(random.choice(forest))
generateForest()
# with open('output.json', 'w') as out_f:
# json.dump(forestString, out_f)
OutputFile = open("output.txt","w",encoding="utf8")
OutputFile.write(forestString)
OutputFile.close()