What is big data:
Big data is any large amount of data.
Moore's law: Moore's law states that every X years, the amount of microprocessors on a chip is doubled
Thursday, December 1, 2016
Wednesday, November 30, 2016
Space Ship Scene Reflection
- The purpose of the code is to create a scene in space. It works by calling multiple functions that create objects such as spaceships and planets. The most important features are randomized planets with craters, a ufo, a black hole, and a spaceship with animated fire.
- The most difficult part for me was the fire for the spaceship. It had to be animated, and look like fire. I achieved the fiery look by making the fire made out of 2 curves, one to the left and one to the right. I then turned the turtle 180 degrees and repeated it, so it got to the original start position of the flame. I then took a stored variable of the distance away from the center of the ship, and had it return to the center. To animate the flames, I had the draw flames loop for infinity, which made new flames constantly, making it animated.
- An abstraction I used was to split up the main function of drawing the spaceship into smaller sub functions. I had a simple main function that was split up into smaller more complex functions. The main function called functions to draw the body of the ship, the top, the rocket, and the flames. The main function also had a parameter to rotate the ship. Functions with parameters are a type of abstraction.
- We used collaboration to split up the tasks into manageable chunks. We each had sections of code we chose to make. Collaboration was also used for feedback. Before putting everything in the main code, we shared our result and our team mates gave their feedback on it so it could be improved.
CODE:
function drawShip(angle) {
hide();
turnTo(angle);
drawBody();
drawTop();
drawRocket();
drawFlames();
}
function drawBody() {
penDown();
penColor("#FA6323");
penWidth(20);
turnLeft(90);
moveForward(15);
for (var i = 0; i < 3; i++) {
turnRight(90);
moveForward(30);
}
turnRight(90);
moveForward(15);
turnRight(90);
moveForward(15);
dot(21);
penColor("black");
dot(15);
penColor("#FACF23");
dot(13);
}
function drawTop() {
penUp();
penColor("#7A7A7A");
moveForward(40);
dot(15);
moveBackward(10);
turnRight(90);
moveForward(15);
turnLeft(90);
penDown();
turnLeft(30);
for (var i = 0; i < 2; i++) {
moveForward(30);
turnLeft(120);
}
moveForward(30);
penUp();
moveBackward(15);
turnLeft(90);
moveBackward(22);
}
function drawRocket() {
penUp();
moveBackward(40);
penColor("#4A4A4A");
penDown();
penWidth(15);
turnLeft(90);
moveForward(5);
turnLeft(30);
moveForward(15);
turnLeft(150);
moveForward(30);
turnLeft(150);
moveForward(15);
turnRight(60);
penUp();
turnLeft(90);
moveForward(3);
turnLeft(90);
}
function drawFlames() {
moveForward(15);
speed(100);
var originalDist;
var arcDist;
for (var i = 0; i < 1; i) {
turnRight(90);
penRGB(255, randomNumber(104, 175), 17, 1);
penWidth(randomNumber(2, 6));
penDown();
originalDist = randomNumber(-20, -2);
arcDist = randomNumber(15,40);
moveForward(originalDist);
turnLeft(90);
arcRight(30, arcDist);
arcLeft(30, arcDist);
turnRight(180);
arcLeft(30, arcDist);
arcRight(30, arcDist);
turnRight(180);
arcLeft(30, arcDist);
arcRight(30, arcDist);
turnRight(180);
arcRight(30, arcDist);
arcLeft(30, arcDist);
turnRight(90);
moveForward(originalDist);
turnRight(90);
}
}
drawShip(0);
Wednesday, November 23, 2016
Smiley Face
https://studio.code.org/projects/applab/U_jdUmHE-fs-h2KCsjBu8w
https://studio.code.org/projects/applab/gZij3sn3oweRYoALNHxD9A
https://studio.code.org/projects/applab/gZij3sn3oweRYoALNHxD9A
Monday, November 21, 2016
Functions with parameters
Prompt: 1. 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.
Whenever you have a function that needs an input, use parameters. For example, if you had a function that took 2 numbers and added them, then multiplied them together, you would want a parameter for the input.
Prompt 2. When do you need a function with a parameter?
Whenever you need a outside input to the function.
Iteration
Define and provide examples of iteration:
Iteration: loops, repeating something.
examples: loops in code. for loops, while loops, and do while.
Iteration: loops, repeating something.
examples: loops in code. for loops, while loops, and do while.
Friday, November 18, 2016
Smiley code reflection
Copy and paste your code to create your smiley face.
penColor("lightgreen");
dot(500);
penUp();
penColor("purple");
penWidth(5);
move(0, -175);
penDown();
move(0, 50);
penUp();
move(0, 50);
turnRight(45);
penColor("red");
penDown();
arcRight(180, 25);
moveForward(50);
penUp();
moveTo(160, 165);
turnTo(-45);
penDown();
arcLeft(180, 25);
moveForward(50);
penColor("purple");
penUp();
moveTo(140, 300);
penDown();
turnTo(-90);
arcLeft(180, 25);
penUp();
moveForward(40);
penDown();
moveForward(10);
arcLeft(180, 12.5);
arcRight(180, 12.5);
moveForward(10);
What challenges did you face in this lab?
The biggest challenge was finding where to put all of the dots/curves
How did you solve these challenges?
I figured out the center of the coordinate grid by guess and check, then offset the dots a equal distance from the center.
Did you collaborate with others in class?
no
Did you get or provide help to other "programmers" in class? With what? What documentation did you use for this lab today?
I used the documentation from code.org
Provide examples of other libraries you are familiar with in other programming languages.
I’m familiar with a lot of the libraries in Java, such as the input, and the math librarys.
Wednesday, November 16, 2016
Unit 3 stage 5 reflection
function drawStep(){
moveForward();
turnLeft();
moveForward();
right();
}
function right(){
turnLeft();
turnLeft();
turnLeft();
}
function drawSide() {
drawStep();
drawStep();
drawStep();
moveForward();
right();
}
function drawDiamond() {
drawSide();
drawSide();
drawSide();
drawSide();
}
drawDiamond();
1. Prompt: “List the benefits of being able to define and call functions in a program. Who specifically gets to enjoy those benefits?”
Everyone enjoys the benefits of functions. It makes programmer’s lives easier, and also makes the code easier to read and understand. It organizes code, saves you from writing repeating code, and makes the code easier to read.
2. Prompt: “How is the use of a function an example of abstraction?”
Functions are an example of abstraction because it can make parts of your code reduced to essential commands. It reduces large chunks of code into nicely named functions, which give only the essential data. Within the function, only the relevant data is passed into it, making it simplified.
3. Prompt: Explain more than one reason why programming languages have functions.
Functions are useful tools to split up code and make it look logical, while also being able to reuse sections of code. For example, if I had a section of code that calculated (number A x number B - 52)/5, or something that took out a section of a string, instead of rewriting that code, I could just use a function, and call that function inputting the numbers. They also organize code. Instead of having a large chunk of code that does a complicated math function, you could send it to a function, which might be named takeDerivative(). That way you know it takes the derivative of the function, without seeing the large chunk of code.
Subscribe to:
Posts (Atom)