Understanding how to parse a text file.

HugeLag

New member
Joined
Nov 14, 2016
Messages
1
Programming Experience
Beginner
So a little background. I am a first year uni student, and I am a complete beginner to c sharp. For my first year programming coursework I need to make a word search puzzle. The first part of my specification asks me to parse 3 specific text files. Could someone explain to me how I am meant to go about doing this? The following are the pre-defined text files.

This is what it says in my specification to be specific: -

  • When the program begins it must first load a word search that has been pre-defined in atext file. 3 puzzle files have been made available as part of the coursework.
  • The program should be able to load any one of these files.
  • The file path should be passed to the program via a command line argument.
  • Refer to the Puzzle File Specification for detailed explanation of the file format.

File01.txt ? contains only horizontal words: -


9,5,2
algorithm,0,1,right
virus,5,4,left

File02.txt ? contains only horizontal and vertical words: -


9,6,4
algorithm,0,1,right
virus,5,4,left
data,0,0,down
binary,4,5,up

File03.txt ? contains horizontal, vertical and diagonal words: -

10,10,8
algorithm,0,1,right
virus,5,4,left
data,0,0,down
binary,4,5,up
loop,8,9,leftup
code,6,9,rightup
compile,8,3,leftdown
file,1,6,rightdown

The above 3 are the text files, what I am going to write below is to understand the text files better.

The first line of the file specifies:

<number of columns>, <number of rows>, <total number of hiddenwords>

Each line that follows specifies the word and its properties: -

<Word>, <Column Co-ordinate of first letter>, <Row Co-ordinate first letter>,<Direction>.

It would be immense help if someone could get me started and explain to me how to parse the above text files. I really hope this thread dosent seem like I am just throwing my homework for someone to do. I genuinely just hoping someone to explain how to do it.

All replies, and help is much appreciated :)
 
Back
Top Bottom