Initializing
Liveweave
Web
expand_more
home
Home
data_object
CSS Explorer
arrow_outward
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
outbox_alt
Generative AI
arrow_outward
frame_source
Python Playground
New
arrow_outward
build
Tools
expand_more
restart_alt
Load "Hello Weaver!"
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Save
account_circle
Login
settings
Settings
expand_more
14
px
Live mode
Night mode
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
<div id="a"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae quaerat facilis et quas laudantium quisquam aliquam ducimus blanditiis laborum autem porro vero in voluptatem distinctio repudiandae vel expedita error hic. <div id="b"> </div> </div>
#a{ background:red; position:fixed; width: 100px; height: 100px; overflow: auto; } #b{ background:blue; position:fixed; width: 100px; height: 100px; top: 50px; left: 50px; }
import random # Game setup days = 7 raccoons = 3 waste_total = 0 waste_limit = 50 leftovers = 0 # Day 1 starts with your input: 53 units print("Welcome to Raccoon Feast Frenzy!") print(f"Day 1: You have 53 units of scraps (13 bananas, 5 cups dog food, 10 hamburgers).") for day in range(1, days + 1): # New scraps each day (1-10 units), except Day 1 if day == 1: total_scraps = 53 # Your initial input else: new_scraps = random.randint(1, 10) total_scraps = new_scraps + leftovers print(f"\nDay {day}: You generate {new_scraps} new units. With {leftovers} leftovers, you have {total_scraps} units.") # Player decides how much to put out while True: try: offered = int(input(f"How many of the {total_scraps} units do you put out? (0-{total_scraps}): ")) if 0 <= offered <= total_scraps: break print(f"Please enter a number between 0 and {total_scraps}.") except ValueError: print("Please enter a valid number.") # Calculate waste waste = total_scraps - offered waste_total += waste print(f"You put out {offered} units. {waste} units go to waste. Total waste: {waste_total}/{waste_limit}") # Raccoon hunger and eating hunger = [random.randint(1, 5) for _ in range(raccoons)] total_hunger = sum(hunger) eaten = min(offered, total_hunger) # They eat up to hunger or what's offered leftovers = offered - eaten if offered > total_hunger else 0 print(f"{raccoons} raccoons show up with hunger {hunger} (total: {total_hunger}).") print(f"They eat {eaten} units, leaving {leftovers} units as leftovers.") # Raccoon growth if eaten >= 10: raccoons += 1 print(f"The raccoons ate {eaten} units (>=10)! A new raccoon joins. Total: {raccoons}") else: print(f"Raccoon count stays at {raccoons}.") # Check game over if waste_total >= waste_limit: print(f"\nWaste reached {waste_total}/{waste_limit}. Game over! The raccoons win.") break # Day ends if day == days: print(f"\nDay 7 complete! Final waste: {waste_total}/{waste_limit}. Raccoons: {raccoons}") if raccoons == 0: print("Bonus Victory! No raccoons left!") else: print("You survived! Victory!") else: # If loop ends naturally (Day 7), this won't run due to prior check pass