- The first interesting code required my to draw 10 boxes all 36 degrees varied only using several lines of code. Here is the code
for (var count2 = 0; count2 < 10; count2++) {for (var count = 0; count < 4; count++) {moveForward(100);turnRight(90);}turnRight(36);
- The next code builds a parallelogramfor (var count = 0; count < 2; count++) {moveForward(100);turnRight(60);moveForward(100);turnRight(120);}
- Next, the code creates 4 parralelogramsfor (var count2 = 0; count2 < 4; count2++) {for (var count = 0; count < 2; count++) {moveForward(100);turnRight(60);moveForward(100);turnRight(120);}turnRight(90);}
- This code creates 10 parellogramsfor (var count2 = 0; count2 < 10; count2++) {for (var count = 0; count < 2; count++) {moveForward(100);turnRight(60);moveForward(100);turnRight(120);}turnRight(36);}
https://studio.code.org/c/51803719 - In addition here is the code to create a circle
for (var count = 0; count < 360; count++) {moveForward(1);turnRight(1);}
- Here is the code to have the lady jump between circlesfor (var count2 = 0; count2 < 10; count2++) {// create_a_circlefor (var count = 0; count < 36; count++) {moveForward(10);turnRight(10);}jumpForward(25);}
- Here is the code to create 20 overlapping circlesfor (var count2 = 0; count2 < 20; count2++) {// create_a_circlefor (var count = 0; count < 36; count++) {moveForward(10);turnRight(10);}jumpForward(50);turnRight(18);}
- Here is the code to create a circle within a circle// create_a_circlefor (var count = 0; count < 36; count++) {moveForward((10));turnRight(10);}// create_a_circlefor (var count2 = 0; count2 < 36; count2++) {moveForward((5));turnRight(10);}
- Here is the code to create 5 circles inscribed within each other
for (var count3 = 0; count3 < 5; count3++) {// create_a_circlefor (var count = 0; count < 36; count++) {moveForward((10));turnRight(10);}// create_a_circlefor (var count2 = 0; count2 < 36; count2++) {moveForward((5));turnRight(10);}turnRight(72);} - Here is the code to make three snowflakesfor (var count3 = 0; count3 < 3; count3++) {// create_a_snowflake_branchjumpForward(90);turnLeft(45);for (var count = 0; count < 3; count++) {for (var count2 = 0; count2 < 3; count2++) {moveForward(30);moveBackward(30);turnRight(45);}turnLeft(90);moveBackward(30);turnLeft(45);}turnRight(45);turnRight(45);
- In addition here the code to create an entire snow flakefor (var count3 = 0; count3 < 8; count3++) {// create_a_snowflake_branchjumpForward(90);turnLeft(45);for (var count = 0; count < 3; count++) {for (var count2 = 0; count2 < 3; count2++) {moveForward(30);moveBackward(30);turnRight(45);}turnLeft(90);moveBackward(30);turnLeft(45);}turnRight(45);turnRight(45);
- Here is the last code that I created
Code.org assignmen
Mt. Sac Class Elec-10
Tuesday, February 2, 2016
Frozen Assignment
Minecraft Assignmment
- Here is the code of first loop to put down a block and move forward.for (var count = 0; count < 4; count++){ placeBlock("planksBirch"); moveForward(); }
- In addition here is the code that I used to build my house on minecraft
for (var count = 0; count < 2; count++) {moveForward();placeBlock("planksBirch");}turnLeft();moveForward();placeBlock("planksBirch");turnRight();for (var count2 = 0; count2 < 2; count2++) {moveForward();placeBlock("planksBirch");}turnRight();for (var count3 = 0; count3 < 4; count3++) {moveForward();placeBlock("planksBirch");}turnRight();for (var count4 = 0; count4 < 3; count4++) {moveForward();placeBlock("planksBirch");}
- In addition, this next code made the character plant a bunch of cropsfor (var count = 0; count < 6; count++) {plantCrop();moveForward();}turnRight();moveForward();moveForward();turnRight();for (var count2 = 0; count2 < 7; count2++) {plantCrop();moveForward();}
- In this next code we were introduced to if else statements.Here is the code:for (var count = 0; count < 7; count++) {destroyBlock();ifLavaAhead(function() {placeBlockAhead("cobblestone");});moveForward();}
- This code uses if statements againfor (var count = 0; count < 2; count++) {moveForward();}destroyBlock();ifLavaAhead(function() {placeBlockAhead("cobblestone");});moveForward();turnRight();destroyBlock();ifLavaAhead(function() {placeBlockAhead("cobblestone");});moveForward();turnLeft();destroyBlock();ifLavaAhead(function() {placeBlockAhead("cobblestone");});moveForward();turnLeft();for (var count2 = 0; count2 < 5; count2++) {destroyBlock();ifLavaAhead(function() {placeBlockAhead("cobblestone");});moveForward();}
- For the last code of this assignment I tried to cook the sheep with tnt
Monday, February 1, 2016
Starwars Assignment
- Piloting the robot.
- moveRight();moveRight() // makes the robot move right twice
- moveRight(); moveRight(); moveDown();moveDown(); // makes the robot move right twice then it moves down twice
- moveRight();moveUp();moveDown();moveRight();
- moveDown();moveLeft();moveLeft();moveDown();moveDown();moveLeft();
- moveRight();moveRight();moveDown();moveDown();moveLeft();moveDown();
- moveDown();moveDown();moveUp();moveRight();moveRight();moveUp();moveDown();moveRight();
- Videogame
- Here is the video of my first code that used a function to command the robot to move when the up and down keys are activated.
- Here is the next code
function whenUp() {goUp();}function whenDown() {goDown();}function whenRight() {goRight();}function whenLeft() {goLeft();} // this code allows the robot to go up, left, down, and right at either the command of the arrow keys on the screen or by the keyboard.
- In the next part of the code more functions were given to the robot. The goal was to have 900 points at the very end of the run.
- For this next part here is the code I used.functionfunction whenGetStormtrooper(){ removePoints(100);}function whenGetRebelPilot() { addPoints(200);}function whenGetMynock() { addPoints(200);}
- For this next code. Three pigs were added to the code. Here is the code.playSound("R2-D2sound1");addCharacter("PufferPig");addCharacter("PufferPig");addCharacter("PufferPig");function whenGetPufferPig() {playSound("PufferPigRandom");addPoints(1000);}
- In addition, this next code added 8 different characters.
addCharacter("Tauntaun");addCharacter("Tauntaun");addCharacter("Tauntaun");addCharacter("Tauntaun");function whenGetTauntaun() {playSound("TauntaunRandom");addPoints(50);addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");addCharacter("Mynock");} - In the next code the directions were to multiply the mouses everytime a mouse is caught by R2D2.function whenGetMouseDroid(){ addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");addCharacter("MouseDroid");}
- In this code we changed R2D2 into 3CPO and we made him super fast.
addCharacter("RebelPilot");addCharacter("RebelPilot");
addCharacter("RebelPilot");
setDroid("C-3PO");
setDroidSpeed("fast");
setBackground("random");
setMap("random");
function whenGetRebelPilot(){addCharacter("PufferPig")} - Here is the Code for the video game I designed.setBackground("Endor");setMap("circle");setDroid("R2-D2");setDroidSpeed("normal");playSound("R2-D2random");setDroidSpeed("fast");function whenUp() {goUp();}function whenDown() {goDown();}function whenLeft() {goLeft();}function whenRight() {goRight();}addCharacter("RebelPilot");function whenGetRebelPilot(){addPoints(5);setMap("grid");setBackground("Hoth");addCharacter("Stormtrooper");addCharacter("Stormtrooper");moveFast("Stormtrooper");addCharacter("MouseDroid");}function whenGetMouseDroid(){setDroid("random");setDroidSpeed("fast");setMap("random");addPoints(10);setBackground("random");addCharacter("Stormtrooper");addCharacter("MouseDroid");addCharacter("Mynock");}function whenGetMynock(){setDroidSpeed("fast");setBackground("random");setMap("random");addCharacter("Stormtrooper");}function whenGetStormtrooper(){setDroidSpeed("slow");addCharacter("MouseDroid");addCharacter("Mynock");removePoints(10);addCharacter("PufferPig");}function whenGetPufferPig(){addPoints(10);setDroidSpeed("fast");}function whenGetAllPufferPigs() {endGame("win");}
- Furthermore, here is the link to play the game I designed https://studio.code.org/c/175402992

Subscribe to:
Comments (Atom)