-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobco_terminal.py
More file actions
45 lines (38 loc) · 1.48 KB
/
robco_terminal.py
File metadata and controls
45 lines (38 loc) · 1.48 KB
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
import os
import sys
import time
import random
from typing import Callable, Any
class bcolors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
ENDC = '\033[0m'
def fallout_print(text="", delay=0.01, end='\n', color=bcolors.GREEN, beep=False):
"""
Print text one character at a time, like a Fallout terminal.
Args:
text (str): The text to print.
delay (float): Base delay between characters in seconds.
Use a small random variation for more realism.
end (str): What to print at the end (like print()'s end parameter).
color: GREEN, YELLOW, ENDC
beep (bool): Adds terminal bell
"""
for char in text:
sys.stdout.write(char)
sys.stdout.flush() # Force immediate display
if beep and char not in ' \n\t':
print('\a', end='', flush=True) # Terminal bell
# Optional: add slight randomness for more "mechanical" feel
time.sleep(delay + random.uniform(0, 0.02))
sys.stdout.write(end)
sys.stdout.flush()
def terminal_loading_message():
fallout_print("WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK", delay=0.03)
fallout_print("> INITIALIZING...", delay=0.02)
fallout_print("PASSWORD REQ><sequence interrupted!", delay=0.01)
fallout_print("ERR!:UNAUTH.!!?,<<D!KJ>><>ED#&#//", delay=0.01)
fallout_print(">>ACCESS GRANTED>>", delay=0.03)
def terminal_closing_message():
fallout_print("THANK YOU FOR USING ROBCO SYSTEMS!")
fallout_print("GOODBYE!")