Word Puzzle Game In this assignment is only for individual. You are going to decode the scrambled word into correct order in this game. One round of play is as follows: 1. Computer reads a text file named words.txt 2. Computer randomly picks one word in the file and randomly scrambles characters in the word many times to hide the word 3. Computer displays the scrambled word to user with indexes and gives the user options to 1. Swap two letters in word based on index given 2. Solve the puzzle directly 3. Quit the game 4. If a player chooses to swap letters, the computer reads two indexes and swaps the letters. The game resume to step 3 with the newly guessed word. If the resulted word after swapping is the secret word, the game is over. 5. If a user chooses to solve directly, computer prompts the user to enter the guessed word. If it’s correct, the game is over, otherwise goes to step 3. 6. After game is over, display how many times the player has tried to solve the puzzle.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

Word Puzzle Game
In this assignment is only for individual. You are going to decode the scrambled word into correct order
in this game. One round of play is as follows:
1. Computer reads a text file named words.txt
2. Computer randomly picks one word in the file and randomly scrambles characters in the word
many times to hide the word
3. Computer displays the scrambled word to user with indexes and gives the user options to
1. Swap two letters in word based on index given
2. Solve the puzzle directly
3. Quit the game
4. If a player chooses to swap letters, the computer reads two indexes and swaps the letters. The
game resume to step 3 with the newly guessed word. If the resulted word after swapping is the
secret word, the game is over.
5. If a user chooses to solve directly, computer prompts the user to enter the guessed word. If it’s
correct, the game is over, otherwise goes to step 3.
6. After game is over, display how many times the player has tried to solve the puzzle.
The following is sample runs:
----------
012345
eltret
----------
Enter 1 to swap letters.
Enter 2 to solve the puzzle.
Enter 3 to quit the game.
2
Please enter the solved word:
Elect
Wrong answer! Please try to solve again!
----------
012345
eltret
----------
Enter 1 to swap letters.
Enter 2 to solve the puzzle.
Enter 3 to quit the game.
1
Enter the indexes separated by a space.
0 1
----------
012345
letret
---------- 
Enter 1 to swap letters.
Enter 2 to solve the puzzle.
Enter 3 to quit the game.
1
Enter the indexes separated by a space.
3 5
Congratulations! You solved the secret in 3 steps.
----------
01234
hoseu
----------
Enter 1 to swap letters.
Enter 2 to solve the puzzle.
Enter 3 to quit the game.
2
Please enter the solved word:
house
Congratulations! You solved the secret in 1 steps. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,