These last two weeks have just been programming or analyzing scratch
One of the things we have been doing is to discover where a number is after a program. Example follows:
When space key pressed
Set X to 4
Set Y to 7
Repeat 4
If X>Y
Set Y to Y + X
Set X to X - 1
Else
If Y>X
Set X to X + Y
Set Y to Y - 1
Else
Add 10 to Y
Say Join (X)(Y)
To discover the result, you could make it and see, or you could work through it. Example Continues
So, at the first part, X = 4 and Y = 7
Then the first loop plays
first it checks, Is X greater than Y? NO
this places it into the "Else" category
now it checks, Is Y greater than X? YES
now it makes X equal X + Y. 4 + 7 = 11
now it makes Y equal Y - 1. 7 - 1 = 6
Now it repeats the loop
first it checks, Is X greater than Y? YES
now it makes Y equal Y + X. 6 + 11 = 17
now it makes X equal X - 1. 11 - 1 = 10
3rd repeat
first it checks, Is X greater than Y? NO
this places it into the "Else" category
now it checks, Is Y greater than X? YES
now it makes X equal X + Y. 10+ 17 = 27
now it makes Y equal Y - 1. 17 - 1 = 16
4th (and final) repeat
first it checks, Is X greater than Y? YES
now it makes Y equal Y + X. 16 + 27 = 43
now it makes X equal X - 1. 27 - 1 = 26
Now comes the Say command
Join means list them (in that order), so if X was he and Y was llo, join (X)(Y) would result in "hello"
In this case, X = 26 and Y = 43, so it would say "2643"
Sunday, September 28, 2014
Sunday, September 7, 2014
Post 1 (9/7/2014)-Online Privacy and a bit of Scratch
Over the First two weeks, we set up the class, looked over a lot of information regarding online privacy, and started working on Scratch, a program designed by MIT. Scratch seems to be designed to explain the theory of programming to the user, for instance, you can drag the if () then (), else () block in without worrying about how you say it in that programming language, or about messing up the syntax of the language(I.E. forgetting to put a semicolon at the end of applicable lines (in java))
The information regarding online privacy was not very surprising, with the possible exception of the "filter bubble", which is a term for the fact that search engines(such as Google) sort their results by your browser, computer, history, and anything else it can access. This causes you to not receive some results, get (sometimes significantly) different results from other people, and repeatedly find the same few things. Another online privacy issue was cookies (small pieces of information stored on your computer that some websites consult to determine what to do. They allow you to stay logged in, keep things in your "shopping cart", and allow companies to determine what ads to use)
On Scratch, we have mostly just been discovering what each "block" does and using them to "write" extremely simple programs, such as a short conversation or music(or at least something attempting to be music). However, Scratch, while it has a block that says "moves 10 steps" does not explain how this is accomplished, the actual coding of the block probably looks more like this:
for (long i = 1; i <= 10; ++I) objectName.x = objectName.x + 1;
(objectName.x is the x coordinate of the object)
Or, more likely, they did something I didn't think of.
This means that, while it is useful for understanding the concept of programming, it doesn't help with the syntax of the language, which is what I have had the most difficulty with, as of yet.
The information regarding online privacy was not very surprising, with the possible exception of the "filter bubble", which is a term for the fact that search engines(such as Google) sort their results by your browser, computer, history, and anything else it can access. This causes you to not receive some results, get (sometimes significantly) different results from other people, and repeatedly find the same few things. Another online privacy issue was cookies (small pieces of information stored on your computer that some websites consult to determine what to do. They allow you to stay logged in, keep things in your "shopping cart", and allow companies to determine what ads to use)
On Scratch, we have mostly just been discovering what each "block" does and using them to "write" extremely simple programs, such as a short conversation or music(or at least something attempting to be music). However, Scratch, while it has a block that says "moves 10 steps" does not explain how this is accomplished, the actual coding of the block probably looks more like this:
for (long i = 1; i <= 10; ++I) objectName.x = objectName.x + 1;
(objectName.x is the x coordinate of the object)
Or, more likely, they did something I didn't think of.
This means that, while it is useful for understanding the concept of programming, it doesn't help with the syntax of the language, which is what I have had the most difficulty with, as of yet.
Subscribe to:
Posts (Atom)