Merge pull request #2 from ethanrusz/calculations

Basic Functionality
This commit is contained in:
Em (Ethan) Ruszanowski 2024-02-14 16:25:05 -06:00 committed by GitHub
commit b54765f369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 240 additions and 85 deletions

154
app.py
View file

@ -1,4 +1,5 @@
import streamlit as st
from itertools import chain
class Moon:
@ -21,80 +22,147 @@ class Creature:
class Run:
def __init__(self, moon):
self.moon = moon
self.inside_power = moon.inside_max_power
self.outside_power = moon.outside_max_power
def main():
st.set_page_config('Lethal Company Scouter', '🛰️')
st.set_page_config("Lethal Company Scouter", "🛰️")
moons = [
# Tier 1
Moon('Experimentation', 1, 4, 8),
Moon('Assurance', 1, 6, 8),
Moon('Vow', 1, 7, 6),
Moon("Experimentation", 1, 4, 8),
Moon("Assurance", 1, 6, 8),
Moon("Vow", 1, 7, 6),
# Tier 2
Moon('Offense', 2, 12, 12),
Moon('March', 2, 14, 12),
Moon("Offense", 2, 12, 12),
Moon("March", 2, 14, 12),
# Tier 3
Moon('Rend', 3, 10, 6),
Moon('Dine', 3, 15, 6),
Moon('Titan', 3, 18, 7),
Moon("Rend", 3, 10, 6),
Moon("Dine", 3, 15, 6),
Moon("Titan", 3, 18, 7),
]
outside_creatures = [
Creature('Baboon Hawk', None, 1, 15, 6),
Creature('Circuit Bees', None, 1, 6, None),
Creature('Eyeless Dog', None, 2, 8, 12),
Creature('Forest Keeper', 'Giant', 3, 3, None),
Creature('Earth Leviathan', 'Worm', 2, 3, None),
Creature("Baboon Hawk", None, 1, 15, 6),
Creature("Circuit Bees", None, 1, 6, None),
Creature("Eyeless Dog", None, 2, 8, 12),
Creature("Forest Keeper", "Giant", 3, 3, None),
Creature("Earth Leviathan", "Worm", 2, 3, None),
# Hybrid
Creature('Outside Ghost Girl ', None, 2, 1, None),
Creature('Outside Masked', None, 10, 10, 4),
Creature("Outside Ghost Girl ", None, 2, 1, None),
Creature("Outside Masked", None, 1, 10, 4),
]
inside_creatures = [
Creature('Bracken', 'Freddy Fazbear', 3, 1, 6),
Creature('Bunker Spider', None, 3, 1, 6),
Creature('Coil Head', None, 1, 5, None),
Creature('Hoarding Bug', 'Yippee Bug', 1, 8, 3),
Creature('Hygrodere', 'Goo', 1, 2, None),
Creature('Jester', None, 3, 1, None),
Creature('Nutcracker', None, 1, 10, 5),
Creature('Snare Flea', "Head. Bug.", 1, 4, 3),
Creature('Spore Lizard', None, 1, 2, None),
Creature('Thumper', None, 2, 4, 4),
# Hybrid
Creature('Inside Ghost Girl', None, 2, 1, None),
Creature('Inside Masked', None, 10, 10, 4),
Creature("Bracken", "Freddy Fazbear", 3, 1, 6),
Creature("Bunker Spider", None, 3, 1, 6),
Creature("Coil Head", None, 1, 5, None),
Creature("Hoarding Bug", "Yippee Bug", 1, 8, 3),
Creature("Hygrodere", "Goo", 1, 2, None),
Creature("Jester", None, 3, 1, None),
Creature("Nutcracker", None, 1, 10, 5),
Creature("Snare Flea", "Head. Bug.", 1, 4, 3),
Creature("Spore Lizard", None, 1, 2, None),
Creature("Thumper", None, 2, 4, 4),
]
st.markdown('# :red[Lethal Company] Scouter')
hybrid_creatures = [
Creature("Ghost Girl", None, 2, 1, None),
Creature("Masked", None, 1, 10, 4),
]
st.markdown("# :red[Lethal Company] Scouter")
st.markdown(":rainbow[What does the scouter say about this moon's power level?]")
moon = st.selectbox('Moon', sorted(m.name for m in moons),
placeholder='Moon! Pick a moon!',
help='Pick your current moon.')
moon = st.selectbox(
"Moon",
sorted(m.name for m in moons),
placeholder="Moon! Pick a moon!",
help="Pick your current moon.",
)
run = Run(next(m for m in moons if m.name is moon))
st.markdown(f"## {run.moon.name} (Tier {run.moon.tier})")
column_1, column_2 = st.columns(2)
with column_1:
st.markdown('### Outside')
st.markdown("### Outside")
st.info(f"Maximum power: {run.moon.outside_max_power}")
for outside_creature in outside_creatures:
st.slider(outside_creature.name, 0, outside_creature.max_spawns, help=outside_creature.nickname)
with st.form("outside"):
for creature in outside_creatures:
moon_max = min(
creature.max_spawns, run.moon.outside_max_power // creature.power
)
if moon_max > 0:
st.slider(
creature.name,
0,
moon_max,
key=creature.name,
help=creature.nickname,
)
else:
st.slider(
creature.name,
0,
1,
key=creature.name,
help=creature.nickname,
disabled=True,
)
run.outside_power = run.outside_power - st.session_state[creature.name]
outside_submit = st.form_submit_button("Calculate")
if outside_submit:
if run.outside_power >= 0:
st.toast(f"🌳 Outside power remaining: {run.outside_power}")
else:
st.error(
f"Power level exceedes maximum possible for {run.moon.name}."
)
with column_2:
st.markdown('### Inside')
st.markdown("### Inside")
st.info(f"Maximum power: {run.moon.inside_max_power}")
for inside_creature in inside_creatures:
st.slider(inside_creature.name, 0, inside_creature.max_spawns, help=inside_creature.nickname)
with st.form("inside"):
for creature in inside_creatures:
moon_max = min(
creature.max_spawns, run.moon.inside_max_power // creature.power
)
if moon_max > 0:
st.slider(
creature.name,
0,
moon_max,
key=creature.name,
help=creature.nickname,
)
else:
st.slider(
creature.name,
0,
1,
key=creature.name,
help=creature.nickname,
disabled=True,
)
run.inside_power = run.inside_power - st.session_state[creature.name]
inside_submit = st.form_submit_button("Calculate")
if inside_submit:
if run.inside_power >= 0:
st.toast(f"🏭 Inside power remaining: {run.inside_power}")
else:
st.error(
f"Power level exceedes maximum possible for {run.moon.name}."
)
# https://docs.streamlit.io/library/api-reference/session-state
if __name__ == '__main__':
if __name__ == "__main__":
main()

