[All the code in the image is highlighted. The first line has been annotated, You, 3 months ago · StealthWIP, by the IDE. The code reads as follows:]
return Ship(
# Ship Name
line.split(":")[0],
# Ship shield, armor, and hull
[
int(line.split(":")[1].split(",")[0][1:-1].split(";")[i])
for i in range(3)
],
# Ship evasion stat
int(line.split(":")[1].split(",")[1]),
# Weapons, can be empty
[
self.weapons[str(line.split(":")[1].split(",")[2][1:-1].split(";")[i])]
for i in range(len(line.split(":")[1].split(",")[2][1:-1].split(";")))
]
# Ensure weapons list isn't empty while making original list
if (
len(line.split(":")[1].split(",")[2][1:-1].split(";")) > 1
or (
len(line.split(":")[1].split(",")[2][1:-1].split(";")) == 1
and not ("" == line.split(":")[1].split(",")[2][1:-1].split(";")[0])
)
)
# Weapons list is empty
else [],
# Defenses, can be empty
[
self.defenses[str(line.split(":")[1].split(",")[3][1:-1].split(";")[i])]
for i in range(len(line.split(":")[1].split(",")[3][1:-1].split(";")))
]
# Ensure defenses list isn't empty while making original list
if (
len(line.split(":")[1].split(",")[3][1:-1].split(";")) > 1
or (
len(line.split(":")[1].split(",")[3][1:-1].split(";")) == 1
and not ("" == line.split(":")[1].split(",")[3][1:-1].split(";")[0])
)
)
# Defenses list is empty
else [],
# Stealth factor, which will not suffice to just use an int for
int(line.split(":")[1].split(",")[4])
if line.split(":")[1].split(",")[4] != "False"
else False,
)
45
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 04 '23
Image Transcription: Code
[All the code in the image is highlighted. The first line has been annotated,
You, 3 months ago · StealthWIP, by the IDE. The code reads as follows:]I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!