Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Robotarm opdracht 7 afgerond #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Robotarm Exercises/exercises1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.loadLevel("exercise 1");
robotArm.speed = 1000;

// My instructions come here
robotArm.moveRight();
robotArm.grab();
robotArm.moveLeft();
robotArm.drop();

// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
33 changes: 33 additions & 0 deletions Robotarm Exercises/exercises10.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.loadLevel("exercise 11");
robotArm.speed = 1000;

// My instructions come here

for(i=0; i<9; i++){
robotArm.moveRight();}
for(i=0; i<10; i++){
robotArm.grab();
if (robotArm.scan()=="white") {
robotArm.moveRight();
robotArm.drop();
robotArm.moveLeft();
}
else {robotArm.drop();}
robotArm.moveLeft();
}

// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
39 changes: 39 additions & 0 deletions Robotarm Exercises/exercises11.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.loadLevel("exercise 11");
robotArm.speed = 1000;

// My instructions come here

for(i=0; i<8; i++){
robotArm.moveRight();}
for(i=0; i<9; i++){
robotArm.grab();
if (robotArm.scan()=="red") {
for(j=0; j<=i; j++){
robotArm.moveRight();
}
robotArm.drop();
for(j=0; j<=i; j++){
robotArm.moveLeft();
}
}
else {robotArm.drop();}
robotArm.moveLeft();
}



// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
178 changes: 178 additions & 0 deletions Robotarm Exercises/exercises12.1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.loadLevel("exercise 12");
robotArm.speed = 1000;

// My instructions come here

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(j=0; j<6; j++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(j=0; j<7; j++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(j=0; j<8; j++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(j=0; j<9; j++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=j; i++){
robotArm.moveLeft();
}
robotArm.grab();
}
robotArm.moveRight();

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(k=0; k<5; k++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(k=0; k<6; k++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(k=0; k<7; k++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(k=0; k<8; k++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=k-1; i++){
robotArm.moveLeft();
}
robotArm.grab();
}
robotArm.moveRight();

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(l=0; l<4; l++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(l=0; l<5; l++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(l=0; l<6; l++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(l=0; l<7; l++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=l-1; i++){
robotArm.moveLeft();
}
robotArm.grab();
}
robotArm.moveRight();

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(m=0; m<3; m++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(m=0; m<4; m++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(m=0; m<5; m++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(m=0; m<6; m++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=m-1; i++){
robotArm.moveLeft();
}
robotArm.grab();
}
robotArm.moveRight();

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(n=0; n<2; n++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(n=0; n<3; n++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(n=0; n<4; n++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(n=0; n<5; n++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=n-1; i++){
robotArm.moveLeft();
}
robotArm.grab();
}
robotArm.moveRight();

robotArm.grab();
while (robotArm.scan() != null) {
if (robotArm.scan()=="white") {
for(o=0; o<1; o++){
robotArm.moveRight();
}}
if (robotArm.scan()=="blue") {
for(o=0; o<2; o++){
robotArm.moveRight();
}}
if (robotArm.scan()=="red") {
for(o=0; o<3; o++){
robotArm.moveRight();
}}
if (robotArm.scan()=="green") {
for(o=0; o<4; o++){
robotArm.moveRight();
}}
robotArm.drop();
for(i=0; i<=o-1; i++){
robotArm.moveLeft();
}
robotArm.grab();
}




// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
39 changes: 39 additions & 0 deletions Robotarm Exercises/exercises12.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.randomLevel(1,7);
robotArm.speed = 500;

// My instructions come here

var i = 1;
robotArm.grab();
while (robotArm.scan() != null) {

for(var j=0; j<i; j++){
robotArm.moveRight();
}
robotArm.drop();
for(var j=0; j<i; j++){
robotArm.moveLeft();
}
i++;
robotArm.grab();
}





// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
52 changes: 52 additions & 0 deletions Robotarm Exercises/exercises2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<html>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="robot-arm.js"></script>
<script>
// Initialize the robot arm
var canvas = document.getElementById("canvas");
var robotArm = new RobotArm(canvas);

// Either use loadLevel or randomLevel to create a start scene
robotArm.loadLevel("exercise 2");
robotArm.speed = 1000;

// My instructions come here

robotArm.grab();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.drop();
robotArm.moveLeft();
robotArm.moveLeft();
robotArm.moveLeft();
robotArm.moveLeft();
robotArm.moveLeft();
robotArm.grab();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.moveRight();
robotArm.drop();
robotArm.moveLeft();
robotArm.moveLeft();
robotArm.grab();
robotArm.moveRight();
robotArm.moveRight();
robotArm.drop();



// Call run to run the animations
robotArm.run();
</script>
</body>
</html>
Loading