Wednesday, November 30, 2016

Day 2 Space Project

Just finished my comets and asteroid belt with its full detail. Changed the asteroids to being curvy with arcs instead of circles. Put comets in fixed places. Putting all of our code together and organizing it now.

penColor("black");
dot(2000);
penUp();
function drawComet(x, y, size, speed) {
  penRGB(238, 71, 29, 1);
  moveTo(x, y);
  penDown();
  dot(size);
  penUp();
  turnTo(45);
  moveForward(size);
  turnTo(135);
  penDown();
  moveForward(speed);
  penUp();
  moveTo(x, y);
  turnTo(180);
  moveForward(size);
  penDown();
  turnTo(135);
  moveForward(speed);
  penUp();
  moveTo(x, y);
  turnTo(130);
  moveForward(size);
  penDown();
  moveForward(speed);
  penUp();
}
drawComet(40, 383, randomNumber(5, 10), randomNumber(20, 40));
drawComet(240, 390, randomNumber(5, 10), randomNumber(20, 40));

function drawAsteroid(x, y) {
  penRGB(132, 72, 12, 1);
  penWidth(5);
  moveTo(x, y);
  penDown();
  arcRight(90, 2);
  arcRight(90, 2);
  arcLeft(90, 2);
  arcRight(90, 2);
  arcRight(90, 2);
  arcLeft(90, 2);
  arcRight(90, 2);
  arcRight(90, 2);
  arcLeft(90, 2);
  arcRight(90, 2);
  arcRight(90, 2);
  turnTo(270);
  moveForward(5);
  turnTo(180);
  moveForward(5);
  turnTo(90);
  moveForward(5);
  penUp();
}
for (var i = 0; i < 40; i++) {
  drawAsteroid(randomNumber(10, 300), randomNumber(15, 125));
}

Monday, November 28, 2016

Day 1 Space Project

It took me one class period to finish both of my project with medium depth. Next class I will work on adding more quality but now I am satisfied with a skeleton of my assignments, comets and asteroid belt.

penColor("black");
dot(2000);
penUp();
function drawComet(x, y, size, speed) {
  penRGB(238, 71, 29, 1);
  moveTo(x, y);
  penDown();
  dot(size);
  penUp();
  turnTo(45);
  moveForward(size);
  turnTo(135);
  penDown();
  moveForward(speed);
  penUp();
  moveTo(x, y);
  turnTo(180);
  moveForward(size);
  penDown();
  turnTo(135);
  moveForward(speed);
  penUp();
  moveTo(x, y);
  turnTo(130);
  moveForward(size);
  penDown();
  moveForward(speed);
  penUp();
}
for (var i = 0; i < 4; i++) {
  drawComet(randomNumber(10, 300), randomNumber(130, 440), randomNumber(5, 10), randomNumber(20, 40));
}
function drawasteroid(size) {
  penRGB(74, 52, 1, 1);
  dot(size);
}
function drawasteroidbelt(x, y) {
  moveTo(x, y);
  drawasteroid(randomNumber(4, 6));
}
for (var i = 0; i < 40; i++) {
  drawasteroidbelt(randomNumber(20, 300), randomNumber(100, 20));
}

Wednesday, November 23, 2016

Unit 3 Stage 7 Smiley Face and Extended

https://studio.code.org/projects/applab/xSrZ6VK5CK6kgh3xq5APgQ


https://studio.code.org/projects/applab/q18fgTyJnfaUVfhsewrJ9g


Monday, November 21, 2016

Functions with Parameters


  • Develop a rule for deciding when to create a function with a parameter rather than a normal function. Below your rule write a couple sentences justifying your rule.
    • If you are going to call the function back with a different value. 
  • When do you need a function with a parameter?
    • When you plan on calling back the function but with a different value for specific variables every time. 


What is Iteration

What is Iteration?

Iteration is repetition that is defined by specific actions and can be started and ended with specific commands. Otherwise known as loops. While, Do While, Conditional loops.

I have used loops to help sort things with node,js and I have used them many times before with visual basic. I have also used loops in other languages like python.

While x = 2
print "x = 2"
x + 1
Loop

Thursday, November 17, 2016

Unit 3 Stage 6

Imagine that you have two programs that drew the diamond-shaped figure. One program uses functions as we did in the previous lesson. The other doesn’t use functions; it’s just a long sequence of the turtle’s primitive commands. Which program is more efficient? Make an argument for why one is more efficient than the other.

The one with functions because it is more readable, therefore it takes less time for the programmer to read, understand, and code the program. 

Where else in your life have you seen layers of abstraction? Connect the idea of layers of abstraction to some other activity.” Provide at least 3 examples and describe the connection. Post on your blog.   Do the questions at the end of Unit 3 stage 6

Wednesday, November 16, 2016

Functions Unit 3 Stage 5

Prompt: List the benefits of being able to define and call functions in a program. Who specifically gets to enjoy those benefits?
The benefits of being able to call functions later save time, space, and a headache because the programmer does not have to re-make or copy lines from previous code over and over again. Therefore it specifically benefits the programmer.
Prompt: How is the use of a function an example of abstraction?
It makes things easier to read without writing every step out every time.

Prompt:  Explain more than one reason why programming languages have functions.
They make reading the code easier, they make creating the code faster, and they make big problems simpler.