Intro to Programming: Portfolio Project

Intro to Programming: Portfolio Project

·

2 min read

For my portfolio project in Intro to Programming, we had to do a Python Terminal Game. This was my opportunity to create a Choose Your Own Adventure (CYOA) game.

CYOA from a Computer Science perspective is not about the A - the narrative in the Adventure. This is where you can waste a lot of time - creating a story to make the game exciting. This was not the focus of the project.

The project's focus was on developing the software design using the constraint of what we learned in Intro (mainly lists, dictionaries, classes, and file I/O) and in the execution of that design in the form of a working Python terminal program.

I started an iterative approach of creating a proof of concept or just about the most minimal viable assignment I could: a story node class that has a description and some choices. Once I could instantiate this object then I could display the story on the terminal and ask the player to enter their next choice.

Each choice would bring up another node until a terminal node is reached and the story concludes.

I soon added an int id as well as a title. Then I added a csv file format in order to be able to change the story in a file that would be loaded - and not have to hard code strings into a Python program.

The final result can be found at github in what I called Code of Shadows when I was still focused on the detective story narrative. You can try this code at replt.

Based on the csv story file my test case was the following choices:
At Welcome (where Text 1 and Text 2 are displayed) Press 1 [for Do Thing 1]
At Thing 1 (where three text lines are displayed) Press 3 [for Ending 2]

That concludes my CS101: Intro to Programming in Python Portfolio Project.