Commit Graph

3 Commits

Author SHA1 Message Date
Pat Wick b7d14a11d0 did both checkpoints before submitting
Sorry for that, I guess I should have realized without new changes,
committing wasn't really going to work. Anyway, the turtle by default
points toward the right, so I used a side-length-then-turn-clockwise
pattern to draw the triangle and rectangle. I did have to fix my rectangle
though; I forgot the last turn at the end, so while the test worked well,
the drawing looked like abstract art. I watched the turtle draw the shapes
on my second run of the same incorrect code and noticed the direction changed
which is how I knew what to fix.

A function is like a variable in that variables store some value, while
functions store instructions; in essence, they're both storage devices
used to make code easier/more efficient to read, write, and understand.

The small, easy problems are the basic under-defined functions that start
off the whole problem-solving process. Taking these small pieces and making
them into functions that do one specific job allow code to be tested easily
as the larger problem is still being solved and make development of code
smoother because fixing one problem (hopefully) doesn't break something else
somewhere else in the program. An example that I've used with my students
was designing a tic-tac-toe game using the turtle functions. Breaking the
(simple but) larger problem into pieces might mean "can I just draw an x"
so we wrote a function that just makes x's, then one that just made o's,
then we used those functions inside of a function that asked the user for
a position on the screen, along with another function that chose which symbol
to draw depending on the turn counter, to make the game look as intended.
2023-07-16 20:51:21 -04:00
Pat Wick dda8666763 CP1: imported math for pi, used the area formula
A value is some object that exists, whereas a name is a reference to
that value. An example where it is important to distinguish between a
name and the value it represents is any reference to time. Sometimes
generalization is acceptable ("I don't have time") but often the actual
amount matters and so we care about the value, not the name itself.

Variables are useful in programming because their values are able to be
changed, by definition (variables can vary). This is useful because we
can use variables to parameterize our code, allowing for easier modification
and improvement or expansion. They can also make code more readable,
even without documentation because effective naming of variables allows
someone (even one who didn't write the specific code referenced) to see
the variable names and hopefully understand what the values mean and how
they are used in the program, for example, using "ballSpeed" vs "x".
2023-07-16 20:35:32 -04:00
pwick 1afc5bf40d Initial commit 2023-07-16 20:39:12 +00:00