Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -129,3 +129,63 @@ if topic:
|
|
| 129 |
|
| 130 |
st.markdown("---")
|
| 131 |
st.caption("Created with β€οΈ by CoreQuest Galaxy π Powered by Hugging Face + Learning Galaxy β¨")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
st.markdown("---")
|
| 131 |
st.caption("Created with β€οΈ by CoreQuest Galaxy π Powered by Hugging Face + Learning Galaxy β¨")
|
| 132 |
+
# --- π₯ Galactic Upgrades Section ---
|
| 133 |
+
|
| 134 |
+
st.markdown("## π Galactic Upgrades")
|
| 135 |
+
st.info("Explore extra challenges and boosters to earn even more XP and become a true CoreQuest legend!")
|
| 136 |
+
|
| 137 |
+
# --- π Daily Challenge System ---
|
| 138 |
+
import random
|
| 139 |
+
daily_challenges = [
|
| 140 |
+
"Explain Newton's First Law with a real-world example.",
|
| 141 |
+
"Solve a basic derivative problem using the power rule.",
|
| 142 |
+
"Describe the concept of kinetic and potential energy.",
|
| 143 |
+
"Draw and label a free body diagram for a falling object.",
|
| 144 |
+
"Write the difference between electric current and voltage.",
|
| 145 |
+
"Sketch how a convex lens focuses light.",
|
| 146 |
+
"Describe Special Relativity in one sentence."
|
| 147 |
+
]
|
| 148 |
+
today_challenge = random.choice(daily_challenges)
|
| 149 |
+
|
| 150 |
+
st.subheader("π§© Daily Challenge")
|
| 151 |
+
st.success(today_challenge)
|
| 152 |
+
|
| 153 |
+
if st.button("β
Complete Challenge (Claim 15 XP)"):
|
| 154 |
+
update_xp(15)
|
| 155 |
+
st.balloons()
|
| 156 |
+
st.success("You completed today's challenge! 15 XP awarded.")
|
| 157 |
+
|
| 158 |
+
# --- πΈ Galactic XP Boosts (Random Event!) ---
|
| 159 |
+
boost_active = random.choice([True, False])
|
| 160 |
+
|
| 161 |
+
if boost_active:
|
| 162 |
+
st.markdown("### π **Galactic XP Boost Active!**")
|
| 163 |
+
st.info("All actions give **+5 bonus XP** for the next 10 minutes!")
|
| 164 |
+
|
| 165 |
+
def update_xp_boost(points):
|
| 166 |
+
bonus_points = points + 5
|
| 167 |
+
st.session_state.xp += bonus_points
|
| 168 |
+
if st.session_state.xp >= 100:
|
| 169 |
+
st.balloons()
|
| 170 |
+
st.success("π LEVEL UP! Congratulations!")
|
| 171 |
+
st.session_state.level += 1
|
| 172 |
+
st.session_state.xp = 0
|
| 173 |
+
|
| 174 |
+
# If you want, replace update_xp(points) with update_xp_boost(points) during boost time
|
| 175 |
+
else:
|
| 176 |
+
st.caption("βοΈ No Galactic Boost right now. Check back later!")
|
| 177 |
+
|
| 178 |
+
# --- π Hall of Fame (Top 3 Players Auto-Show) ---
|
| 179 |
+
st.markdown("---")
|
| 180 |
+
st.subheader("π Hall of Fame - Top 3 Explorers")
|
| 181 |
+
|
| 182 |
+
# Sort and display top 3 leaderboard players
|
| 183 |
+
if "leaderboard" in st.session_state and st.session_state.leaderboard:
|
| 184 |
+
top_players = st.session_state.leaderboard[:3]
|
| 185 |
+
for idx, player in enumerate(top_players, start=1):
|
| 186 |
+
st.success(f"π
{idx}. {player['name']} - {player['xp']} XP")
|
| 187 |
+
else:
|
| 188 |
+
st.info("No top players yet β be the first to reach the Hall of Fame!")
|
| 189 |
+
|
| 190 |
+
st.markdown("---")
|
| 191 |
+
st.caption("π CoreQuest Galaxy | Built with β€οΈ and Science Magic β¨")
|