-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex36_note.txt
More file actions
36 lines (30 loc) · 1.62 KB
/
ex36_note.txt
File metadata and controls
36 lines (30 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
In this file I will add a bit of personal experience and recommendations for
exercise 36.
Rules for If-Statements:
*Always having an else is not too vital, context matters though.
*Having complex boolean tests over multiple lines can make sense sometimes,
especially with long variable names.
THE WARNING GIVEN IS EXTREMELY ACCURATE
Rules for Loops:
*While loops should only be used when the amount of looping is unknown or
infinite. When I say 'unknown', anything that a for loop cannot be processing.
*A sign that you should be using a for loop instead of a while loop is when you
are indexing through a data structure (like a list).
Tips for Debugging:
*Start simple and use prints, they will get you a long way.
*Really, prints are a vital skill.
*Test early and test often, start testing as soon as you can on a piece of
code.
*Debuggers will come in handy later on (probably well beyond this textbook).
Debuggers will let you track variable values easily (prints can technically
allow you to do this) and also follow the flow of the program (what gets
called).
Homework:
The map for this kind of game is technically called a statemachine. They can
get complex very quickly depending on variable counts and number of possible
states (think combinations of rooms and things done previously).
With respect to doing the easiest steps first, I would recommend getting the
minimum functionality done first. What I mean by this is getting something
like your main function done and the calls if makes from there. When an easier
part can be done first, do it, otherwise focus on structure. Remember to
comment when you write your own code!