code in a kit
06-22-2017, 03:38 AM (This post was last modified: 06-22-2017 12:42 PM by figosdev.)
Post: #1(Print Post)
code in a kit
so this is an idea that i think is worth trying, but theres no actual *need* for it; youre letting someone do something that could be done for them.
"code in a kit" is computer code thats "packaged" in a text file, in small pieces. to "put the pieces together," the user takes these pieces out of the file using copy or cut, and pastes them where they go.
its kind of like building a model airplane.
the person doesnt have to know how to write code, they only need to put the pieces correctly in place. they can learn about each piece (unless they skip that part) be reading the area above that piece.
what happens if they just run the code "out of the box?" nothing, because it wont be put together that way. the point is to learn how to put it together.
why not a tutorial instead?
tutorials are great. perhaps you could have a tutorial in a kit too--
"put together your own tutorial... just copy these pieces..."
i have said that cheat sheets are like a lightsaber for coders; you need one when youre learning, and as you learn more, you are inclined to build your own.
whats the best kit to put together like a model airplane? a programming language! you could learn about each part as you put it together, you could even customise it by choosing the parts you want.
video game, browser-- and even subroutines.
like some models let you build a car, others let you build an engine. so you could have kits at different scales.
id like to do a book on programming with this approach. "over 25 programs to build!"
could be a fantastic app.
Code Snippet: [Select]
# [ part 1 ]
# sets the radius,
# horizontal location of the circle (cx)
# and vertical location of the circle (cy)
r = 250
cx = 350
cy = 300
# [ part 2 ]
# starts a numeric loop that begins at -3.14
# and finishes at 3.14, adding 1/r on each repeat
for p = -3.14 to 3.14 step 1/r
# [ part 3 ]
# closes the loop
# all code between parts 2 and 3 repeats
# [ part 4 ]
# calculate the x of one dot
# get the cosine of p, times circle radius
# round down to the nearest whole number, add cx
x = cos(p) * r
x = int(x) + cx
# [ part 5 ]
# calculate the y of one dot
# get the sine of p, times circle radius
# round down to the nearest whole number, add cy
y = sin(p) * r '5
y = int(y) + cy
# [ part 6 ]
# draw a dot at x, y
# [ part 7 ] optional!
# wait between each dot so the circle draws slowly
sound 32767, .01
User(s) browsing this thread: 1 Guest(s)