: Ok now here's an even tougher problem...
:
: * * 1 O F 2 E 3
: 3 E A * * I * G
: * * K * * S * G
: * 4 E 6 C H * *
: * O * P * * * *
: 7 R A P E * * *
: * K * L * * * *
: * * 8 E M O N *
: Many people drink it in the morning with milk or cream
: British people drink it at 5 o'clock
: Juicy, round, reddish, sweet fruit with a furry skin
: You make wine from this fruit
: You make lemonade from this fruit
: You serve it at birthday parties
: You can find them in the sea
: Chickens lay these
: This is what meat from a pig is called
: An _____ a day keeps the doctor away
:
: Now that is what my text file which contains the crossword looks like.
:
: The first 5 hints are the 5 horizontal words and the latter 5 the vertical words respectively.
:
: 3 questions:
: 1. I need to draw the puzzle in the Pascal program, but how do I make it so that the letters are replaced with a blank space but the numbers are still left? I know that to 'erase' the letters I can use a if-then-else statement, but what about the numbers?
:
Don't include the numbers in the if-then statement. This way they will remain "not spaced".
If you want the numbers to be spaced, add them to the if-then statement.
: 2. Now this is a real tough nut to crack. How should I store the hints in two different one dimensional arrays (one for horizontal and one for vertical) so that the correct hint can be recalled when the user enters a choice? For example if the user enters '4' (which is the word 'tea' and is in the second horizontal row) the program will then recall the 2nd hint.
I would include a number before the hints. This way the computer can locate the hints, based on the numbers. I've written a simple function to split a string in parts, based on a delimiter. This function can be found here:
http://www.codepedia.com/1/StringSplit. This way you have a 1D-array, and you can quickly determine if the word is horizontal or vertical.
:
: 3. For words that share the same first letter (so the word can go across or down), is it correct to use a if-then-else statement to determine which word to fill in?
:
There are 2 ways of handling this:
- Ask the player if he wants to enter the horizontal or vertical word.
- Add the words also to the 1D-array. Especially with StringSplit() you can check if the word is horizontal or vertical based on the location in the array.