parsing colossal cave adventure advent.dat


 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions parsing colossal cave adventure advent.dat
# 1  
Old 10-04-2011
Network parsing colossal cave adventure advent.dat

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
The course work is to implement "Colossal Cave Adventure"(350 original version) in C programming on unix environment. the detail about the game can be found here - The Colossal Cave Adventure page . I am stuck up with parsing the advent.dat which contains the structure and elements about game environment. Please explain the structure of the advent.data


2. Relevant commands, code, scripts, algorithms:

Few lines from advent.dat

1
1 YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING.
1 AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND
1 DOWN A GULLY.
2 YOU HAVE WALKED UP A HILL, STILL IN THE FOREST. THE ROAD SLOPES BACK
2 DOWN THE OTHER SIDE OF THE HILL. THERE IS A BUILDING IN THE DISTANCE.
3 YOU ARE INSIDE A BUILDING, A WELL HOUSE FOR A LARGE SPRING.
4 YOU ARE IN A VALLEY IN THE FOREST BESIDE A STREAM TUMBLING ALONG A
4 ROCKY BED.
5 YOU ARE IN OPEN FOREST, WITH A DEEP VALLEY TO ONE SIDE.
6 YOU ARE IN OPEN FOREST NEAR BOTH A VALLEY AND A ROAD.
7 AT YOUR FEET ALL THE WATER OF THE STREAM SPLASHES INTO A 2-INCH SLIT
7 IN THE ROCK. DOWNSTREAM THE STREAMBED IS BARE ROCK.
8 YOU ARE IN A 20-FOOT DEPRESSION FLOORED WITH BARE DIRT. SET INTO THE
8 DIRT IS A STRONG STEEL GRATE MOUNTED IN CONCRETE. A DRY STREAMBED
8 LEADS INTO THE DEPRESSION.
9 YOU ARE IN A SMALL CHAMBER BENEATH A 3X3 STEEL GRATE TO THE SURFACE.
9 A LOW CRAWL OVER COBBLES LEADS INWARD TO THE WEST.
10 YOU ARE CRAWLING OVER COBBLES IN A LOW PASSAGE. THERE IS A DIM LIGHT

3. The attempts at a solution (include all code and scripts):



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Blekinge Institute of Technology, Sweden, Charlie Svanberg, DV1305

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
# 2  
Old 10-20-2011
Well, obviously it's a text adventure game.
The first column is the action or position code and the following data it's the message the player will see.

How do you want to parse it? Which language will you use?

If you want to take only action codes, you can
Code:
cut -f1 -d' ' file

or with awk by
Code:
awk '{print $1}' file

and only the text by
Code:
cut -f2- -d' ' file

Notice the space between the single quotes.

Please be more specific.
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

2. UNIX for Dummies Questions & Answers

UNIX 'adventure'/game.

Hi there.. I know this is a kind low question, but do anyone know where I can find some hints and or clues for the "adventure" game on UNIX ? ( /usr/games/adventure ). I already searched on this forum but didnt find the answer to my question. Thanks a lot.... (3 Replies)
Discussion started by: TARFU
3 Replies
Login or Register to Ask a Question