Spaces:
Sleeping
Sleeping
Download station.py from besti11/Transit-Internet-Simulation: direct link, hf CLI and curl.
- Browser
- Download file 853 Bytes
-
https://huggingface.co/spaces/besti11/Transit-Internet-Simulation/resolve/main/station.py
- Command line
-
hf download hf://spaces/besti11/Transit-Internet-Simulation/station.py
-
curl -L -o station.py https://huggingface.co/spaces/besti11/Transit-Internet-Simulation/resolve/main/station.py
853 Bytes
| import time | |
| # System setup: List of stations and their current demand | |
| stations = ["A", "B", "C", "D", "E", "F"] | |
| demand_board = {station: 0 for station in stations} | |
| def display_dashboard(): | |
| """Simulates the transit board displaying current demand.""" | |
| print("\n--- Live Transit Intent Dashboard ---") | |
| for s in stations: | |
| print(f"Station {s}: {demand_board[s]} passengers waiting") | |
| print("-------------------------------------") | |
| def user_press_button(station_name): | |
| """Simulates a passenger declaring their intent to board.""" | |
| if station_name in demand_board: | |
| demand_board[station_name] += 1 | |
| print(f"\n[System] Intent confirmed for Station {station_name}!") | |
| display_dashboard() | |
| else: | |
| print("Error: Station not found.") | |
| # Demo the interaction | |
| display_dashboard() | |
| user_press_button("A") | |