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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education