Programming Homework Help

Programming Homework Help. Non-Linear Story by reading a text file.

 

Deliverables:

● File with story text

● Source code (cpp and header files) – it must compile or you will receive a 0

● Questions (in a separate text file)

Note – there are two versions of this assignment:

● One uses an array

project is to create a non-linear story engine programmed in C++ . It will be similar to the types of

stories you can find on www.twinery.org. NOTE: you are not to use twinery.org to complete any part of this

assignment – It is noted here just to give you an idea of what an interactive story is.

Your project must have at least 10 story elements. In a non-linear story, some elements will move the story

forward, while others represent an alternate path. At each decision point, you can have any number of options,

but I suggest limiting to 3 for this assignment.

Here is an example of an interactive story- with five story elements – only 3 of the elements are listed here:

Story scene #1

A little girl is going through the woods with her red cape on the way to her grandmother’s house. It is a lovely

sunny day and she is singing and admitting the lush foliage in the forest. Suddenly she hears a movement behind

her and she sees a friendly wolf.

Should she:

Talk to the Wolf [goes to scene 2]

Give the basket to the Wolf and get out of there [goes to scene 3]

Story scene #2

The Wolf says, “Hello little girl, where are you going”. “To bring my sick grandmother some fresh eggs”, said the

little girl. “Can I help you carry all of those precious eggs so that they arrive safely”, the Wolf replied.

Should she:

Tell the Wolf she wants to visit Grandma herself [goes to scene 4]

Give the basket to the Wolf and get out of there [goes to scene 3]

Ask the Wolf to accompany her to her grandmother’s house [goes to scene 5]

Story scene #3

The Wolf says, “Hello little girl, where are you going”. “Hello sir”, she says sweetly. “I was going through the forest

to give my yummy eggs to someone and I think it should be you.”. The Wolf was pleased by the gesture and

distracted long enough for the little girl to slip away.

End of story

● Create your story

● Create the input file

● Create a class to store each “scene”

● Read the input file into a dynamic array of scenes

● Make it interactive: Create an engine to “run” a scene- i.e., display prompts and go correctly to

the next scene until you get to the end

Implementation Guidelines:

Read the story elements/scenes in from a file with the following format:

@s1 This is a description of a scene in the story.

It can span

several lines.

@p1 prompt for choice 1

4

@p2 prompt for choice 2

3

@p3 prompt for choice 3

7

Explanation:

@s1 beginning of a scene and also the scene number

@p first line is question to prompt user. Next line is scene to go to.

@0 terminating scene – it has text only. It may not be the last scene

In the example above, choice 1 will jump to the 4th scene.

For the story described above – here is the file to correspond to it. Note that this is NOT complete!

———————- Beginning of file ——————–

@s1 A little girl is going through the woods with her red cape on the way to her grandmother’s house. It is a lovely

sunny day and she is singing and admitting the lush foliage in the forest. Suddenly she hears a movement behind

her and she sees a friendly wolf.

@p1 Talk to the Wolf

2

@p2 Give the basket to the Wolf and get out of there

3

@s2 The Wolf says, “Hello little girl, where are you going”. “To bring my sick grandmother some fresh eggs”, said

the little girl. “Can I help you carry all of those precious eggs so that they arrive safely”, the Wolf replied.

@p1 Tell the Wolf she wants to visit Grandma herself

4

@p2 Give the basket to the Wolf and get out of there

3

@p3 Ask the Wolf to accompany her to her grandmother’s house

5

@s3 The Wolf says, “Hello little girl, where are you going”. “Hello sir”, she says sweetly. “I was going through the

forest to give my yummy eggs to someone and I think it should be you.”. The Wolf was pleased by the gesture

and distracted long enough for the little girl to slip away.

@0

———————- ETC——————–

Programming Homework Help