View file

@ -1,45 +1,132 @@
altair==5.2.0
attrs==23.2.0
blinker==1.7.0
cachetools==5.3.2
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
gitdb==4.0.11
GitPython==3.1.41
idna==3.6
importlib-metadata==7.0.1
Jinja2==3.1.3
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
numpy==1.26.4
packaging==23.2
pandas==2.2.0
aiodns==3.0.0
aiohttp==3.9.3
aiosignal==1.3.1
apsw==3.42.0.1
argcomplete==2.0.0
attrs==23.1.0
Beaker==1.12.1
beautifulsoup4==4.12.3
black==24.1.1
blivet==3.8.2
blivet-gui==2.4.2
Brlapi==0.8.5
Brotli==1.1.0
cffi==1.15.1
chardet==5.2.0
charset-normalizer==3.2.0
click==8.1.3
cryptography==41.0.3
css-parser==1.0.7
cupshelpers==1.0
dasbus==1.7
dbus-python==1.3.2
defusedxml==0.7.1
distro==1.8.0
dnf==4.18.2
dnspython==2.4.2
docstring-to-markdown==0.13
fb-re2==1.0.7
fedora-third-party==0.10
feedparser==6.0.10
file-magic==0.4.0
fros==1.1
frozenlist==1.4.0
FVS==0.3.4
gpg==1.20.0
html2text==2020.1.16
html5-parser==0.4.10
html5lib==1.1
humanize==3.13.1
icoextract==0.1.4
idna==3.4
ifaddr==0.1.7
jedi==0.19.0
jeepney==0.8.0
langtable==0.0.64
libcomps==0.1.20
libdnf==0.72.0
lxml==4.9.3
Mako==1.2.3
Markdown==3.5.1
MarkupSafe==2.1.3
mechanize==0.4.8
mercurial==6.5.3
msgpack==1.0.5
multidict==6.0.4
mypy-extensions==1.0.0
netifaces==0.11.0
odfpy==1.4.1
olefile==0.46
orjson==3.9.10
packaging==23.1
parso==0.8.3
Paste==3.5.3
pathspec==0.12.1
pathvalidate==2.5.2
patool==1.12
pefile==2023.2.7
pexpect==4.8.0
pid==2.2.3
pillow==10.2.0
protobuf==4.25.2
pyarrow==15.0.0
pydeck==0.8.1b0
Pygments==2.17.2
platformdirs==3.9.1
pluggy==1.2.0
ply==3.11
productmd==1.38
psutil==5.9.5
ptyprocess==0.7.0
pwquality==1.4.5
pycairo==1.25.1
pycares==4.3.0
pychm==0.8.6
pycparser==2.20
pycrypto==2.6.1
pycups==2.0.1
pycurl==7.45.2
pyenchant==3.2.2
Pygments==2.15.1
PyGObject==3.46.0
pykickstart==3.48
pyOpenSSL==23.2.0
pyparted==3.13.0
PyQt6==6.6.1
PyQt6-sip==13.6.0
PyQt6-WebEngine==6.6.0
PySocks==1.7.1
python-augeas==1.1.0
python-dateutil==2.8.2
pytz==2024.1
referencing==0.33.0
requests==2.31.0
rich==13.7.0
rpds-py==0.17.1
python-lsp-black==2.0.0
python-lsp-jsonrpc==1.1.2
python-lsp-server==1.10.0
python-meh==0.51
pyudev==0.24.1
pyxdg==0.27
PyYAML==6.0.1
ranger-fm==1.9.3
regex==2023.12.25
requests==2.28.2
requests-file==1.5.1
requests-ftp==0.3.1
rpm==4.19.1
selinux @ file:///builddir/build/BUILD/libselinux-3.5/src
sepolicy @ file:///builddir/build/BUILD/selinux-3.5/python/sepolicy
setools==4.4.3
setuptools==67.7.2
sgmllib3k==1.0.0
simpleaudio==1.0.4
simpleline==1.9.0
six==1.16.0
smmap==5.0.1
streamlit==1.31.0
tenacity==8.2.3
toml==0.10.2
toolz==0.12.1
tornado==6.4
typing_extensions==4.9.0
tzdata==2023.4
tzlocal==5.2
urllib3==2.2.0
validators==0.22.0
watchdog==4.0.0
zipp==3.17.0
sos==4.6.0
soupsieve==2.5
speedtest-cli==2.1.3
systemd-python==235
Tempita==0.5.2
tomli==2.0.1
ufw==0.35
ujson==5.8.0
urllib3==1.26.18
vkbasalt-cli==3.1.1.post1
webencodings==0.5.1
xxhash==3.4.1
yarl==1.9.2
zeroconf==0.118.0
zombie-imp==0.0.2