forked from bupticybee/ChineseAiDungeonChatGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
50 lines (41 loc) · 2.65 KB
/
utils.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
from colorama import Fore, Back, Style
import textwrap
def print_warp(instr):
for i in textwrap.wrap(instr, width=50):
print(Style.BRIGHT + i)
def error(msg):
print(Style.BRIGHT + Fore.RED + msg)
print(Style.RESET_ALL)
def input_option(prompt, true_option, false_option, default_option):
res = input(prompt + f"({true_option}/{false_option}, default {default_option})")
if res == true_option:
return True
elif res == false_option:
return False
else:
if default_option == true_option:
return True
else:
return False
def print_logo():
print(Fore.GREEN + """
▄▄▄ ░ ░ ██▓
░ ░ ░ ░ ░ ▒████▄ ░▓██▒░
░ ▒██ ▀█▄ ▒██▒
░██▄▄▄▄██ ░██░
▓█ ▓██▒░██░
▒▒ ▓▒█░░▓
▒ ▒▒ ░ ▒ ░
░ ▒ ▒ ░
▓█████▄ █ ██ ███▄ █ ▄████░▓█████ ▒█████ ███▄ █
▒██▀ ██▌ ██ ▓██▒ ██ ▀█ █ ██▒ ▀█▒▓█ ▀ ▒██▒ ██▒ ██ ▀█ █
░██ █▌▓██ ▒██░▓██ ▀█ ██▒▒██░▄▄▄░▒███ ▒██░ ██▒▓██ ▀█ ██▒
░▓█▄ ▌▓▓█ ░██░▓██▒ ▐▌██▒░▓█ ██▓▒▓█ ▄ ▒██ ██░▓██▒ ▐▌██▒
░▒████▓ ▒▒█████▓ ▒██░ ▓██░░▒▓███▀▒░▒████▒░ ████▓▒░▒██░ ▓██░
▒▒▓ ▒ ░▒▓▒ ▒ ▒ ░ ▒░ ▒ ▒ ░▒ ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▒░ ▒ ▒
░ ▒ ▒ ░░▒░ ░ ░ ░ ░░ ░ ▒░ ░ ░ ░ ░ ░ ░ ▒ ▒░ ░ ░░ ░ ▒░
░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░
""")
print(Style.BRIGHT + " Welcome to AI Dungeon, a text adventure game based on ChatGPT")
print(Style.RESET_ALL)