leWrong.txt 5 5 7 H 1 1 MILK White liquid produced by the mammals H 2 1 IN Used to indicate inclusion within space, a place, or limits H 3 3 BUS A road vehicle designed to carry many passengers H 5 3 DAN The name of a famous author whose surname is Brown V 1 1 MARS Red planet V 3 3 BAD Opposite of good V 2 5 ISBN International Standard Book Number puzzle2010Long.txt 6 6 14 H 1 1 NA Symbol of Sodium element H 1 4 BUS A road vehicle designed to carry many passengers H 2 3 POP Opposite of push operation in stacks H 3 3 NS Abbrev. Nuclear Sclerosis

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

Please write in C

txt files:

puzzleWrong.txt

5 5 7
H 1 1 MILK White liquid produced by the mammals
H 2 1 IN Used to indicate inclusion within space, a place, or limits
H 3 3 BUS A road vehicle designed to carry many passengers
H 5 3 DAN The name of a famous author whose surname is Brown
V 1 1 MARS Red planet
V 3 3 BAD Opposite of good
V 2 5 ISBN International Standard Book Number

puzzle2010Long.txt

6 6 14
H 1 1 NA Symbol of Sodium element
H 1 4 BUS A road vehicle designed to carry many passengers
H 2 3 POP Opposite of push operation in stacks
H 3 3 NS Abbrev. Nuclear Sclerosis
H 4 1 TOSS To throw up in the air
H 5 1 HR Abbrev. Human Resources
H 5 5 TR Internet country code of Turkey
H 6 5 AG Symbol of Silver element
V 1 1 NORTH Opposite direction of south
V 4 2 OR Used to connect different possibilities
V 2 3 PNS Peripheral nervous system
V 1 4 BOSS A person who is in charge of a worker or organization
V 1 5 UP Opposite of down
V 5 5 TA Symbol of Tantalum element
V 5 6 RG Symbol of Roentgenium element

puzzle2010.txt

5 5 7
H 1 1 MILK White liquid produced by the mammals
H 2 1 IN Used to indicate inclusion within space, a place, or limits
H 3 3 BUS A road vehicle designed to carry many passengers
H 5 3 DAN The name of a famous author whose surname is Brown
V 1 1 MIND A set of cognitive faculties, e.g. consciousness, perception, etc.
V 3 3 BAD Opposite of good
V 2 5 ISBN International Standard Book Number

