forked from Drone944/deep_learning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummon_batwing.py
159 lines (130 loc) Β· 5.74 KB
/
summon_batwing.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import base64
import os
import importlib.util
import time
import sys
import random
import string
RED = "\033[91m"
YELLOW = "\033[93m"
BLUE = "\033[94m"
CYAN = "\033[96m"
GREEN = "\033[92m"
RESET = "\033[0m"
HEALTH_DECREASE_RATE = 10
COUNT_DODGE = 3
BATMAN_HEALTH = 100
CONNECTION_MADE = False
git_commands = [
"git status: used to see the status of the files in the repository",
"git add: used to stage files",
"git commit: used to commit the staged files",
"git push: used to push the committed files to the repository",
"git checkout: used to switch branches",
]
files = ["LmdpdGlnbm9yZQ==", "ZW5lbWllc19zaG9vdGluZy5weQo=", "YmF0d2luZy50eHQK"]
decoded_files = [base64.b64decode(file).decode("utf-8").strip() for file in files]
def check_gitignore():
with open(decoded_files[0], "r") as gitignore_file:
gitignore_content = gitignore_file.read()
return "enemies_shooting.py" in gitignore_content
shooting_code = """
import time
import sys
import random
from summon_batwing import check_gitignore
gunshots = [
"π« Pew! Pew!",
"π₯ Bang! Bang!",
"π« π Boom!",
"π₯π₯ Rat-a-tat-tat!",
"π« π₯ Ka-pow!",
]
def simulate_gunfight():
if check_gitignore():
return 1
print("\\033[91mβ οΈ ALERT: Enemies spotted! They're shooting at you! β οΈ\\033[0m")
time.sleep(1)
for _ in range(5):
if check_gitignore():
return 1
gunshot = random.choice(gunshots)
sys.stdout.write(f"\\r{' ' * 30}")
sys.stdout.write(f"\\r{gunshot}")
sys.stdout.flush()
time.sleep(0.5)
print("\\n\\033[91mThe enemies are still out there...\\033[0m")
time.sleep(1)
print("\\033[93mBatmobile can't be summoned until the area is secure!\\033[0m")
"""
def collect_git_command(command):
print(f"{CYAN}β¨ Collected Git command: {command}! Use it wisely! β¨{RESET}")
with open(decoded_files[1], "w") as enemies_shooting_file:
enemies_shooting_file.write(shooting_code)
if os.path.exists(decoded_files[0]):
fended_off = False
health = BATMAN_HEALTH
print(f"{CYAN}π Batman's Health: {health}/{BATMAN_HEALTH}{RESET}")
print(f"{RED} Enemies are approaching Batman! Make sure you dodge the attacks to save Batman!(you have 3 seconds to dodge){RESET}")
time.sleep(3)
while health > 0:
if COUNT_DODGE == 0:
with open(decoded_files[2], "w") as batwing_file:
batwing_file.write("The legendary weapon of Batman is ready to strike!")
print(f"\n{GREEN}π Communication with Batwing successful! π{RESET}")
print(f"{YELLOW}β¨ The .gitignore file is used to specify files and directories that should be ignored by Git, preventing them from being tracked or added to version control. β¨{RESET}")
print(f"{GREEN}β οΈ Please add {RED}enemies_shooting.py {GREEN}to your .gitignore file. β οΈ{RESET}\n")
CONNECTION_MADE = True
try:
if check_gitignore() and fended_off:
break
spec = importlib.util.spec_from_file_location("enemies_shooting", decoded_files[1])
enemies_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(enemies_module)
value = enemies_module.simulate_gunfight()
if value == 1:
fended_off = True
if not CONNECTION_MADE:
dodge_letter = random.choice(string.ascii_lowercase)
print(f"{YELLOW}β οΈ Quick Time Event! Press '{dodge_letter}' to dodge the attack!{RESET}")
start_time = time.time()
user_input = input("Your input: ").strip().lower()
elapsed_time = time.time() - start_time
if user_input == dodge_letter and elapsed_time < 4:
print(f"{GREEN}β
Dodge successful! You avoided the attack!{RESET}")
COUNT_DODGE -= 1
time.sleep(3)
else:
print(f"{RED}β Dodge failed! You got hit! Lose {HEALTH_DECREASE_RATE} health points.{RESET}")
health -= HEALTH_DECREASE_RATE
HEALTH_DECREASE_RATE *=1.5
print(f"{CYAN}π Batman's Health: {health}/{BATMAN_HEALTH}{RESET}")
if random.random() < 0.7:
collect_git_command(random.choice(git_commands))
except KeyboardInterrupt:
print(f"\n{RED}You have stopped the monitoring. Save Batman!{RESET}")
sys.exit()
if health <= 0:
print(f"{RED}π Batman has fallen. The city needs a new hero! π{RESET}")
else:
print(f"{RED}.gitignore file not found. Please ensure it exists to monitor enemies.{RESET}")
if health > 0:
print(f"\n{YELLOW}You have fended off the enemies. Batwing is ready to be dispatched!{RESET}")
fancy_message = f"""
{BLUE}****************************************************
** **
** {CYAN}π¦ Now proceed further, Hero! π¦{BLUE} **
** **
** Guide the Batwing to the battlefield by: **
** **
** {YELLOW} 1. Staging your changes {BLUE} **
** {YELLOW} 2. Committing the changes {BLUE} **
** {YELLOW} 3. Pushing to repository {BLUE} **
** {YELLOW} 4. Sending a PR {BLUE} **
** **
** {CYAN}π¦ Gotham awaits your heroic actions! π¦{BLUE} **
** **
****************************************************{RESET}
"""
print(fancy_message)
sys.exit()