I need help with a text adventure for an exam

Good morning! I am currently studying video game developement and i have tests in February, for the Programming 2 final i have to program a Text-based adventure, the conditions are the following:

I have to start in Buenos Aires and i have to recieve 3 clues from a doctor, a policeman and a teacher, those clues have to guide me to another city from the country, i am given 3 choices and have to choose the correct one that leads me to the next city.

If i choose the wrong city, then it takes me back to the previous city.

The cycle has to repeat until i have travelled through all of the states in argentina and reach the end of the game, where i find the first flag ever made.

My question is, how should i approach this? We have learned arrays, matrixes, functions such as gotoxy, random, if, do while, etc.

Only structured programming, not objects.

Thanks in advance! Just looking for advices on how should i think the logic of this :D

edit 1:
The NPC'S that give me clues are: policemen, theachers, librarians, doctors.

The provinces and their capitals are:
Buenos Aires: La Plata
Catamarca: San Fernando del Valle de Catamarca
Chaco: Resistencia
Chubut: Rawson
Córdoba: Córdoba
Corrientes: Corrientes
Entre Ríos: Paraná
Formosa: Formosa
Jujuy: San Salvador de Jujuy
La Pampa: Santa Rosa
La Rioja: La Rioja
Mendoza: Mendoza
Misiones: Posadas
Neuquén: Neuquén
Río Negro: Viedma
Salta: Salta
San Juan: San Juan
San Luis: San Luis
Santa Cruz: Río Gallegos
Santa Fe: Santa Fe de la Vera Cruz
Santiago del Estero: Santiago del Estero
Tierra del Fuego: Ushuaia
Tucumán: San Miguel del Tucumán

Edit 2:
I thought about creating a struct that contains:
int number
string province
string capital

Then i thought about another array that contains a list of all possible clues that the NPC's can give me.
Last edited on
I would start with laying out what kind of state you need for your game like who you have talked to, where you are, etc.

From there, you can start making some forays into using that state to display the actual game to the user. Quick and dirty stuff is probably better here; just don't make it so bad you can't clean it up later!

Once you have some basic displays working you can start making ways for the user to manipulate the state via commands or whatever you desire.

Hopefully that's enough to get you started!
a key word in the suggestion above is 'state' ... this type of problem can be modeled by what is called a "finite state machine" or sometimes "state machine" for short... you can try these terms in google to get some background if this is new to you.
You are on the right track thinking about data structures. Even though you exclude objects you can still consider arrays of things involved in much the same way.

So you have arrays of Locations, Clues, Clue_Givers etc.

I’d also think about scenarios
- a clue is given - what it is and who gave it
- check out a clue
- move forward, move back

You need to know where you are, where you are going to and whether you got there and, whether that is the goal. This is more or less the state of play.

Thank you very much! I'll do my best! The most difficult thing is that i'm gonna have to program it in 3 hours or less the day of the exam :P
that time limit is the bigger challenge than the game, the design, or coding etc.
Keep it small and simple, avoid the temptation to add features or make it complicated. You will do fine if you stick to the plan you made ahead of time and recreate what you do in practice.
Topic archived. No new replies allowed.