: Vertical1
In your midterm, you are going to write a puzzle solver. Please follow the steps given below in order to
prevent any point reduction from your grade.
First of all, check the .txt files shared with you. In each file, the first row includes the number of rows,
number of columns, and the number of words to be solved. Starting from the second row of the file,
information about each word is given in the order of: its direction, starting row and column number, its
name, and finally the hint about the word given to the user. Let's examine puzzle2010.txt:
557
H 11 MILK White liquid produced by the mammals
H2 1 IN Used to indicate inclusion within space, a place, or limits
H 33 BUS A road vehicle designed to carry many passengers
H53 DAN The name of a famous author whose surname is Brown
V 11 MIND A set of cognitive faculties, e.g. consciousness, perception, etc.
V 33 BAD Opposite of good
V 2 5 ISBN International Standard Book Number
In the above example (puzzle2010.txt), we have 5
rows, 5 columns and 7 words. For instance, MILK
starts at position 1-1, goes horizontal, and its hint
is: White liquid produced by the mammals.
Game is 5 rows x 5 cols with 7 words
Words and clues are read!
Current puzzle:
1 2 3 4 5
%23
Initially, our puzzle should look like the right image
where words to be solved are empty and shown
with underscores ( ') while blank areas are shown
with #. Row and column numbers together with
framing |, * and dashes are also given.
#3
23
3
23
23
%23
#3
%23
Below, you can find step-by-step gameplay of puzzle2010.txt. Gameplay with a longer text file and also with
an erroneous text file is also given at the end of this document.
Enter -1 to exit
which word to solve next?: 2
Current hint: Used to indicate inclusion within space, a place,
or limits
Enter your solution: in
Game is 5 rows x 5. cols with 7 words
Words and clues are read!
Current puzzle:
Correct!
3 4
Current puzzle:
1 2 3 4 5
Ask for hint:
# Direction
row col
----.....-----.....---...
Ask for hint:
* Direction
1: Horizontal
2: Horizontal
3: Horizontal
4: Horizontal
5: Vertical
6: Vertical
7: Vertical
1
row col
....
3: Horizontal
4: Horizontal
5: Vertical
6: Vertical
7: Vertical
1
Enter -1 to exit
Which word to solve next?: 1
Current hint: White liquid produced by the mammals Current hint: A road vehicle designed to carry many passengers
Enter your solution: milk
Enter -1 to exit
which word to solve next?: 3
Enter your solution: bus
Correct!
Correct!
Current puzzle:
Current puzzle:
2 3 4 5
MT
%23
#3
Ask for hint:
Ask for hint:
* Direction
Direction
row col
row col
---------- ...-.- .
Horizonta
5: Vertical
2: Horizontal
1
3: Horizontal
4: Horizontal
5: Vertical
3
3
Vertical
3
7: Vertical
6: Vertical
Enter -1 to exit
Which word to solve next?: 4
7: Vertica1
2
Current hint: The name of a famOus author whose surname is Brown
Enter your solution: dan
Correct!
Current puzzle:
K
%23
Current puzzle:
Ask for hint:
I Direction
1
row
col
------------
5: Vertical
6: Vertical
7: Vertical
IN
N #BUS
ID #A #
Enter -1 to exit
Nhich word to solve next?: 5
Current hint: A set of cognitive faculties, e.g. consciousness,
perception, etc.
Enter your solution: mind
Ask for hint:
Direction
Correct!
7: Vertical
Current puzzle:
Enter -1 to exit
Which word to solve next?: 7
Current hint: International Standard Book Number
Enter your solution: isbn
1
2 3 4
N#B US
Correct!
Current puzzle:
Ask for hint:
* Direction
------....-.
5: Vertical
7: Vertical
1 2 3 45
col
|M ILK #
IN # # I
N # BU S
|D # A # B
Enter -1 to exit
Which word to solve next?: 6
Current hint: Opposite of good
Enter your solution: bad
#DAN
Congratulations! You beat the puzzle!
Correct!
First of all, include below struct and function declarations in your code.
typedef struct
{
char *word; //word and corresponding hint
char *clue;
int x; //Starting x and y positions
int y;
char direction; //H for horizontal, V for vertical
int f; //solved or not
} word_t;
Word_t* loadTextFile( FILE* myFile, int nrWords );
void displayBoard(int rows, int cols, char** myBoard);
int isBoardFilled(int rows, int cols, char myBoard);
char** createArray (int rows, int cols);
int findIndex(int arr[], int size, int val);
void playGame (char** myBoard, int words, Word t *words, int x, int y, int countTOFinish);
char* updateBoard (char** myBoard, Word t words, int solve);
Function explanations (you can add more variables to each function and add more functions to your code if
you need):
main:
> declarations you may need:
+a dynamic array of board (e.g. char** board)
ta file pointer to the file
+ number of rows, columns and words
+a dynamic array of Word_t type
> functionality
+ get the name of the file from the user and open the file
+ read number of rows, columns and words
+ dynamically allocate your Word_t type array in the size of words
+ call loadTextFile function and assign the returned array to your Word_t type array
+ call createArray and assign the result to your board
+ call playGame
+ free any dynamically allocated array
loadTextFile:
> Create a temporary Word t type array and dynamically allocate it using the number of words
For each element of this array, read the direction, row-column starting numbers, word to be
solved and its hint from the file.
• createArray:
> Dynamically allocate a temporary board array (remember the dynamic memory allocation of
2D arrays from the lecture. First allocate memory for number of rows, then for each row,
allocate memory for columns)
> Initialize all elements of the array to #
displayBoard:
Traverse the column array and display the column number
Traverse the column array and print dashes as separators
> Print row numbers followed by l' and print corresponding board element
isBoardFilled:
> If there is any blank in the table (e.g. '), return 0, else return 1
findindex:
> Return 1 if the given value is found.
updateBoard:
This function inserts the element with the index:solve into the board.
> If the word is solved, insert the word. Else, put underscores ( ') in the length of this word.
• playGame:
> Initially, update and display the board.
> Now, create a loop in which the game is played. Game finishes whenever gameOver
reaches to the number of total words or whenever there is no more blanks in the board.
For each word, display the associated direction, row, column info if it is not solved
before
Ask the user to enter a word number
Check the validity of the input (solved before, or valid in range, etc.)
Show hint
Get the answer
If correct, increment gameOver counter, update the board and display the
board.
Check whether the board is filled or not.
Step-by-step gameplay of puzzle2010long.txt
Ask for hint:
# Direction
row
col
Game is 6 rows x 6 cols with 14 words
Words and clues are read!
Current puzzle:
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
7: Horizontal
8: Horizontal
9: Vertical
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1
4
3
1
2 3 4 5 6
1
3
Ask for hint:
* Direction
Enter -1 to exit
Which word to solve next?: 7
Current hint: Internet country code of Turkey
Enter your solution: TR
row col
1: Horizontal
2: Horizontal
3: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
7: Horizontal
8: Horizontal
9: Vertical
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1
2
Correct!
1
Current puzzle:
1
5.
1 2 3 456
# PO
1
1
Enter -1 to exit
Which word to solve next?: 3
Current hint: Opposite of push operation in stacks Ask for hint:
Enter your solution: pop
# Direction
row col
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
9: Vertical
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1
Correct!
4.
3
3
Current puzzle:
4
1
1 2 3 45
6
4
2
1
5
Enter -1 to exit
Ask for hint:
# Direction
Ask for hint:
# Direction
col
row col
row
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
9: Vertical
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
9: Vertica1
1
1
4
3
10: Vertical
vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
4
1.
1.
5
Enter -1 to exit
Which word to solve next?: 9
Current hint: Opposite direction of south
Enter -1 to exit
Which word to solve next?: 1
Current hint: Symbol of Sodium element Enter your solution: NORTH
Enter your solution: NB
WRONG ANSWER
Current puzzle:
Correct!
Current puzzle:
1
2 3 4 5 6
1 2 3 4 5 6
23
P.
O P #
| N
O # POP #
# - -
23
#3
R
# #
# #
# # # #
R
#
# # #
Ask for hint:
# Direction
row col
Ask for hint:
# Direction
row
col
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
9:
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1.
1.
4.
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
1
1
3
1
4
4
5
6. Horizontal
8. Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
6
5
1
4
2
1
4.
1
Enter -1 to exit
Enter -1 to exit
Which word to solve next?: 2
Current hint:
passengers
Enter your solution: bus
Ask for hint:
# Direction
A road vehicle designed to carry many
row
col
1: Horizontal
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
Correct!
Current puzzle:
5
6
1 2 3 4 5 6
-- -- -
2
N
A # BU
1
POP
23
|R #
# #
%23
H
%23
23
T R
Enter -1 to exit
Which word to solve next?: 1
Current hint: Symbol of Sodium element
Enter your solution: na
# # #
Ask for hint:
# Direction
col
Correct!
---------
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
10: Vertical
11: Vertical
12: Vertica1
13: Vertical
14: Vertical
Current puzzle:
4
1
5
1
1 2 3 4 5
6
6
5
4
1
2
A #
# P
#3
2
3
23
1
4
23
1
5
4
# T
Enter -1 to exit
Which word to solve next?: 4
Current hint: Abbrev. Nuclear Sclerosis
Enter your solution: NS
Ask for hint:
I Direction
row
col
Correct!
2: Horizontal
4: Horizontal
5: Horizontal
6: Horizontal
8: Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
Current puzzle:
5
1 2 3 4 5 6
4
I N
A # BUS
3
|O # P OP #
S # #
3
4
1
# N
23
Enter -1 to exit
Ask for hint:
Current puzzle:
Direction
row
col
----
5: Horizontal
5: Horizontal
3: Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1
2 3 4 5
4.
# BU
# P O P
|R # N S # #
S
A.
2.
S
|HR # # TR
# # # #
1.
4.
#
1.
5
Enter -1 to exit
Which word to solve next?: 5
Current hint:
Enter your solution: toss
Ask for hint:
To throw up in the air
Direction
row
col
8: Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
Correct!
4.
3
Current puzzle:
1
1
1 2 3 4 5
6.
5
5
# B
Enter -1 to exit
Which word to solve next?: 6
That word has been solved before
Enter -1 to exit
nich word to solve next?: 8
Current hint: Symbol of Silver element
Enter your solution: AG
#3
#3
S S # #
# # TR
P
N S
H
23
Ask for hint:
Direction
col
Correct!
6: Horizontal
8: Horizontal
10: Vertical
11: Vertical
12: Vertical
13: Vertical
14: Vertical
1.
5
Current puzzle:
4
2
3
1 2 3 4 5 6
1.
4
|N A # B US
O # PO P #
|R # N S # #
|TO S S # #
|HR # #TR
| # # # # AG
1
Enter -1 to exit
Which word to solve next?: 6
Current hint: Abbrev. Human Resources
Enter your solution: HR
Correct!
Congratulations! You beat the puzzle!
Problem with the puzzlewrong.txt
Direction
row col
2: Horizontal
3: Horizontal
4: Horizontal
5: Vertical
6: Vertical
7: Vertical
2
1
1
1
CMPE252 HW1 PUZZLE GAME
Enter name of text file: puzzlewrong. txt
Game is 5 rows x 5 cols with 7 words
Nords and clues are read!
Current puzzle:
Enter -1 to exit
Which word to solve next?: 5
Current hint:
Enter your solution: mars
Red planet
Correct!
1 2 3 4 5
Current puzzle:
1 2
3 4 5
|MILK
LA # #
23
IS #
Ask for hint:
# Direction
row col
Ask for hint:
# Direction
1: Horizontal
2: Horizontal
3: Horizontal
4: Horizontal
5: Vertical
6: Vertical
7: Vertical
1
row col
2
1
3
2: Horizontal
2
1
3: Horizontal
4: Horizontal
6: Vertical
7: Vertical
5
3
1
3.
3
3
3
3
2
5
Enter -1 to exit
Which word to solve next?: 1
Current hint: White liquid produced by the mammals
Enter your solution: milk
Enter -1 to exit
which word to solve next?: 2
Current hint: Used to indicate inclusion
within space, a place, or limits
Enter your solution: in
Correct!
Correct!
Current puzzle:
Current puzzle:
1 2 3 45
1 2
I L
%23
MIL
|IN #
IR
The program does not have to check the final condition of the word entered before (e.g. MARS → MIRS). Therefore,
assume that .txt files are prepared correctly.
Transcribed Image Text:: Vertical1 In your midterm, you are going to write a puzzle solver. Please follow the steps given below in order to prevent any point reduction from your grade. First of all, check the .txt files shared with you. In each file, the first row includes the number of rows, number of columns, and the number of words to be solved. Starting from the second row of the file, information about each word is given in the order of: its direction, starting row and column number, its name, and finally the hint about the word given to the user. Let's examine puzzle2010.txt: 557 H 11 MILK White liquid produced by the mammals H2 1 IN Used to indicate inclusion within space, a place, or limits H 33 BUS A road vehicle designed to carry many passengers H53 DAN The name of a famous author whose surname is Brown V 11 MIND A set of cognitive faculties, e.g. consciousness, perception, etc. V 33 BAD Opposite of good V 2 5 ISBN International Standard Book Number In the above example (puzzle2010.txt), we have 5 rows, 5 columns and 7 words. For instance, MILK starts at position 1-1, goes horizontal, and its hint is: White liquid produced by the mammals. Game is 5 rows x 5 cols with 7 words Words and clues are read! Current puzzle: 1 2 3 4 5 %23 Initially, our puzzle should look like the right image where words to be solved are empty and shown with underscores ( ') while blank areas are shown with #. Row and column numbers together with framing |, * and dashes are also given. #3 23 3 23 23 %23 #3 %23 Below, you can find step-by-step gameplay of puzzle2010.txt. Gameplay with a longer text file and also with an erroneous text file is also given at the end of this document. Enter -1 to exit which word to solve next?: 2 Current hint: Used to indicate inclusion within space, a place, or limits Enter your solution: in Game is 5 rows x 5. cols with 7 words Words and clues are read! Current puzzle: Correct! 3 4 Current puzzle: 1 2 3 4 5 Ask for hint: # Direction row col ----.....-----.....---... Ask for hint: * Direction 1: Horizontal 2: Horizontal 3: Horizontal 4: Horizontal 5: Vertical 6: Vertical 7: Vertical 1 row col .... 3: Horizontal 4: Horizontal 5: Vertical 6: Vertical 7: Vertical 1 Enter -1 to exit Which word to solve next?: 1 Current hint: White liquid produced by the mammals Current hint: A road vehicle designed to carry many passengers Enter your solution: milk Enter -1 to exit which word to solve next?: 3 Enter your solution: bus Correct! Correct! Current puzzle: Current puzzle: 2 3 4 5 MT %23 #3 Ask for hint: Ask for hint: * Direction Direction row col row col ---------- ...-.- . Horizonta 5: Vertical 2: Horizontal 1 3: Horizontal 4: Horizontal 5: Vertical 3 3 Vertical 3 7: Vertical 6: Vertical Enter -1 to exit Which word to solve next?: 4 7: Vertica1 2 Current hint: The name of a famOus author whose surname is Brown Enter your solution: dan Correct! Current puzzle: K %23 Current puzzle: Ask for hint: I Direction 1 row col ------------ 5: Vertical 6: Vertical 7: Vertical IN N #BUS ID #A # Enter -1 to exit Nhich word to solve next?: 5 Current hint: A set of cognitive faculties, e.g. consciousness, perception, etc. Enter your solution: mind Ask for hint: Direction Correct! 7: Vertical Current puzzle: Enter -1 to exit Which word to solve next?: 7 Current hint: International Standard Book Number Enter your solution: isbn 1 2 3 4 N#B US Correct! Current puzzle: Ask for hint: * Direction ------....-. 5: Vertical 7: Vertical 1 2 3 45 col |M ILK # IN # # I N # BU S |D # A # B Enter -1 to exit Which word to solve next?: 6 Current hint: Opposite of good Enter your solution: bad #DAN Congratulations! You beat the puzzle! Correct! First of all, include below struct and function declarations in your code. typedef struct { char *word; //word and corresponding hint char *clue; int x; //Starting x and y positions int y; char direction; //H for horizontal, V for vertical int f; //solved or not } word_t; Word_t* loadTextFile( FILE* myFile, int nrWords ); void displayBoard(int rows, int cols, char** myBoard); int isBoardFilled(int rows, int cols, char myBoard); char** createArray (int rows, int cols); int findIndex(int arr[], int size, int val); void playGame (char** myBoard, int words, Word t *words, int x, int y, int countTOFinish); char* updateBoard (char** myBoard, Word t words, int solve); Function explanations (you can add more variables to each function and add more functions to your code if you need): main: > declarations you may need: +a dynamic array of board (e.g. char** board) ta file pointer to the file + number of rows, columns and words +a dynamic array of Word_t type > functionality + get the name of the file from the user and open the file + read number of rows, columns and words + dynamically allocate your Word_t type array in the size of words + call loadTextFile function and assign the returned array to your Word_t type array + call createArray and assign the result to your board + call playGame + free any dynamically allocated array loadTextFile: > Create a temporary Word t type array and dynamically allocate it using the number of words For each element of this array, read the direction, row-column starting numbers, word to be solved and its hint from the file. • createArray: > Dynamically allocate a temporary board array (remember the dynamic memory allocation of 2D arrays from the lecture. First allocate memory for number of rows, then for each row, allocate memory for columns) > Initialize all elements of the array to # displayBoard: Traverse the column array and display the column number Traverse the column array and print dashes as separators > Print row numbers followed by l' and print corresponding board element isBoardFilled: > If there is any blank in the table (e.g. '), return 0, else return 1 findindex: > Return 1 if the given value is found. updateBoard: This function inserts the element with the index:solve into the board. > If the word is solved, insert the word. Else, put underscores ( ') in the length of this word. • playGame: > Initially, update and display the board. > Now, create a loop in which the game is played. Game finishes whenever gameOver reaches to the number of total words or whenever there is no more blanks in the board. For each word, display the associated direction, row, column info if it is not solved before Ask the user to enter a word number Check the validity of the input (solved before, or valid in range, etc.) Show hint Get the answer If correct, increment gameOver counter, update the board and display the board. Check whether the board is filled or not. Step-by-step gameplay of puzzle2010long.txt Ask for hint: # Direction row col Game is 6 rows x 6 cols with 14 words Words and clues are read! Current puzzle: 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 7: Horizontal 8: Horizontal 9: Vertical 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1 4 3 1 2 3 4 5 6 1 3 Ask for hint: * Direction Enter -1 to exit Which word to solve next?: 7 Current hint: Internet country code of Turkey Enter your solution: TR row col 1: Horizontal 2: Horizontal 3: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 7: Horizontal 8: Horizontal 9: Vertical 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1 2 Correct! 1 Current puzzle: 1 5. 1 2 3 456 # PO 1 1 Enter -1 to exit Which word to solve next?: 3 Current hint: Opposite of push operation in stacks Ask for hint: Enter your solution: pop # Direction row col 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 9: Vertical 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1 Correct! 4. 3 3 Current puzzle: 4 1 1 2 3 45 6 4 2 1 5 Enter -1 to exit Ask for hint: # Direction Ask for hint: # Direction col row col row 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 9: Vertical 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 9: Vertica1 1 1 4 3 10: Vertical vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 4 1. 1. 5 Enter -1 to exit Which word to solve next?: 9 Current hint: Opposite direction of south Enter -1 to exit Which word to solve next?: 1 Current hint: Symbol of Sodium element Enter your solution: NORTH Enter your solution: NB WRONG ANSWER Current puzzle: Correct! Current puzzle: 1 2 3 4 5 6 1 2 3 4 5 6 23 P. O P # | N O # POP # # - - 23 #3 R # # # # # # # # R # # # # Ask for hint: # Direction row col Ask for hint: # Direction row col 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 9: 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1. 1. 4. 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 1 1 3 1 4 4 5 6. Horizontal 8. Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 6 5 1 4 2 1 4. 1 Enter -1 to exit Enter -1 to exit Which word to solve next?: 2 Current hint: passengers Enter your solution: bus Ask for hint: # Direction A road vehicle designed to carry many row col 1: Horizontal 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical Correct! Current puzzle: 5 6 1 2 3 4 5 6 -- -- - 2 N A # BU 1 POP 23 |R # # # %23 H %23 23 T R Enter -1 to exit Which word to solve next?: 1 Current hint: Symbol of Sodium element Enter your solution: na # # # Ask for hint: # Direction col Correct! --------- 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 10: Vertical 11: Vertical 12: Vertica1 13: Vertical 14: Vertical Current puzzle: 4 1 5 1 1 2 3 4 5 6 6 5 4 1 2 A # # P #3 2 3 23 1 4 23 1 5 4 # T Enter -1 to exit Which word to solve next?: 4 Current hint: Abbrev. Nuclear Sclerosis Enter your solution: NS Ask for hint: I Direction row col Correct! 2: Horizontal 4: Horizontal 5: Horizontal 6: Horizontal 8: Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical Current puzzle: 5 1 2 3 4 5 6 4 I N A # BUS 3 |O # P OP # S # # 3 4 1 # N 23 Enter -1 to exit Ask for hint: Current puzzle: Direction row col ---- 5: Horizontal 5: Horizontal 3: Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1 2 3 4 5 4. # BU # P O P |R # N S # # S A. 2. S |HR # # TR # # # # 1. 4. # 1. 5 Enter -1 to exit Which word to solve next?: 5 Current hint: Enter your solution: toss Ask for hint: To throw up in the air Direction row col 8: Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical Correct! 4. 3 Current puzzle: 1 1 1 2 3 4 5 6. 5 5 # B Enter -1 to exit Which word to solve next?: 6 That word has been solved before Enter -1 to exit nich word to solve next?: 8 Current hint: Symbol of Silver element Enter your solution: AG #3 #3 S S # # # # TR P N S H 23 Ask for hint: Direction col Correct! 6: Horizontal 8: Horizontal 10: Vertical 11: Vertical 12: Vertical 13: Vertical 14: Vertical 1. 5 Current puzzle: 4 2 3 1 2 3 4 5 6 1. 4 |N A # B US O # PO P # |R # N S # # |TO S S # # |HR # #TR | # # # # AG 1 Enter -1 to exit Which word to solve next?: 6 Current hint: Abbrev. Human Resources Enter your solution: HR Correct! Congratulations! You beat the puzzle! Problem with the puzzlewrong.txt Direction row col 2: Horizontal 3: Horizontal 4: Horizontal 5: Vertical 6: Vertical 7: Vertical 2 1 1 1 CMPE252 HW1 PUZZLE GAME Enter name of text file: puzzlewrong. txt Game is 5 rows x 5 cols with 7 words Nords and clues are read! Current puzzle: Enter -1 to exit Which word to solve next?: 5 Current hint: Enter your solution: mars Red planet Correct! 1 2 3 4 5 Current puzzle: 1 2 3 4 5 |MILK LA # # 23 IS # Ask for hint: # Direction row col Ask for hint: # Direction 1: Horizontal 2: Horizontal 3: Horizontal 4: Horizontal 5: Vertical 6: Vertical 7: Vertical 1 row col 2 1 3 2: Horizontal 2 1 3: Horizontal 4: Horizontal 6: Vertical 7: Vertical 5 3 1 3. 3 3 3 3 2 5 Enter -1 to exit Which word to solve next?: 1 Current hint: White liquid produced by the mammals Enter your solution: milk Enter -1 to exit which word to solve next?: 2 Current hint: Used to indicate inclusion within space, a place, or limits Enter your solution: in Correct! Correct! Current puzzle: Current puzzle: 1 2 3 45 1 2 I L %23 MIL |IN # IR The program does not have to check the final condition of the word entered before (e.g. MARS → MIRS). Therefore, assume that .txt files are prepared correctly.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Files and Directory
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage