Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#992 Added Word Scramble Challenge Game #1000

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions Game_Development/Word Scramble Challenge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Word Scramble Challenge 🌀

This is a fun **HTML, CSS, and JavaScript-based web implementation** of the classic **Word Scramble Challenge**. In this game, you are given a scrambled word, and your task is to unscramble it as quickly as possible!

## 🎯 Objective

The goal is to unscramble the given word and submit the correct word within the time limit. You can also ask for hints to make it easier, but using a hint will reduce your score.

## 🚀 How to Play

1. **Start the Game**: Open the `index.html` file in a web browser.
2. **Scrambled Word**: A scrambled version of a word will be displayed.
3. **Unscramble the Word**: Type the correct word in the input field.
4. **Submit Your Answer**: Click the "Submit" button to check if your guess is correct.
5. **Receive Feedback**: After each submission, you'll get one of these responses:
* "Correct!" if you unscramble the word correctly.
* "Incorrect! Try again." if your guess is wrong.
6. **Ask for a Hint**: You can click the "Hint" button to reveal a clue, but it will lower your final score.
7. **Next Word**: Once you unscramble the word, a new scrambled word will appear.
8. **Complete the Challenge**: Try to solve as many scrambled words as possible before the time runs out!

## 🛠 System Requirements

* **Web Browser**: Any modern web browser (Chrome, Firefox, Safari, Edge)

## Dependencies

This game uses only HTML, CSS, and vanilla JavaScript, so no additional dependencies are required.

## 🔧 How to Run

1. Clone the repository and navigate to the project folder:

```
git clone <repository-url>
cd <project-folder>
```

2. Open the `index.html` file in your web browser.

3. Enjoy playing the Word Scramble Challenge!

## 📚 Game Mechanics

* **Scrambled Word Generation**: The game randomly scrambles words from a predefined list.
* **User Input**: You must type the correct unscrambled word and submit it.
* **Feedback**: Immediate feedback on whether the submitted word is correct or incorrect.
* **Hints**: Option to get a hint if you're stuck (at the cost of points).
* **Score Tracking**: The game keeps track of your score, with deductions for hints used.

## 💻 System Specifications

* HTML5
* CSS3
* JavaScript (ES6+)
* Any modern web browser

## 📖 Additional Information

The Word Scramble Challenge is a great way to enhance your vocabulary and improve your problem-solving skills. It also serves as a practical example of DOM manipulation, event handling, and basic game logic in web development.

## 🤔 Strategy Tips

1. Try to identify any common letter patterns or prefixes in the scrambled word.
2. Use hints sparingly to maximize your score.
3. Practice makes perfect! The more you play, the better you'll get at spotting unscrambled words quickly.
4. Think of multiple words that could be formed from the scrambled letters and test them out.

Enjoy playing the Word Scramble Challenge! 🎉
61 changes: 61 additions & 0 deletions Game_Development/Word Scramble Challenge/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import random
import time

# List of words for the Word Scramble Challenge
words_list = ["python", "developer", "challenge", "scramble", "puzzle", "algorithm", "function", "variable"]

# Function to scramble a word
def scramble_word(word):
scrambled = list(word) # Convert the word into a list of characters
random.shuffle(scrambled) # Shuffle the characters in the list
return ''.join(scrambled) # Join the shuffled characters back into a string

# Function to play the Word Scramble Challenge
def play_game():
score = 0 # Player's initial score
hints_used = 0 # Track how many hints the player used
time_limit = 60 # Time limit for the game (in seconds)

start_time = time.time() # Record the start time of the game

# Play the game until the time limit is reached
while time.time() - start_time < time_limit:
# Select a random word from the list and scramble it
word = random.choice(words_list)
scrambled_word = scramble_word(word)

print(f"\nScrambled Word: {scrambled_word}")

# Get the player's input
guess = input("Your guess: ").lower()

# Check if the player wants a hint
if guess == "hint":
print(f"Hint: The first letter is '{word[0]}'")
hints_used += 1
continue

# Check if the guess is correct
if guess == word:
print("Correct!")
score += 10 # Increase the score for a correct answer
else:
print(f"Incorrect! The correct word was: {word}")

# Check if time is up
if time.time() - start_time >= time_limit:
print("\nTime's up!")
break

# Display the player's final score
print(f"\nGame Over! Your final score is: {score}")
if hints_used > 0:
print(f"Hints used: {hints_used} (Hint penalty applied)")

# Main program starts here
if __name__ == "__main__":
print("Welcome to the Word Scramble Challenge!")
print("Unscramble the word or type 'hint' for a clue (but it will reduce your score).")
print("You have 60 seconds. Let's begin!")

play_game() # Start the game
2 changes: 2 additions & 0 deletions Project-Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@
* [Main](Game_Development/Word%20Games%20with%20lives/main.py)
* Word Ladder Puzzle Game
* [Main](Game_Development/Word%20Ladder%20Puzzle%20Game/main.py)
* Word Scramble Challenge
* [Main](Game_Development/Word%20Scramble%20Challenge/main.py)
* Space Invaders
* [Spaceinvader](Game_Development/space_invaders/spaceinvader.py)

Expand Down
Loading