createdDate | timeRequired | topics |
---|---|---|
2021-12-13 |
1 Hour |
instruction,workshop, OOP, state machine, lookup table, recursion |
A workshop designed to get more familiarity with state machines, look up tables, and recursive loops.
To start, begin in trainlines.js
and follow the scaffolded comment instructions.
By the end, you will have a piece of command line software that allows the user to look at their map, transfer lines, and exit the program via "relaxing".
- Object oriented programming
- State machines
- Lookup tables
- Recursive loops
All a class constructor is, is a template for similar objects to be based off of. For example, in this workshop, all train lines have the same traits, therefore they are of the same class. This allows us to be more efficient in our code.
A recursive loop is a function that calls itself until an exit condition is met. For example, in this workshop, the riding
function is recursive until the player selects the relax
action which exits the process.