openct-tasks/algorea/algorea_training/training-repeat-marble/task.js

81 lines
2.6 KiB
JavaScript

function initTask(subTask) {
var cellSide = 60;
subTask.gridInfos = {
hideSaveOrLoad: true,
cellSide: cellSide,
actionDelay: 200,
itemTypes: {
green_robot: { img: "green_robot.png", side: 80, nbStates: 9, isObstacle: true, offsetX: -14, category: "robot", team: 0, zOrder: 2 },
hole: { num: 2, img: "hole.png", side: cellSide, category: "hole", isObstacle: false, isHole: true, zOrder: 0 },
marble: { num: 3, img: "marble.png", side: cellSide, category: "marble", isObstacle: false, isTransportable: true, zOrder: 1 }
},
maxInstructions: 12,
includeBlocks: {
groupByCategory: false,
generatedBlocks: {
robot: ["east", "west", "north", "south", "pickTransportable", "dropTransportable"]
},
standardBlocks: {
includeAll: false,
wholeCategories: [],
singleBlocks: ["controls_repeat"]
}
},
ignoreInvalidMoves: false,
checkEndEveryTurn: false,
checkEndCondition: robotEndConditions.checkMarblesInHoles
};
subTask.data = {
easy: [
{
tiles: [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
],
initItems: [
{ row: 1, col: 1, dir: 0, type: "green_robot" }
]
}
],
medium: [
{
tiles: [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
],
initItems: [
{ row: 1, col: 7, dir: 0, type: "green_robot" }
]
}
],
hard: [
{
tiles: [
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 3, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 2, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1]
],
initItems: [
{ row: 7, col: 0, dir: 0, type: "green_robot" }
]
}
]
};
initBlocklySubTask(subTask);
displayHelper.thresholdEasy = 5000;
displayHelper.thresholdMedium = 10000;
}
initWrapper(initTask, ["easy", "medium", "hard"], null, true);