diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.js new file mode 100644 index 0000000000000..4bd2add2effe4 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.js @@ -0,0 +1,4 @@ +function addEightBlock() { + input = input + 8; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.json new file mode 100644 index 0000000000000..f2d3350c7907d --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addEightBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addEightBlock", + "blockText": "addEight", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.js new file mode 100644 index 0000000000000..273f97744d88f --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.js @@ -0,0 +1,4 @@ +function addFiveBlock() { + input = input + 5; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.json new file mode 100644 index 0000000000000..b60c0d8e303c8 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFiveBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addFiveBlock", + "blockText": "addFive", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.js new file mode 100644 index 0000000000000..fc9b069cadd9d --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.js @@ -0,0 +1,4 @@ +function addFourBlock() { + input = input + 4; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.json new file mode 100644 index 0000000000000..d7bcb15d58bd8 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addFourBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addFourBlock", + "blockText": "addFour", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.js new file mode 100644 index 0000000000000..9446db1331f99 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.js @@ -0,0 +1,4 @@ +function addNineBlock() { + input = input + 9; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.json new file mode 100644 index 0000000000000..269932a46a56e --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addNineBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addNineBlock", + "blockText": "addNine", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.js new file mode 100644 index 0000000000000..c225c5c7c2cdc --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.js @@ -0,0 +1,4 @@ +function addOneBlock() { + input = input + 1; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.json new file mode 100644 index 0000000000000..192b9f1824b3c --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addOneBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addOneBlock", + "blockText": "addOne", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.js new file mode 100644 index 0000000000000..eea290a71bae6 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.js @@ -0,0 +1,4 @@ +function addSevenBlock() { + input = input + 7; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.json new file mode 100644 index 0000000000000..2fcc51da0cba4 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSevenBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addSevenBlock", + "blockText": "addSeven", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.js new file mode 100644 index 0000000000000..d3aafd0210aa1 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.js @@ -0,0 +1,4 @@ +function addSixBlock() { + input = input + 6; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.json new file mode 100644 index 0000000000000..ef883bcabed95 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addSixBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addSixBlock", + "blockText": "addSix", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.js new file mode 100644 index 0000000000000..97439d9b7c071 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.js @@ -0,0 +1,4 @@ +function addThreeBlock() { + input = input + 3; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.json new file mode 100644 index 0000000000000..d1480a0844ea4 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addThreeBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addThreeBlock", + "blockText": "addThree", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.js new file mode 100644 index 0000000000000..bb875569cb6b7 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.js @@ -0,0 +1,4 @@ +function addTwoBlock() { + input = input + 2; + output = input; +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.json b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.json new file mode 100644 index 0000000000000..4a66827c32193 --- /dev/null +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_addTwoBlock.json @@ -0,0 +1,16 @@ +{ + "category": "Experimental", + "config": { + "color": [ + 120, + 0.6, + 0.6 + ], + "func": "addTwoBlock", + "blockText": "addTwo", + "args": [ + + ], + "eventBlock": false + } +} \ No newline at end of file diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative.js index db30a9414d605..38e237d28d7bf 100644 --- a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative.js +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative.js @@ -8,18 +8,30 @@ function representManipulative(var1, s1costume, behavior) { //For ideal behavior: original sprites should be 40x40 //to create 10x10 grid for students + //destroy(({costume: s1costume})); + var spriteIds = getSpriteIdsInUse(); + for(var i = 0; i < spriteIds.length; i++) { + var val = getProp(({id: spriteIds[i]}), "isManipulative"); + if(val == 47) { + destroy(({id: spriteIds[i]})); + } + } + + var x = 20; var y = 400-20; for (counter_i = 0; counter_i < var1; counter_i++) { - createNewSprite({name: "manipulative" + counter_i}, s1costume, {"x": x, "y": y}); + var spriteId = createNewSprite({name: "manipulative" + counter_i}, s1costume, {"x": x, "y": y}); + setProp(({id: spriteId}), "isManipulative", 47); //makeNewSpriteAnon(s1costume, {"x": x, "y": y}); + console.log(); x += 40; if(x >= 400) { x = 20; y += 40; } + addBehaviorSimple(({id: spriteId}), new Behavior(northAndStop, [])); } - addBehaviorSimple(({costume: s1costume}), new Behavior(northAndStop, [])); } function northAndStop(this_sprite) { diff --git a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative_test.js b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative_test.js index f9004a50cda12..1f94168507c75 100644 --- a/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative_test.js +++ b/dashboard/config/blocks/FunctionBlocks/FunctionBlocks_representManipulative_test.js @@ -8,18 +8,30 @@ function representManipulative_test(var1, s1costume, behavior) { //For ideal behavior: original sprites should be 40x40 //to create 10x10 grid for students + //destroy(({costume: s1costume})); + var spriteIds = getSpriteIdsInUse(); + for(var i = 0; i < spriteIds.length; i++) { + var val = getProp(({id: spriteIds[i]}), "isManipulative"); + if(val == 47) { + destroy(({id: spriteIds[i]})); + } + } + + var x = 20; var y = 400-20; for (counter_i = 0; counter_i < var1; counter_i++) { - createNewSprite({name: "manipulative" + counter_i}, s1costume, {"x": x, "y": y}); + var spriteId = createNewSprite({name: "manipulative" + counter_i}, s1costume, {"x": x, "y": y}); + setProp(({id: spriteId}), "isManipulative", 47); //makeNewSpriteAnon(s1costume, {"x": x, "y": y}); + console.log(); x += 40; if(x >= 400) { x = 20; y += 40; } + addBehaviorSimple(({id: spriteId}), new Behavior(northAndStop, [])); } - addBehaviorSimple(({costume: s1costume}), new Behavior(northAndStop, [])); } function northAndStop(this_sprite) { diff --git a/dashboard/config/libraries/zLandmarksModule-CSC.interpreted.js b/dashboard/config/libraries/zLandmarksModule-CSC.interpreted.js index dab4604948cdd..b19ab63e257e3 100644 --- a/dashboard/config/libraries/zLandmarksModule-CSC.interpreted.js +++ b/dashboard/config/libraries/zLandmarksModule-CSC.interpreted.js @@ -461,464 +461,4 @@ function libraryREADME() { console.log("This library also includes validation helper objects that can be used when writing custom block functions"); console.log("-- validationProps.landmarksValidation is an object for any particles module specific helpers"); console.log("-- validationProps.landmarksValidation.events is an array for any particles module specific events"); -} - - -/**************************************************** -SNOWBALLING VALIDATION FUNCTIONS -Used for lessons that build a project across multiple levels and we want -to continue validating criteria from previous levels -****************************************************/ - -function level1Validation(validateBackground) { - if(validateBackground) { - addCriteria(function() { - if(checkSetBackground()) { - //If you made it here: we passed the criteria - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("You need to set a background"); - } - return false; - }, "setBackground"); // include i18n feedback string - } -} - -function level2Validation(validateNewSprite, validateNewLocation, validateNewSize) { - if(validateNewSprite) { - //Checks whether a sprite has been created - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - - if(spriteIds.length >= 1) { - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Create a new sprite!"); - } - return false; - }, "createNewSprite"); // include i18n feedback string - } - - if(validateNewLocation) { - //checks if the sprite was moved from the default (200, 200) location - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - - if(spriteIds.length >= 1) { - if(checkMovedSpritePin(spriteIds[0])) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move the sprite!"); - } - return false; - }, "moveSpriteLocation"); // include i18n feedback string - } - - if(validateNewSize) { - //check for new size property - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - - if(spriteIds.length >= 1) { - var sprite = {id: spriteIds[0]}; - var spriteScale = getProp(sprite, "scale"); - if(spriteScale != 100) { - //If you made it here: we passed the criteria - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite size!"); - } - return false; - }, "spriteSize"); // include i18n feedback string - } -} - -function level3Validation(validateSpriteSay) { - if(validateSpriteSay) { - //Checks if the first sprite says something - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - if(spriteIds.length >= 1) { - var spriteId = spriteIds[0]; - var speech = getSpeechForSpriteId(spriteId); - if(speech != null) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Make the sprite speak!"); - } - return false; - }, "saySomething"); // include i18n feedback string - } -} - -//check for 2 sprites -//check not default costume -//check for a new location -//check for a new size property -function level4Validation(validate2Sprites, validate2ndCostume, validate2ndLocation, validate2ndSize, validateMovingBehavior) { - if(validate2Sprites) { - //Checks whether 2 sprites exist - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - - if(spriteIds.length >= 2) { - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Create 2 sprites!"); - } - return false; - }, "create2Sprites"); // include i18n feedback string - } - - if(validate2ndCostume) { - //Checks whether the 2nd sprite isn't wearing the default costume - addCriteria(function() { - if(spriteIds.length >= 2) { - var secondSprite = {id: spriteIds[1]}; - var secondCostume = getProp(secondSprite, "costume"); - if(secondCostume != "red_shirt_wave2") { - //This is only true while red_shirt_wave2 is the default costume for this level - //If that ever changes, will need to update this if statement - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite to a landmark!"); - } - return false; - }, "changeToLandmark"); // include i18n feedback string - } - - if(validate2ndLocation) { - //check that the 2nd sprite moved from the default (200, 200) location - addCriteria(function() { - if(spriteIds.length >= 2) { - if(checkMovedSpritePin(spriteIds[1])) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move the sprite!"); - } - return false; - }, "moveSpriteLocation"); // include i18n feedback string - } - - if(validate2ndSize) { - //checks that 2nd sprite changed sizes - addCriteria(function() { - if(spriteIds.length >= 2) { - var secondSprite = {id: spriteIds[1]}; - var secondScale = getProp(secondSprite, "scale"); - if(secondScale != 100) { - //If you made it here: we passed the criteria - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite size!"); - } - return false; - }, "spriteSize"); // include i18n feedback string - } - - if(validateMovingBehavior) { - addCriteria(function() { - if(interactiveBehaviorFound()) { - //If you made it here: we passed the criteria - return true; - } - //If you made it here: we failed the criteria - console.log("Make sure to add a behavior!"); - return false; - }, "addBehavior"); // include i18n feedback string - } -} - -//check for new touching event -//check that the sprite says something different from before -function level5Validation(validateNewTouchingEvent, validateNewSpriteSay) { - if(validateNewTouchingEvent) { - //checks for a touch event - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1) { - //If you made it here: we passed the criteria - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move your character so they touch the landmark!"); - } - return false; - }, "noTouchEvent"); // include i18n feedback string - } - if(validateNewSpriteSay) { - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1) { - var speechBubble = getSpeechForSpriteId(sprites[0]); - if(speechBubble != null && speechBubble != validationProps.previous.speeches[sprites[0]]) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Make sure the sprite says something about the landmark!"); - } - - //Use this to keep a record of previous speech bubbles from sprites to make sure the sprite changed what they said when touching the landmark - if(spriteIds.length >= 1 && World.frameCount > 1) { - validationProps.previous.speeches = {}; - for(var i = 0; i < spriteIds.length; i++) { - validationProps.previous.speeches[spriteIds[i]] = getSpeechForSpriteId(spriteIds[i]); - } - } - return false; - }, "spriteSaySomething"); // include i18n feedback string - } -} - -//check that there are 3 sprites -//check for a new costume -//check for a new location -//check for a new size -function level6Validation(validate3Sprites, validateThirdCostume, validateThirdLocation, validateThirdSize) { - if(validate3Sprites) { - //Checks whether 3 sprites exist - addCriteria(function() { - //You can reference global variables from helper library (use the README to remind what those are) - - if(spriteIds.length >= 3) { - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Create 3 sprites!"); - } - return false; - }, "create3Sprites"); // include i18n feedback string - } - if(validateThirdCostume) { - //Checks whether the 3rd sprite isn't wearing the default costume - addCriteria(function() { - if(spriteIds.length >= 3) { - var thirdSprite = {id: spriteIds[2]}; - var thirdCostume = getProp(thirdSprite, "costume"); - if(thirdCostume != "red_shirt_wave2") { - //This is only true while red_shirt_wave2 is the default costume for this level - //If that ever changes, will need to update this if statement - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite to a landmark!"); - } - return false; - }, "changeToLandmark"); // include i18n feedback string - } - if(validateThirdLocation) { - //check that the 3rd sprite moved from the default (200, 200) location - addCriteria(function() { - if(spriteIds.length >= 3) { - if(checkMovedSpritePin(spriteIds[2])) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move the sprite!"); - } - return false; - }, "moveSpriteLocation"); // include i18n feedback string - } - if(validateThirdSize) { - //checks that 3rd sprite changed sizes - addCriteria(function() { - if(spriteIds.length >= 3) { - var thirdSprite = {id: spriteIds[2]}; - var thirdScale = getProp(thirdSprite, "scale"); - if(thirdScale != 100) { - //If you made it here: we passed the criteria - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite size!"); - } - return false; - }, "spriteSize"); // include i18n feedback string - } -} - -//check that the sprite we touch is the 3rd sprite we added -//Check that the sprite actually spoke this frame, rather than continuing a previous speech bubble -//*This level relies on the same validation as level 5, so only 2 new validation property to check* -function level7Validation(validateTouchesThirdSprite, validateSpeechThisFrame) { - if(validateTouchesThirdSprite) { - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1 && spriteIds.length >= 3) { - //check if the sprite that was touched is the same as 3rd sprite - if(sprites[1] == spriteIds[spriteIds[2]]) - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move your character so they touch the most recent landmark!"); - } - return false; - }, "touchingWrongLandmark"); // include i18n feedback string - } - if(validateSpeechThisFrame) { - //Check that the sprite actually spoke this frame, rather than continuing a previous speech bubble - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1 && spriteIds.length >= 3) { - //check if the sprite that was touched is the same as 3rd sprite - if(sprites[1] == spriteIds[spriteIds[2]]) { - if(strictSpriteSpeechRenderedThisFrame(sprites[0])) { - return true; - } - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move your character so they touch the most recent landmark!"); - } - return false; - }, "touchingWrongLandmark"); // include i18n feedback string - } -} - -//check that there are 4 sprites -//check for a new costume -//check for a new location -//check for a new size -function level8Validation(validate4Sprites, validateFourthCostume, validateFourthLocation, validateFourthSize) { - if(validate4Sprites) { - //Checks whether 4 sprites exist - addCriteria(function() { - if(spriteIds.length >= 4) { - return true; - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Create 4 sprites!"); - } - return false; - }, "create4Sprites"); // include i18n feedback string - } - if(validateFourthCostume) { - //Checks whether the 4th sprite isn't wearing the default costume - addCriteria(function() { - if(spriteIds.length >= 4) { - var sprite = {id: spriteIds[3]}; - var spriteCostume = getProp(sprite, "costume"); - if(spriteCostume != "red_shirt_wave2") { - //This is only true while red_shirt_wave2 is the default costume for this level - //If that ever changes, will need to update this if statement - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite to a landmark!"); - } - return false; - }, "changeToLandmark"); // include i18n feedback string - } - if(validateFourthLocation) { - //check that the 4th sprite moved from the default (200, 200) location - addCriteria(function() { - if(spriteIds.length >= 4) { - if(checkMovedSpritePin(spriteIds[3])) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move the sprite!"); - } - return false; - }, "moveSpriteLocation"); // include i18n feedback string - } - if(validateFourthSize) { - //checks that 4th sprite changed sizes - addCriteria(function() { - if(spriteIds.length >= 4) { - var sprite = {id: spriteIds[3]}; - var spriteScale = getProp(sprite, "scale"); - if(spriteScale != 100) { - //If you made it here: we passed the criteria - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Change the sprite size!"); - } - return false; - }, "spriteSize"); // include i18n feedback string - } -} - -//check that the sprite touches the 4th sprite we added -//*This level relies on the same validation as level 5, so only 1 new validation property to check* -function level9Validation(validateTouchesFourthSprite, validateSpeechThisFrame) { - if(validateTouchesFourthSprite) { - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1 && spriteIds.length >= 4) { - //check if the sprite that was touched is the 4th sprite - if(sprites[1] == spriteIds[3]) { - return true; - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move your character so they touch the most recent landmark!"); - } - return false; - }, "touchingWrongLandmark"); // include i18n feedback string - } - if(validateSpeechThisFrame) { - //Check that the sprite actually spoke this frame, rather than continuing a previous speech bubble - addCriteria(function() { - var sprites = getSpritesThatTouched(); - if(sprites != -1 && spriteIds.length >= 4) { - //check if the sprite that was touched is the 4th sprite - if(sprites[1] == spriteIds[3]) { - if(strictSpriteSpeechRenderedThisFrame(sprites[0])) { - return true; - } - } - } - //If you made it here: we failed the criteria - if(DEBUG) { - console.log("Move your character so they touch the most recent landmark!"); - } - return false; - }, "touchingWrongLandmark"); // include i18n feedback string - } } \ No newline at end of file diff --git a/dashboard/config/libraries/zStorybookModule-CSC.interpreted.js b/dashboard/config/libraries/zStorybookModule-CSC.interpreted.js index 644101a9023fb..d9597b42be364 100644 --- a/dashboard/config/libraries/zStorybookModule-CSC.interpreted.js +++ b/dashboard/config/libraries/zStorybookModule-CSC.interpreted.js @@ -18,8 +18,9 @@ var eventLog; var soundLog; var eventSpriteIds; var spriteBehaviorsObj; +var promptVars; -var DEBUG = false; +var DEBUG = true; //Helper function //This function is designed to be used in conjunction with code added to the level template (ie: if(DEBUG) { console.log() }); @@ -50,6 +51,7 @@ function getHelperVars() { printLog = getPrintLog(); soundLog = getSoundLog(); eventSpriteIds = getEventSpriteIds(); + promptVars = getPromptVars(); spriteBehaviorsObj = {}; for(var i = 0; i < spriteIds.length; i++) { @@ -62,7 +64,9 @@ function getHelperVars() { function setupPrevious() { if (!validationProps.previous) { validationProps.previous = {}; + validationProps.previous.background = ""; validationProps.previous.spriteIds = []; + validationProps.previous.promptVars = {}; validationProps.previous.animations = []; validationProps.previous.eventLog = []; validationProps.previous.printLog = []; @@ -84,7 +88,9 @@ function checkForPreviousObject() { //Update previous object. //Designed to be called at the very end of level validation function updatePrevious() { + validationProps.previous.background = getBackground(); validationProps.previous.spriteIds = spriteIds; + validationProps.previous.promptVars = promptVars; validationProps.previous.animations = animations; validationProps.previous.eventLog = eventLog; validationProps.previous.printLog = printLog; @@ -165,6 +171,8 @@ function drawHand(x, y){ //Call this to draw hands on all unclicked sprites. //Designed to be called after the world.frameCount if statement so it happens each tick of the draw loop +//Dan Note: this doesn't actually check for CLICK events - technically this works for any type of event +//And: doesn't actually use clickedSprites - do I need it? function drawHandsOnUnclickedSprites(){ if(World.seconds < 1){ return; @@ -217,6 +225,25 @@ function checkNumClickedSprites(n) { return false; } +//Returns true if n unique sprites have been touched over the course of the level +function checkNumTouchedSprites(n) { + if(!validationProps.touchedSprites) { + validationProps.touchedSprites = []; + } + + var sprites = getSpritesThatTouched(); + if (sprites != -1){ + var newTouchedSprite = sprites[1]; + if (validationProps.touchedSprites.indexOf(newTouchedSprite) == -1) { + validationProps.touchedSprites.push(newTouchedSprite); + } + } + if(validationProps.touchedSprites.length >= n) { + return true; + } + return false; +} + //Returns true if there is a new event this frame. //Used as a helper in other functions. function checkNewEventThisFrame() { @@ -245,6 +272,182 @@ function checkSpriteClickedThisFrame(){ return false; } +//Returns true if a sprite was touched this frame. +function checkSpriteTouchedThisFrame(){ + if(!validationProps.previous) { + console.log("Need to call setupPrevious() to use checkSpriteClickedThisFrame() helper function"); + return false; + } + if (checkNewEventThisFrame()) { + //If we're here: a new event happened this frame. + var currentEvent = eventLog[eventLog.length - 1]; + var clickedSpriteId = parseInt(currentEvent.split(" ")[1]); + if (currentEvent.includes("Touch")) { + return true; + } + } + return false; +} + +//Checks if a particular sprite was touched during an event this frame +function checkThisSpriteTouchedThisFrame(spriteId) { + if(checkSpriteTouchedThisFrame()) { + var sprites = getSpritesThatTouched(); + //Check that the sprite we touched (sprites[1]) is the 3rd sprite (spriteIds[2]) + if(sprites[1] == spriteId) { + return true; + } + } + return false; +} + +function checkThisSpriteClickedThisFrame(spriteId) { + var clickedSprite = getClickedSpriteId(); + if(clickedSprite != -1) { + return clickedSprite == spriteId; + } + return false; +} + +//Checks if the background was set to something +//Designed to be implemented in levels without any background block, so setting background for first time +function checkSetBackground(){ + var background = getBackground(); + return background !== undefined && background !== "#ffffff"; +} + +//Checks if the background changed from the previous version +function checkNewBackground() { + return getBackground() != validationProps.previous.background; +} + +//Checks if a particular sprite was moved from the default (200, 200) location in a level +function checkMovedSpritePin(spriteId) { + var sprite = {id: spriteId}; + var spriteX = getProp(sprite, "x"); + var spriteY = getProp(sprite, "y"); + if(spriteX != 200 || spriteY != 200) { + return true; + } +} + +//Checks if n unique touch events have happened +//For example: in levels where the sprite needs to visit 2 things, use checkUniqueTouchEvents(2) to validate that level +//Passing in delayTime will also delay the fail time after each unique event (to give time to visit new sprites) +function checkUniqueTouchEvents(n, delayTime) { + //Create a global variable that will persist through frames of the draw loop + if(!validationProps.uniqueTouchEvents) { + validationProps.uniqueTouchEvents = []; + } + //See if any sprites touched this frame + var sprites = getSpritesThatTouched(); + //If we found some sprites that touched: + if(sprites != -1) { + //sprites is an array of [source sprite, destination sprite] + //See if we haven't already touched this destination sprite + if(!member(sprites[1], validationProps.uniqueTouchEvents)) { + //If we made it here: we've touched a unique sprite, so add it to our global list + validationProps.uniqueTouchEvents.push(sprites[1]); + if(delayTime) { + //Add more time to the timer when there's a unique event + var currentFrame = World.frameCount; + setFailTime(currentFrame + delayTime); + } + } + } + //If our list of unique events is n, then we touched all n people + if(validationProps.uniqueTouchEvents.length == n) { + return true; + } + return false; +} + +//Checks if the sprite's size has been changed from the default +function checkNotDefaultSize(spriteId) { + var sprite = {id: spriteId}; + var spriteScale = getProp(sprite, "scale"); + if(spriteScale != 100) { + return true; + } else { + return false; + } +} + +//Checks if the sprite has been changed from the default costume +//Requires the default costume from that level +function checkNotDefaultCostume(spriteId, defaultCostume) { + var sprite = {id: spriteId}; + var spriteCostume = getProp(sprite, "costume"); + if(spriteCostume != defaultCostume) { + return true; + } else { + return false; + } +} + +//Checks if the sprite is currently speaking +//Designed to be used when a sprite is speaking when the program is run, _not_ during an event +function checkSpriteSpeech(spriteId) { + var speech = getSpeechForSpriteId(spriteId); + if(speech != null) { + return true; + } else { + return false; + } +} + +//Checks that there are at least n things printed +function checkAtLeastNPrints(n) { + return printLog.length >= n; +} + +//Checks that there's at least N prompt in the workspace, as evidenced by a promptVars object with N keys +function checkAtLeastNPrompts(n) { + var promptVars = getPromptVars(); + if (promptVars == {}) { + return false; + } + //Helper libraries use ES5, so need to use this stuff I think + var keys = Object.keys(promptVars); + return keys.length >= n; +} + +//Checks that at least N prompts have been answered in the workspace, as evidenced by a promptVars object with N keys that are not null +function checkAtLeastNPromptsAnswered(n) { + var promptVars = getPromptVars(); + if (promptVars == {}) { + return false; + } + //Helper libraries use ES5, so need to use this stuff I think + var keys = Object.keys(promptVars); + var nonNullKeys = 0; + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = promptVars[key]; + if(val != null) { + nonNullKeys++; + } + } + return nonNullKeys >= n; +} + +//Checks if at least n events have occured through the running of the animation +function checkAtLeastNEvents(n) { + return eventLog.length >= n; +} + +//Checks if a prompt appeared with an event +function checkPromptWithEvent() { + //if an event happened this frame: + if(eventLog.length > validationProps.previous.eventLog.length) { + var numCurrentPrompts = Object.keys(promptVars).length; + var numPrevPrompts = Object.keys(validationProps.previous.promptVars).length; + return(numCurrentPrompts > numPrevPrompts); + } + return false; +} + + /* GETTERS */ @@ -265,9 +468,25 @@ function getClickedSpriteId(){ return -1; } +//Returns an array of the spriteIDs that touched +//Can then use getProp({id: spriteIds[i]}, "{{property}}") to check other properties of sprites +function getSpritesThatTouched(){ + if(!validationProps.previous) { + console.log("Need to call setupPrevious() to use getSpritesThatTouched() helper function"); + return false; + } + if (checkNewEventThisFrame()) { + var currentEventArray = eventLog[eventLog.length - 1].split(" "); + if (currentEventArray[0].includes("whenTouch") || currentEventArray[0].includes("whileTouch")) { + return [currentEventArray[1], currentEventArray[2]]; + } + } + return -1; +} + function README() { - console.log("This is the README for the zStorybookModule-CSC Helper library"); + console.log("This is the README for the zLandmarksModule-CSC Helper library"); console.log("It includes the following global variables that can be used in validation: "); console.log("-- spriteIds - an array of the IDs of all sprites in use during this frame"); console.log("-- animations - an array of the animations in use during this frame"); @@ -287,20 +506,41 @@ function README() { console.log("It also includes the following criteria function designed to be used within addCritera()"); console.log("-- checkNumClickedSprites(n) - Returns true if n unique sprites have been clicked over the course of the level"); console.log("-- checkSpriteClickedThisFrame() - Returns true if a sprite was clicked this frame."); + console.log("-- checkBackgroundChanged() - Checks if the background was set to something"); + console.log("-- checkMovedSpritePin(spriteId) - Checks if a particular sprite was moved from the default (200, 200) location in a level"); console.log("-- getClickedSpriteId() - Returns the spriteId of a sprite clicked this frame, or -1 if not found"); + console.log("-- getSpritesThatTouched() - Returns an array of two spriteIds that touch that frame, or -1 if not found"); console.log(""); - particlesREADME(); + libraryREADME(); } /*************************************************** SPECIFIC HELPER CODE FOR VALIDATION (contains things specifically for this CSC module) ***************************************************/ -validationProps.storybookValidation = {}; -validationProps.storybookValidation.events = []; +if (typeof validationProps !== 'undefined') { + validationProps.storybookValidation = {}; + validationProps.storybookValidation.events = []; +} -function particlesREADME() { +function libraryREADME() { console.log("This library also includes validation helper objects that can be used when writing custom block functions"); console.log("-- validationProps.storybookValidation is an object for any particles module specific helpers"); console.log("-- validationProps.storybookValidation.events is an array for any particles module specific events"); -} \ No newline at end of file +} + +function checkHeadingNotBlank() { + return getHeading() != null; +} + +function checkSubheadingNotBlank() { + return getSubheading() != null; +} + +function checkHeadingSpecificString(str) { + return getHeading() == str; +} + +function checkSubheadingSpecificString(str) { + return getSubheading() == str; +} diff --git a/dashboard/config/locales/scripts.en.yml b/dashboard/config/locales/scripts.en.yml index ef58abf47daa2..1d0e6e868e903 100644 --- a/dashboard/config/locales/scripts.en.yml +++ b/dashboard/config/locales/scripts.en.yml @@ -9370,12 +9370,14 @@ en: name: Local Storytellers lesson-4: name: Local Landmarks - Unplugged + lesson-5: + name: Local Storytellers lesson_groups: {} name: csc-landmarks-pilot - title: '' + title: Mapping Landmarks (Fall 2022 Pilot) description_audience: '' description_short: '' - description: 'Winter 2022 Pilot module - Historical Landmark and Mapping Module ' + description: '' student_description: '' csc-playground: lessons: @@ -9460,6 +9462,8 @@ en: name: Where is it coming from? lesson-3: name: What Do They Want? + lesson-4: + name: The Secret Message lesson_groups: {} name: csc-function-machines-pilot title: Function Machines Pilot Module @@ -9728,7 +9732,7 @@ en: lessons: {} lesson_groups: {} name: csc-pilot-fa2022-timecapsule - title: '' + title: Time Capsules (Fall 2022 Pilot) description_audience: '' description_short: '' description: '' @@ -9737,7 +9741,7 @@ en: lessons: {} lesson_groups: {} name: csc-pilot-fa2022-ecosystem - title: '' + title: Ecosystems (Fall 2022 Pilot) description_audience: '' description_short: '' description: '' diff --git a/dashboard/config/scripts/cdc_particles_physical_intro2.external b/dashboard/config/scripts/cdc_particles_physical_intro2.external index 58b621f97de39..097b31238bb93 100644 --- a/dashboard/config/scripts/cdc_particles_physical_intro2.external +++ b/dashboard/config/scripts/cdc_particles_physical_intro2.external @@ -9,9 +9,9 @@ markdown < -**Wizzard:** Hello, scientists! Welcome to my magic show! Let me show you my vanishing trick... +**Wizard:** Hello, scientists! Welcome to my magic show! Let me show you my vanishing trick... -**Wizzard:** I have a few objects I am going to put into this box. What goes in will come out… different. Is it a magic box? What is happening inside the box? Lets find out! +**Wizard:** I have a few objects I am going to put into this box. What goes in will come out… different. Is it a magic box? What is happening inside the box? Lets find out! We put water in… Poof… The water vanished. diff --git a/dashboard/config/scripts/cdc_particles_physical_intro2_chem.external b/dashboard/config/scripts/cdc_particles_physical_intro2_chem.external new file mode 100644 index 0000000000000..0697a261cf6b8 --- /dev/null +++ b/dashboard/config/scripts/cdc_particles_physical_intro2_chem.external @@ -0,0 +1,48 @@ +name 'cdc_particles_physical_intro2_chem' +title 'Vanishing Act 1' +description 'description here' + +markdown < + + + +**Wizard:** Hello, scientists! Welcome to my magic show! Let me show you my vanishing trick... + +**Wizard:** I have a few objects I am going to put into this box. What goes in will come out… different. Is it a magic box? What is happening inside the box? Lets find out! + +We put water in… Poof… The water vanished. + + ![](https://images.code.org/9eae5ea6853b3016d62339cb4df9ec74-image-1667251998493.gif) +   + + + +   + +
+ +
+ +**Scientist:** The water did not disappear. Science can explain this. The matter changes state in the magic box. The water particles went in as a liquid and came out as a gas. + +  + + + +**Lets use a microscope to look closer..** +The liquid particles stay together in the glass. +When the particles are heated, they move everywhere and escape the glass as a gas. + + ![](https://images.code.org/db3f5d762030e51532af8681e14d8e48-image-1667252167332.png) + + + +MARKDOWN + +teacher_markdown <