Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42755 from code-dot-org/levelbuilder
DTS (Levelbuilder > Staging) [robo-dts]
- Loading branch information
Showing
50 changed files
with
1,939 additions
and
825 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
dashboard/config/libraries/zHelloWorldValidation.interpreted.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
function level4(){ | ||
//This level requires zValidationHelperFunctions | ||
|
||
if (!validationProps.successCriteria) { | ||
validationProps.successCriteria = { | ||
clickedSprite: false | ||
}; | ||
} | ||
if(!validationProps.clickedSprites){ | ||
validationProps.clickedSprites=[]; | ||
} | ||
|
||
// Helper variables | ||
var spriteIds = getSpriteIdsInUse(); | ||
var eventLog = getEventLog(); | ||
|
||
//check for unclicked sprites, and show hand with rings | ||
if(World.seconds >1){ | ||
for(var i=0;i<spriteIds.length;i++){ | ||
var foundClick=false; | ||
for(var j=0;j<eventLog.length;j++){ | ||
if(eventLog[j].includes(i)){ | ||
foundClick=true; | ||
if(validationProps.clickedSprites.indexOf(i)==-1){ | ||
validationProps.clickedSprites.push(i); | ||
} | ||
} | ||
} | ||
if(!foundClick){ | ||
drawRings(getProp({id: i}, "x"),400-getProp({id: i}, "y")); | ||
drawHand(getProp({id: i}, "x"),400-getProp({id: i}, "y")); | ||
} | ||
} | ||
} | ||
|
||
// Set success time if success | ||
if(validationProps.clickedSprites.length>=2 && !validationProps.successTime) | ||
{ | ||
validationProps.successTime = World.frameCount; | ||
} | ||
|
||
// Delay fail time (so student can observe the wrong animation) | ||
var failTime = 300; | ||
|
||
// Check criteria and give failure feedback | ||
if (World.frameCount > failTime) { | ||
levelFailure(3, "clickAnySprite"); | ||
} | ||
|
||
// Pass 5 seconds after success | ||
var waitTime = 150; | ||
if (World.frameCount - validationProps.successTime >= waitTime) { | ||
levelFailure(0, "genericSuccess"); | ||
} | ||
|
||
push(); | ||
stroke("white"); | ||
if (!validationProps.successTime) { | ||
drawProgress("fail",World.frameCount,failTime); | ||
} else { | ||
drawProgress("pass",World.frameCount - validationProps.successTime,waitTime); | ||
} | ||
pop(); | ||
} |
76 changes: 76 additions & 0 deletions
76
dashboard/config/libraries/zValidationHelperFunctions.interpreted.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
//Helper Functions | ||
function drawProgress(state,currentTime,endTime){ | ||
if(state=="fail"){ | ||
fill(rgb(118,102,160)); | ||
} else if (state=="pass"){ | ||
fill(rgb(0,173,188)); | ||
} else if (state=="challenge"){ | ||
fill(rgb(0,World.frameCount*10%255,0)); | ||
} | ||
rect(0,390,currentTime*400/endTime); | ||
} | ||
function drawRings(x,y){ | ||
push(); | ||
stroke("rgba(0,0,0,0.5)"); | ||
noFill(); | ||
strokeWeight(3); | ||
ellipse(x,y,Math.cos(World.frameCount/10)*30,Math.cos(World.frameCount/10)*30); | ||
stroke("rgba(255,255,255,0.5)"); | ||
noFill(); | ||
strokeWeight(3); | ||
ellipse(x,y,Math.sin(World.frameCount/10)*30,Math.sin(World.frameCount/10)*30); | ||
pop(); | ||
} | ||
function drawHand(x, y) { | ||
y+=5; | ||
push(); | ||
var gray1=Math.cos(World.frameCount/10)*30; | ||
var gray2=Math.sin(World.frameCount/10)*30+225; | ||
//background(color); | ||
noStroke(); | ||
fill(rgb(224, 224, 224)); | ||
//palm | ||
shape(x-5.5,y+12,x+35.5,y+20,x+35.5,y+37,x-5.5,y+37); | ||
//index finger | ||
rect(x-5.5,y-5,10,30); | ||
ellipse(x,y-5,10); | ||
//middle | ||
ellipse(x+10,y+15,10); | ||
//ring | ||
ellipse(x+20,y+17.5,10); | ||
//pinky | ||
ellipse(x+30,y+20,10); | ||
//wrist | ||
ellipse(x,y+37,10); | ||
ellipse(x+30,y+37,10); | ||
rect(x,y+32,30,15); | ||
//thumb | ||
shape(x-5.5,y+37,x-20.5,y+22,x-13.5,y+15,x-5.5,y+25); | ||
ellipse(x-17,y+18.5,10); | ||
stroke(rgb(96, 96, 96)); | ||
strokeWeight(3); | ||
noFill(); | ||
//palm | ||
line(x-5.5,y-5,x-5.5,y+25); | ||
line(x+35,y+20,x+35,y+37); | ||
//index finger | ||
line(x+4.5,y-5,x+4.5,y+15); | ||
arc(x,y-5,10,10,180,0); | ||
//middle | ||
arc(x+10,y+15,10,10,180,0); | ||
//ring | ||
arc(x+20,y+17.5,10,10,180,0); | ||
//pinky | ||
arc(x+30,y+20,10,10,180,0); | ||
//wrist | ||
arc(x,y+37,10,10,90,180); | ||
arc(x+30,y+37,10,10,0,90); | ||
line(x,y+42,x,y+47); | ||
line(x+30,y+42,x+30,y+47); | ||
line(x,y+47,x+30,y+47); | ||
//thumb | ||
line(x-5.5,y+37,x-20.5,y+22); | ||
line(x-13.5,y+15,x-5.5,y+25); | ||
arc(x-17,y+18.5,10,10,135,315); | ||
pop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name 'CSA U5L8-L3' | ||
title 'Check for Understanding' | ||
description 'Match each term to its correct definition.' | ||
height 'auto' | ||
question 'immutable' | ||
answer 'the content cannot be changed once it is created' | ||
question 'ArrayOutOfBoundsException' | ||
answer 'an index value that is either negative or greater than or equal to the length of the array' | ||
question 'for loop' | ||
answer 'a loop that has a predetermined beginning, end, and increment or decrement' | ||
question 'loop control variable' | ||
answer 'a variable declared and used within a loop to count iterations through the loop.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name 'CSA U5L8-L6' | ||
title 'Check for Understanding' | ||
|
||
markdown <<MARKDOWN | ||
Consider the following method, `shift`, which is intended to shift the elements of `arr` one to the left. For example, if `arr` contains `{{1, 2, 3}, {4, 5, 6}}`, then `shift(arr)` should return `{{2, 3, 1}, {5, 6, 4}}`. | ||
|
||
``` | ||
public static int[][] shift(int[][] arr) { | ||
int[][] ret = new int[arr.length][arr[0].length]; | ||
|
||
for (int i = 0; i < arr.length; i++) { | ||
for (int j = 0; j < arr[0].length - 1; j++) { | ||
/* missing statement */ | ||
} | ||
ret[i][arr[0].length - 1] = arr[i][0]; | ||
} | ||
|
||
return ret; | ||
} | ||
``` | ||
|
||
What choice could replace `/* missing statement */` so that `shift` works as intended? | ||
MARKDOWN | ||
|
||
wrong 'ret[i][j] = arr[i][j - 1];' | ||
right 'ret[i][j] = arr[i][j + 1];' | ||
wrong 'arr[i][j] = ret[i][j - 1];' | ||
wrong 'arr[i][j] = ret[i][j + 1];' | ||
wrong 'arr[i][j] = ret[i][j];' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name 'CSA U5L9-L3' | ||
title 'Check for Understanding' | ||
description 'Match each term with its correct definition.' | ||
height 'auto' | ||
question 'De Morgan\'s Laws' | ||
answer 'a set of rules that describe how to simplify complex Boolean expressions' | ||
question 'polymorphism' | ||
answer 'the ability to perform an action in different ways' | ||
question 'enhanced for loop variable' | ||
answer 'a variable declared and used within an enhanced for loop to store a copy of the element being visited. ' | ||
question 'logical operator' | ||
answer 'an operator that returns a Boolean value' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Javalab> | ||
<config><![CDATA[{ | ||
"properties": { | ||
"encrypted": "false", | ||
"encrypted_examples": [ | ||
|
||
], | ||
"mini_rubric": "false", | ||
"submittable": "false", | ||
"hide_share_and_remix": "false", | ||
"csa_view_mode": "theater" | ||
}, | ||
"game_id": 68, | ||
"published": true, | ||
"created_at": "2021-09-28T19:43:57.000Z", | ||
"level_num": "custom", | ||
"user_id": 9271, | ||
"audit_log": "[{\"changed_at\":\"2021-09-28 19:44:09 +0000\",\"changed\":[\"encrypted_examples\"],\"changed_by_id\":9271,\"changed_by_email\":\"jamila@code.org\"}]" | ||
}]]></config> | ||
</Javalab> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Javalab> | ||
<config><![CDATA[{ | ||
"properties": { | ||
"encrypted": "false", | ||
"encrypted_examples": [ | ||
|
||
], | ||
"project_template_level_name": "CSA U5L8 Template", | ||
"long_instructions": "create shiftedimage class", | ||
"mini_rubric": "false", | ||
"submittable": "false", | ||
"hide_share_and_remix": "false", | ||
"csa_view_mode": "theater" | ||
}, | ||
"game_id": 68, | ||
"published": true, | ||
"created_at": "2021-09-28T19:44:41.000Z", | ||
"level_num": "custom", | ||
"user_id": 9271, | ||
"audit_log": "[{\"changed_at\":\"2021-09-28 19:44:44 +0000\",\"changed\":[\"encrypted_examples\"],\"changed_by_id\":9271,\"changed_by_email\":\"jamila@code.org\"}]" | ||
}]]></config> | ||
</Javalab> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Javalab> | ||
<config><![CDATA[{ | ||
"properties": { | ||
"encrypted": "false", | ||
"encrypted_examples": [ | ||
|
||
], | ||
"project_template_level_name": "CSA U5L8 Template", | ||
"long_instructions": "test shiftedimage class", | ||
"mini_rubric": "false", | ||
"submittable": "false", | ||
"hide_share_and_remix": "false", | ||
"csa_view_mode": "theater" | ||
}, | ||
"game_id": 68, | ||
"published": true, | ||
"created_at": "2021-09-28T19:45:03.000Z", | ||
"level_num": "custom", | ||
"user_id": 9271, | ||
"audit_log": "[{\"changed_at\":\"2021-09-28 19:45:06 +0000\",\"changed\":[\"encrypted_examples\"],\"changed_by_id\":9271,\"changed_by_email\":\"jamila@code.org\"}]" | ||
}]]></config> | ||
</Javalab> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Javalab> | ||
<config><![CDATA[{ | ||
"properties": { | ||
"encrypted": "false", | ||
"encrypted_examples": [ | ||
|
||
], | ||
"project_template_level_name": "CSA U5L8 Template", | ||
"long_instructions": "animate shift", | ||
"mini_rubric": "false", | ||
"submittable": "false", | ||
"hide_share_and_remix": "false", | ||
"csa_view_mode": "theater" | ||
}, | ||
"game_id": 68, | ||
"published": true, | ||
"created_at": "2021-09-28T19:46:55.000Z", | ||
"level_num": "custom", | ||
"user_id": 9271, | ||
"audit_log": "[{\"changed_at\":\"2021-09-28 19:46:58 +0000\",\"changed\":[\"encrypted_examples\"],\"changed_by_id\":9271,\"changed_by_email\":\"jamila@code.org\"}]" | ||
}]]></config> | ||
</Javalab> |
Oops, something went wrong.