How to use getGlobal method in Jest

Best JavaScript code snippet using jest

model.js

Source:model.js Github

copy

Full Screen

...72Breeds.add("CARS", "car");73Breeds.get("CARS").vars =[""];74function dataExportLogEvent(m, plist, unused1, unused2) {75 logCODAPAction(m + ' Per-run Settings and Data: {"fields": ["Challenge ()", "Step ()", "Start height (m)", "Friction ()", "Mass (g)", "End distance (m)"],"values": [%@, %@, %@, %@, %@, %@]}',76 [Globals.getGlobal(42), Globals.getGlobal(43), Globals.getGlobal(34), Globals.getGlobal(0), Globals.getGlobal(20), Prims.precision(Globals.getGlobal(68), 2)])77}78function dataExportClearLastRun() {79 clearCODAPData()80}81function dataExportUpdateRunSeries(series) {82 record(series)83}84function myUserMessage(msg) {85 window.alert(msg)86}87function myClearOutput() {88 var outputArea = document.getElementById('output');89 while(outputArea.childNodes.length > 0) {90 outputArea.removeChild(outputArea.childNodes[0]);91 }92}93function myUserYesOrNo_p(question) {94}95function startup() {96 world.clearAll();97 world.resetTicks();98 drawFirstPage();99 Globals.setGlobal(11, true);100 Globals.setGlobal(67, false);101 Globals.setGlobal(12, false);102 Globals.setGlobal(13, false);103 Globals.setGlobal(66, false);104}105var everyDtDate = Date.now()106function go() {107 if (Globals.getGlobal(11)) {108 AgentSet.ask(world.turtlesOfBreed("DRAWING-DOTS"), true, function() {109 AgentSet.die();110 });111 Globals.setGlobal(11, false);112 initialize();113 }114 if(Date.now() - everyDtDate > 1000 * Globals.getGlobal(30)) {115 everyDtDate = Date.now()116 if (Globals.getGlobal(12)) {117 runCar();118 }119 actOnChanges();120 supportMouse();121 world.tick();122 }123}124function actOnChanges() {125 if (Globals.getGlobal(27)) {126 noop(5);127 Globals.setGlobal(27, false);128 }129 if (!Prims.equality(Globals.getGlobal(0), Globals.getGlobal(50))) {130 if ((!Globals.getGlobal(48) && !Globals.getGlobal(12))) {131 Globals.setGlobal(50, Globals.getGlobal(0));132 }133 }134}135function drawFirstPage() {136 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {137 AgentSet.setTurtleVariable(10, 0.1);138 Prims.setXY((0.4 * world.minPxcor), (0.9 * world.maxPycor));139 AgentSet.setTurtleVariable(6, "Press the On/Off button to continue.");140 });141 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {142 AgentSet.setTurtleVariable(10, 0.1);143 Prims.setXY((0.5 * world.minPxcor), (0.85 * world.maxPycor));144 AgentSet.setTurtleVariable(6, " Leave it on all the time.");145 });146 AgentSet.ask(world.turtlesOfBreed("DRAWING-DOTS"), true, function() {147 AgentSet.setTurtleVariable(7, 15);148 });149}150function initialize() {151 Globals.setGlobal(30, 1 / calculationRefreshPerSecond);152 Globals.setGlobal(28, 9.81);153 Globals.setGlobal(13, false);154 Globals.setGlobal(67, true);155 Globals.setGlobal(12, false);156 Globals.setGlobal(15, false);157 Globals.setGlobal(27, false);158 Globals.setGlobal(39, 50);159 Globals.setGlobal(37, 1.34);160 Globals.setGlobal(38, 0.45);161 defineWindow();162 defineTransforms();163 Globals.setGlobal(72, true);164 Globals.setGlobal(17, (105 + 2));165 Globals.setGlobal(16, [[-1.6, 1.1], [0, 0], [0.5, 0], [1, 0], [1.5, 0], [2, 0], [2.5, 0], [3, 0], [3.5, 0], [4, 0], [5, 0]]);166 drawRamp();167 Globals.setGlobal(21, 12);168 Globals.setGlobal(35, -0.9);169 Globals.setGlobal(22, 22);170 AgentSet.ask(world.createTurtles(1, "CARS"), true, function() {171 AgentSet.self().hideTurtle(true);;172 if (Prims.equality(Globals.getGlobal(42), 4)) {173 Globals.setGlobal(20, 200);174 }175 else {176 Globals.setGlobal(20, 100);177 }178 AgentSet.setTurtleVariable(1, 15);179 AgentSet.setTurtleVariable(5, "car");180 AgentSet.setTurtleVariable(10, Globals.getGlobal(22));181 placeCar(Globals.getGlobal(35));182 });183 Globals.setGlobal(73, false);184 AgentSet.ask(world.createTurtles(1, "MARKERS"), true, function() {185 AgentSet.self().hideTurtle(true);;186 Globals.setGlobal(63, AgentSet.getTurtleVariable(0));187 AgentSet.setTurtleVariable(1, 15);188 AgentSet.setTurtleVariable(10, 0.1);189 AgentSet.setTurtleVariable(2, 0);190 });191 AgentSet.ask(world.createTurtles(1, "MARKERS"), true, function() {192 AgentSet.self().hideTurtle(true);;193 Globals.setGlobal(64, AgentSet.getTurtleVariable(0));194 AgentSet.setTurtleVariable(1, 15);195 AgentSet.setTurtleVariable(10, 0.1);196 AgentSet.setTurtleVariable(2, 0);197 AgentSet.ask(AgentSet.createLinkWith(world.getTurtleOfBreed("MARKERS", Globals.getGlobal(63))), true, function() {198 AgentSet.setLinkVariable(7, 3);199 AgentSet.setTurtleVariable(1, 15);200 });201 });202 AgentSet.ask(world.createTurtles(1, "MARKERS"), true, function() {203 AgentSet.self().hideTurtle(true);;204 Globals.setGlobal(65, AgentSet.getTurtleVariable(0));205 AgentSet.setTurtleVariable(1, 15);206 AgentSet.setTurtleVariable(10, 18);207 AgentSet.setTurtleVariable(2, 0);208 AgentSet.setTurtleVariable(5, "line");209 });210 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {211 Globals.setGlobal(76, AgentSet.getTurtleVariable(0));212 AgentSet.setTurtleVariable(10, 0.1);213 AgentSet.setTurtleVariable(1, 0);214 AgentSet.setTurtleVariable(7, 9.9);215 });216 Globals.setGlobal(36, true);217 Globals.setGlobal(2, 54);218 Globals.setGlobal(40, 0);219 Globals.setGlobal(41, 0);220 Globals.setGlobal(1, [0, 0, 0, 0, 0, 0]);221 Globals.setGlobal(77, [2.91, 1.04, 2.31, 0.52, 2.53, 3.81, 1.96, 2.77, 0.73, 1.53, 3.29, 1.25, 2.25, 0.83, 3.10, 1.75, 0.95, 2.43, 3.05, 0.85]);222 Globals.setGlobal(71, 0);223 Globals.setGlobal(42, 1);224 Globals.setGlobal(43, 1);225 Globals.setGlobal(70, Globals.getGlobal(42));226 Globals.setGlobal(69, Globals.getGlobal(43));227 Globals.setGlobal(62, 5);228 setupGame();229 showTarget();230 myClearOutput();231 prettyPrint("Challenge 1:\n");232 prettyPrint("Make the car stop in the middle of the red zone. Place the car on the ramp by clicking on it and dragging it.\n");233 prettyPrint("As you get better, the red target will get smaller.\n");234 setupDataExport();235 setupNewRun();236 world.resetTicks();237 world.resetTimer();238}239function defineWindow() {240 Globals.setGlobal(7, (world.minPxcor + 2));241 Globals.setGlobal(8, (world.maxPxcor - 2));242 Globals.setGlobal(9, 0);243 Globals.setGlobal(10, (world.maxPycor - 2));244}245function inWindow_p(u, v) {246 return ((((Globals.getGlobal(7) < u) && (u < Globals.getGlobal(8))) && (Globals.getGlobal(9) < v)) && (v < Globals.getGlobal(10)));247}248function defineTransforms() {249 var uCenter = ((Globals.getGlobal(7) + Globals.getGlobal(8)) / 2);250 var vCenter = ((Globals.getGlobal(9) + Globals.getGlobal(10)) / 2);251 Globals.setGlobal(3, Globals.getGlobal(39));252 Globals.setGlobal(5, Globals.getGlobal(39));253 Globals.setGlobal(4, (uCenter - (Globals.getGlobal(37) * Globals.getGlobal(39))));254 Globals.setGlobal(6, (vCenter - (Globals.getGlobal(38) * Globals.getGlobal(39))));255}256function supportMouse() {257 if (!(inWindow_p(session.controller.mouseXcor, session.controller.mouseYcor))) {258 return;259 }260 if (Globals.getGlobal(26) || Globals.getGlobal(12) || Globals.getGlobal(13) || Globals.getGlobal(66)) {261 return;262 }263 if (session.controller.mouseDown && session.controller.mouseInside) {264 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {265 placeCar(((session.controller.mouseXcor - Globals.getGlobal(4)) / Globals.getGlobal(3)));266 });267 }268}269function drawRamp() {270 var object = Globals.getGlobal(16);271 var pairZero = [];272 if (!(Prims.empty(object))) {273 pairZero = Prims.first(object);274 object = Prims.butFirst(object);275 }276 while (!(Prims.empty(object))) {277 var pairOne = Prims.first(object);278 object = Prims.butFirst(object);279 safeConnect(pairZero, pairOne, Globals.getGlobal(17), (Globals.getGlobal(39) / 20));280 pairZero = pairOne;281 }282}283function safeConnect(p0, p1, c, wide) {284 var u0 = ((Globals.getGlobal(3) * Prims.first(p0)) + Globals.getGlobal(4));285 var u1 = ((Globals.getGlobal(3) * Prims.first(p1)) + Globals.getGlobal(4));286 var v0 = ((Globals.getGlobal(5) * Prims.last(p0)) + Globals.getGlobal(6));287 var v1 = ((Globals.getGlobal(5) * Prims.last(p1)) + Globals.getGlobal(6));288 if ((Prims.equality(u0, u1) && Prims.equality(v0, v1))) {289 return;290 }291 var w = 0;292 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {293 AgentSet.setTurtleVariable(10, (0.1 * Globals.getGlobal(39)));294 AgentSet.setTurtleVariable(5, "tick mark");295 AgentSet.setTurtleVariable(1, 9.9);296 AgentSet.setTurtleVariable(2, 0);297 Prims.setXY(u0, v0);298 w = AgentSet.getTurtleVariable(0);299 });300 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {301 var x0 = ((u0 - Globals.getGlobal(4)) / Globals.getGlobal(3));302 if ((x0 >= 0)) {303 AgentSet.setTurtleVariable(10, 0.1);304 AgentSet.setTurtleVariable(1, (0 + 4.5));305 AgentSet.setTurtleVariable(7, 9.9);306 AgentSet.setTurtleVariable(6, (Dump("") + Dump(Prims.precision(x0, 2)) + Dump(" m")));307 Prims.setXY((u0 + 6), (v0 - 6));308 }309 });310 AgentSet.ask(world.createTurtles(1, "DRAWING-DOTS"), true, function() {311 AgentSet.self().hideTurtle(true);;312 if ((u1 > Globals.getGlobal(8))) {313 u1 = Globals.getGlobal(8);314 }315 Prims.setXY(u1, v1);316 AgentSet.ask(AgentSet.createLinkWith(world.getTurtleOfBreed("DRAWING-DOTS", w)), true, function() {317 AgentSet.setLinkVariable(7, wide);318 AgentSet.setTurtleVariable(1, c);319 });320 });321}322function runCar() {323 var aRamp = 1;324 if ((Globals.getGlobal(12) && !(Globals.getGlobal(15)))) {325 Globals.setGlobal(15, true);326 Globals.setGlobal(29, 0);327 Globals.setGlobal(35, Prims.precision(Globals.getGlobal(23), 2));328 Globals.setGlobal(34, Prims.precision(Globals.getGlobal(31), 2));329 var d0 = StrictMath.sqrt(((Globals.getGlobal(23) * Globals.getGlobal(23)) + (Globals.getGlobal(24) * Globals.getGlobal(24))));330 var cosTheta = 1;331 var sinTheta = 0;332 if (!Prims.equality(d0, 0)) {333 cosTheta = (StrictMath.abs(Globals.getGlobal(23)) / d0);334 sinTheta = (Globals.getGlobal(24) / d0);335 }336 aRamp = (Globals.getGlobal(28) * (sinTheta - (Globals.getGlobal(0) * cosTheta)));337 var aFloor = (0 - (Globals.getGlobal(28) * Globals.getGlobal(0)));338 Globals.setGlobal(79, StrictMath.sqrt(((2 * d0) / aRamp)));339 Globals.setGlobal(81, (aRamp * Globals.getGlobal(79)));340 Globals.setGlobal(82, ((0.5 * aRamp) * cosTheta));341 Globals.setGlobal(83, (0.5 * aFloor));342 Globals.setGlobal(80, (Globals.getGlobal(79) - (Globals.getGlobal(81) / aFloor)));343 }344 if ((Globals.getGlobal(29) >= Globals.getGlobal(80))) {345 handleRunEnd("You can now analyze your data. Press the \"Analyze data\" button.\n");346 return;347 }348 if ((aRamp <= 0)) {349 handleRunEnd("The car cannot move. Too much friction.\n");350 }351 if ((Globals.getGlobal(23) < 0)) {352 Globals.setGlobal(23, (Globals.getGlobal(35) + ((Globals.getGlobal(82) * Globals.getGlobal(29)) * Globals.getGlobal(29))));353 Globals.setGlobal(25, ((2 * Globals.getGlobal(82)) * Globals.getGlobal(29)));354 }355 if ((Globals.getGlobal(23) >= 0)) {356 var timeFloor = (Globals.getGlobal(29) - Globals.getGlobal(79));357 Globals.setGlobal(23, (timeFloor * (Globals.getGlobal(81) + (Globals.getGlobal(83) * timeFloor))));358 Globals.setGlobal(25, (Globals.getGlobal(81) + ((2 * Globals.getGlobal(83)) * timeFloor)));359 }360 if ((Globals.getGlobal(23) > 4.3)) {361 crash();362 }363 placeCar(Globals.getGlobal(23));364 Globals.setGlobal(29, (Globals.getGlobal(29) + Globals.getGlobal(30)));365}366function crash() {367 Globals.setGlobal(25, 0);368 handleRunEnd("Oops, you crashed the car!!\n");369 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {370 AgentSet.setTurtleVariable(5, "crash");371 var oldSize = AgentSet.getTurtleVariable(10);372 AgentSet.setTurtleVariable(10, 20);373 Prims.repeat(12, function () {374 AgentSet.setTurtleVariable(10, (AgentSet.getTurtleVariable(10) + 10));375 });376 Globals.setGlobal(23, 4.2);377 AgentSet.setTurtleVariable(5, "car");378 AgentSet.setTurtleVariable(10, oldSize);379 });380}381function handleRunEnd(mess) {382 Globals.setGlobal(68, Globals.getGlobal(23));383 Globals.setGlobal(12, false);384 Globals.setGlobal(15, false);385 Globals.setGlobal(13, true);386 myClearOutput();387 prettyPrint(mess);388 analyzeButton.disabled = false;389}390function captureFinalState() {391 if ((!(Globals.getGlobal(11)) && !(Globals.getGlobal(12)))) {392 Globals.setGlobal(15, false);393 Globals.setGlobal(13, true);394 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {395 updateRunSeries(Prims.precision(Globals.getGlobal(68), 2));396 });397 }398}399function placeCar(x) {400 var mult = 1;401 if (Prims.equality(Globals.getGlobal(42), 4)) {402 mult = 1.4;403 }404 var offMult = 1;405 if (Prims.equality(Globals.getGlobal(42), 4)) {406 offMult = 1.2;407 }408 var oldOffset = Globals.getGlobal(21);409 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {410 AgentSet.setTurtleVariable(10, (((Globals.getGlobal(22) * 0.01) * mult) * Globals.getGlobal(39)));411 Globals.setGlobal(21, (offMult * Globals.getGlobal(21)));412 Globals.setGlobal(23, x);413 var loc = uvOfCar();414 var u = Prims.first(loc);415 var v = Prims.last(loc);416 if (inWindow_p(u, v)) {417 AgentSet.self().hideTurtle(false);;418 Prims.setXY(u, v);419 }420 else {421 AgentSet.self().hideTurtle(true);;422 }423 });424 Globals.setGlobal(21, oldOffset);425}426function uvOfCar() {427 var disp = ((Globals.getGlobal(21) * 0.01) * Globals.getGlobal(39));428 var u = ((Globals.getGlobal(3) * Globals.getGlobal(23)) + Globals.getGlobal(4));429 var info = trackHeight(Globals.getGlobal(16), Globals.getGlobal(23));430 var y = Prims.first(info);431 Globals.setGlobal(24, y);432 Globals.setGlobal(31, y);433 var v = ((Globals.getGlobal(5) * y) + Globals.getGlobal(6));434 AgentSet.setTurtleVariable(2, (Prims.last(info) - 90));435 disp = (disp / Trig.unsquashedCos(AgentSet.getTurtleVariable(2)));436 return Prims.list(u, (v + disp));437}438function trackHeight(pairs, x) {439 if ((x < Prims.first(Prims.first(pairs)))) {440 return Prims.list(0, 90);441 }442 if ((x > Prims.first(Prims.last(pairs)))) {443 return Prims.list(0, 90);444 }445 var i = 1;446 while ((i < Prims.length(pairs))) {447 var x0 = Prims.first(Prims.item((i - 1), pairs));448 var x1 = Prims.first(Prims.item(i, pairs));449 if (((x >= x0) && (x <= x1))) {450 var y0 = Prims.last(Prims.item((i - 1), pairs));451 var y1 = Prims.last(Prims.item(i, pairs));452 if (Prims.equality(x0, x1)) {453 return Prims.list((0.5 * (y0 + y1)), 0);454 }455 var direction = Trig.atan((x1 - x0), (y1 - y0));456 return Prims.list((y0 + (((x - x0) * (y1 - y0)) / (x1 - x0))), direction);457 }458 i = (i + 1);459 }460}461function setupNewRun() {462 if (!(Globals.getGlobal(66))) {463 dataExportLogEvent("User tried to set up a new run before analyzing data.", "", "", "");464 return;465 }466 Globals.setGlobal(66, false);467 Globals.setGlobal(43, Globals.getGlobal(69));468 Globals.setGlobal(42, Globals.getGlobal(70));469 var endpoint = 0;470 dataExportLogEvent("User set up a new run.", createRunParameterList(endpoint), "", "");471 Globals.setGlobal(66, false);472 Globals.setGlobal(67, true);473 myClearOutput();474 setupGame();475 showTarget();476 Globals.setGlobal(29, 0);477 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {478 AgentSet.setTurtleVariable(1, 15);479 if (Prims.equality(Globals.getGlobal(42), 3)) {480 AgentSet.setTurtleVariable(1, 55);481 }482 if (Prims.equality(Globals.getGlobal(42), 4)) {483 AgentSet.setTurtleVariable(1, 105);484 }485 });486 if (Prims.equality(Globals.getGlobal(42), 5)) {487 Globals.setGlobal(35, -0.5);488 }489 AgentSet.ask(world.turtlesOfBreed("CARS"), true, function() {490 placeCar(Globals.getGlobal(35));491 Globals.setGlobal(25, 0);492 });493 Globals.setGlobal(12, false);494 Globals.setGlobal(15, false);495 dataExportClearLastRun();496 showTarget();497 prettyPrint(Globals.getGlobal(46));498 world.tick();499}500function showTarget() {501 var y = Prims.first(trackHeight(Globals.getGlobal(16), Globals.getGlobal(56)));502 AgentSet.ask(world.getTurtleOfBreed("MARKERS", Globals.getGlobal(63)), true, function() {503 var u = ((Globals.getGlobal(3) * (Globals.getGlobal(56) - Globals.getGlobal(59))) + Globals.getGlobal(4));504 var v = (((Globals.getGlobal(5) * y) + Globals.getGlobal(6)) + 3);505 Prims.setXY(u, v);506 AgentSet.self().hideTurtle(false);;507 });508 AgentSet.ask(world.getTurtleOfBreed("MARKERS", Globals.getGlobal(64)), true, function() {509 var u = ((Globals.getGlobal(3) * (Globals.getGlobal(56) + Globals.getGlobal(59))) + Globals.getGlobal(4));510 var v = (((Globals.getGlobal(5) * y) + Globals.getGlobal(6)) + 3);511 Prims.setXY(u, v);512 AgentSet.self().hideTurtle(false);;513 });514 AgentSet.ask(world.getTurtleOfBreed("MARKERS", Globals.getGlobal(65)), true, function() {515 var u = ((Globals.getGlobal(3) * Globals.getGlobal(56)) + Globals.getGlobal(4));516 var v = (((Globals.getGlobal(5) * y) + Globals.getGlobal(6)) + 4.5);517 Prims.setXY(u, v);518 AgentSet.self().hideTurtle(false);;519 AgentSet.ask(world.getTurtleOfBreed("DRAWING-DOTS", Globals.getGlobal(76)), true, function() {520 Prims.setXY((u + 10), (v + 14));521 AgentSet.setTurtleVariable(6, (Dump("") + Dump(Prims.precision(Globals.getGlobal(56), 2)) + Dump(" m")));522 });523 });524}525function startRun() {526 startButton.disabled = true;527 frictionSlider.disabled = true;528 if (Globals.getGlobal(66)) {529 dataExportLogEvent("User tried to start before pressing \"Set up new run\".", "", "", "");530 return;531 }532 if (!(Globals.getGlobal(67))) {533 return;534 }535 if (Globals.getGlobal(12)) {536 dataExportLogEvent("User tried to start while running.", "", "", "");537 return;538 }539 if ((Globals.getGlobal(23) >= 0)) {540 prettyPrint("Place the car on the ramp.\n");541 dataExportLogEvent("User tried to start with car on the level floor.", "", "", "");542 return;543 }544 if (!(Globals.getGlobal(36))) {545 if (myUserYesOrNo_p("If you run now, you will lose data. Press the \"Analyze data\" button to save your data.\n")) {546 return;547 }548 }549 Globals.setGlobal(36, false);550 Globals.setGlobal(67, false);551 Globals.setGlobal(13, false);552 Globals.setGlobal(25, 0);553 var endpoint = 0;554 endpoint = Prims.precision(Globals.getGlobal(23), 2);555 dataExportLogEvent((Dump("") + Dump("User started the model with the following level and step: ") + Dump(Globals.getGlobal(42)) + Dump(" ") + Dump(Globals.getGlobal(43)) + Dump(".")), createRunParameterList(endpoint), "", "");556 Globals.setGlobal(12, true);557 Globals.setGlobal(29, 0);558}559function getNextStep() {560 setupButton.disabled = false;561 var upperBreak = ((2 * Globals.getGlobal(54)) / 3);562 var lowerBreak = (Globals.getGlobal(54) / 4);563 Globals.setGlobal(73, true);564 if ((Globals.getGlobal(41) > upperBreak)) {565 myClearOutput();566 prettyPrint((Dump("") + Dump("Congratulations! You earned ") + Dump(Globals.getGlobal(41)) + Dump(" points! You advance a step and the target gets smaller.\n")));567 Globals.setGlobal(69, (Globals.getGlobal(43) + 1));568 if ((Globals.getGlobal(69) > Globals.getGlobal(55))) {569 if ((Globals.getGlobal(42) < Globals.getGlobal(62))) {570 myClearOutput();571 prettyPrint((Dump("") + Dump("Congratulations! You earned ") + Dump(Globals.getGlobal(41)) + Dump(" points! You advance to a new challenge!!\n")));572 Globals.setGlobal(27, true);573 Globals.setGlobal(69, 1);574 Globals.setGlobal(70, (Globals.getGlobal(42) + 1));575 return;576 }577 if ((Globals.getGlobal(70) >= Globals.getGlobal(62))) {578 Globals.setGlobal(70, Globals.getGlobal(62));579 Globals.setGlobal(69, Globals.getGlobal(55));580 if (Globals.getGlobal(72)) {581 myClearOutput();582 prettyPrint((Dump("") + Dump("Incredible!! You have completed the hardest challenge. You are a winner.\n")));583 prettyPrint("You can contine to earn points in this challenge. What have you learned?\n");584 Globals.setGlobal(72, false);585 Globals.setGlobal(27, true);586 }587 }588 }589 return;590 }591 if ((Globals.getGlobal(41) > lowerBreak)) {592 myClearOutput();593 Globals.setGlobal(73, false);594 prettyPrint((Dump("") + Dump("OK! You earned ") + Dump(Globals.getGlobal(41)) + Dump(" points. Try again.\n")));595 prettyPrint((Dump("") + Dump("You have to get ") + Dump(StrictMath.round(upperBreak)) + Dump(" points to advance.\n")));596 return;597 }598 if ((Globals.getGlobal(41) < lowerBreak)) {599 Globals.setGlobal(73, false);600 myClearOutput();601 var m = (Dump("") + Dump("Not so good. You score ") + Dump(Globals.getGlobal(41)) + Dump(" points.\n\n"));602 if ((Globals.getGlobal(43) > 1)) {603 m = (Dump("") + Dump(m) + Dump("Since your score was less than ") + Dump(StrictMath.round(lowerBreak)) + Dump(" you now get a larger target.\n"));604 }605 prettyPrint(m);606 Globals.setGlobal(69, (Globals.getGlobal(43) - 1));607 if (Prims.equality(Globals.getGlobal(43), 1)) {608 Globals.setGlobal(69, 1);609 }610 }611}612function setupGame() {613 setupGameLevel();614 setupGameStep();615}616function setupGameLevel() {617 Globals.setGlobal(54, 100);618 Globals.setGlobal(74, false);619 if (Prims.equality(Globals.getGlobal(42), 1)) {620 Globals.setGlobal(46, "Place the car where you want it to start.\n");621 if (Prims.equality(Globals.getGlobal(43), 1)) {622 Globals.setGlobal(46, "Challenge 1:\n\nMake the car stop in the center of the red area by changing the car's starting position.\n\n");623 Globals.setGlobal(46, (Dump("") + Dump(Globals.getGlobal(46)) + Dump("As you get better, the red target will get smaller.\n\n")));624 Globals.setGlobal(46, (Dump("") + Dump(Globals.getGlobal(46)) + Dump("When you press \"Analyze data\" your data is saved and graphed. The graph will help you later.\n")));625 }626 Globals.setGlobal(0, 0.18);627 Globals.setGlobal(50, Globals.getGlobal(0));628 Globals.setGlobal(48, true);629 Globals.setGlobal(49, false);630 Globals.setGlobal(26, false);631 Globals.setGlobal(55, 3);632 Globals.setGlobal(57, 0.4);633 Globals.setGlobal(58, 0.15);634 Globals.setGlobal(74, true);635 }636 if (Prims.equality(Globals.getGlobal(42), 2)) {637 Globals.setGlobal(46, "");638 if (Prims.equality(Globals.getGlobal(43), 1)) {639 Globals.setGlobal(46, "Challenge 2:\n\nMake the car stop in the center of the red area by changing the car's starting position.\n\n");640 Globals.setGlobal(46, (Dump("") + Dump(Globals.getGlobal(46)) + Dump("Watch out!! The red band now moves each trial.\n")));641 }642 Globals.setGlobal(0, 0.18);643 Globals.setGlobal(50, Globals.getGlobal(0));644 Globals.setGlobal(48, true);645 Globals.setGlobal(49, false);646 Globals.setGlobal(55, 4);647 Globals.setGlobal(26, false);648 Globals.setGlobal(57, 0.4);649 Globals.setGlobal(58, 0.15);650 }651 if (Prims.equality(Globals.getGlobal(42), 3)) {652 Globals.setGlobal(46, "");653 if (Prims.equality(Globals.getGlobal(43), 1)) {654 Globals.setGlobal(46, "Challenge 3:\n\nMake a new car stop in the red area. This car has less friction.\n");655 }656 Globals.setGlobal(0, 0.08);657 Globals.setGlobal(20, 100);658 Globals.setGlobal(50, Globals.getGlobal(0));659 Globals.setGlobal(49, false);660 Globals.setGlobal(26, false);661 Globals.setGlobal(55, 4);662 Globals.setGlobal(57, 0.4);663 Globals.setGlobal(58, 0.2);664 }665 if (Prims.equality(Globals.getGlobal(42), 4)) {666 Globals.setGlobal(46, "");667 if (Prims.equality(Globals.getGlobal(43), 1)) {668 Globals.setGlobal(46, "Challenge 4:\n\nMake this heavier car stop in the center of the red area.\n\nThis car is twice the mass of the last car, but the friction is back to what it was before.\n");669 }670 Globals.setGlobal(0, 0.18);671 Globals.setGlobal(20, 200);672 Globals.setGlobal(50, Globals.getGlobal(0));673 Globals.setGlobal(49, false);674 Globals.setGlobal(48, true);675 Globals.setGlobal(26, false);676 Globals.setGlobal(55, 3);677 Globals.setGlobal(53, -0.8);678 Globals.setGlobal(52, -0.8);679 Globals.setGlobal(57, 0.3);680 Globals.setGlobal(58, 0.13);681 }682 if (Prims.equality(Globals.getGlobal(42), 5)) {683 Globals.setGlobal(46, "");684 if (Prims.equality(Globals.getGlobal(43), 1)) {685 Globals.setGlobal(46, "Challenge 5:\n\nNow make the car stop in the center of the red area by changing the friction slider to the left.\n");686 }687 Globals.setGlobal(0, 0.18);688 Globals.setGlobal(20, 100);689 Globals.setGlobal(50, Globals.getGlobal(0));690 Globals.setGlobal(49, true);691 Globals.setGlobal(48, false);692 Globals.setGlobal(26, true);693 Globals.setGlobal(55, 6);694 Globals.setGlobal(57, 0.4);695 Globals.setGlobal(58, 0.13);696 }697 setupButton.disabled = true;698 analyzeButton.disabled = true;699 startButton.disabled = false;700 frictionSlider.style.display = Globals.getGlobal(48) ? "none" : "inline";701 frictionSlider.disabled = Globals.getGlobal(48);702}703function setupGameStep() {704 if ((Globals.getGlobal(73) && !(Globals.getGlobal(74)))) {705 Globals.setGlobal(75, Prims.mod((Globals.getGlobal(75) + 1), Prims.length(Globals.getGlobal(77))));706 }707 Globals.setGlobal(56, Prims.item(Globals.getGlobal(75), Globals.getGlobal(77)));708 Globals.setGlobal(59, (Globals.getGlobal(57) + (((Globals.getGlobal(58) - Globals.getGlobal(57)) * (Globals.getGlobal(43) - 1)) / (Globals.getGlobal(55) - 1))));709 if (((Globals.getGlobal(59) + Globals.getGlobal(56)) > 4.3)) {710 Globals.setGlobal(59, (4.3 - Globals.getGlobal(56)));711 }712}713function randomBetween(a, b) {714 return (a + Prims.randomFloat((b - a)));715}716function prettyPrint(mess) {717 if (Prims.equality(mess, 0)) {718 return;719 }720 if (Prims.empty(mess)) {721 return;722 }723 var line = "";724 if ((Prims.length(mess) <= Globals.getGlobal(2))) {725 Prims.outputPrint(mess);726 return;727 }728 var i = 0;729 var n = -1;730 while ((i < Globals.getGlobal(2))) {731 var ch = Prims.item(i, mess);732 if (Prims.equality(ch, " ")) {733 n = i;734 }735 i = (i + 1);736 }737 if (Prims.equality(n, -1)) {738 line = Prims.substring(mess, 0, Globals.getGlobal(2));739 mess = Prims.substring(mess, Globals.getGlobal(2), Prims.length(mess));740 }741 else {742 if (Prims.equality(n, Globals.getGlobal(2))) {743 line = Prims.substring(mess, 0, n);744 mess = Prims.substring(mess, n, Prims.length(mess));745 }746 else {747 line = Prims.substring(mess, 0, n);748 mess = Prims.substring(mess, (n + 1), Prims.length(mess));749 }750 }751 Prims.outputPrint(line);752 prettyPrint(mess);753}754function updateScore() {755 Globals.setGlobal(41, 0);756 if ((StrictMath.abs((Globals.getGlobal(68) - Globals.getGlobal(56))) < Globals.getGlobal(59))) {757 Globals.setGlobal(71, (Globals.getGlobal(71) - 1));758 if ((Globals.getGlobal(71) < 0)) {759 Globals.setGlobal(71, 0);760 }761 Globals.setGlobal(41, ((0.5 * Globals.getGlobal(54)) * (1 + Trig.unsquashedCos(((180 * StrictMath.abs((Globals.getGlobal(68) - Globals.getGlobal(56)))) / Globals.getGlobal(59))))));762 Globals.setGlobal(41, (5 * StrictMath.round((0.2 * Globals.getGlobal(41)))));763 }764 Globals.setGlobal(40, StrictMath.round((Globals.getGlobal(40) + Globals.getGlobal(41))));765 Globals.setGlobal(41, StrictMath.round(Globals.getGlobal(41)));766 if ((StrictMath.abs((Globals.getGlobal(68) - Globals.getGlobal(56))) > (2 * Globals.getGlobal(59)))) {767 Globals.setGlobal(71, (Globals.getGlobal(71) + 1));768 if ((Globals.getGlobal(71) > 2)) {769 prettyPrint("It looks like you are just guessing. All the information that you need to hit the target is in the graph.\n");770 noop(5);771 }772 if ((Globals.getGlobal(71) > 3)) {773 Globals.setGlobal(71, 4);774 prettyPrint("You loose 100 points for gussing.\n");775 Globals.setGlobal(40, (Globals.getGlobal(40) - 100));776 if ((Globals.getGlobal(40) < 0)) {777 Globals.setGlobal(40, 0);778 }779 }780 }781 dataExportLogEvent((Dump("") + Dump("User score: ") + Dump(Globals.getGlobal(41)) + Dump(".")), "", "", "");782 dataExportLogEvent((Dump("") + Dump("User max score:") + Dump(Globals.getGlobal(54)) + Dump(".")), "", "", "");783}784function displayHelpMessage() {785 var numberShownAlready = Prims.item((Globals.getGlobal(42) - 1), Globals.getGlobal(1));786 Globals.setGlobal(1, Prims.replaceitem((Globals.getGlobal(42) - 1), Globals.getGlobal(1), (numberShownAlready + 1)));787 var m = "Sorry, no more hints are available.";788 if (Prims.equality(Globals.getGlobal(42), 1)) {789 if (Prims.equality(numberShownAlready, 0)) {790 m = "Before starting a run, move the car to where you think it will have enough energy to reach the center of the red target.\n\n";791 m = (Dump("") + Dump(m) + Dump("Try to get the antenna on the car near the red line in the center of the red target.\n"));792 }793 if (Prims.equality(numberShownAlready, 1)) {794 m = "Press the \"Start\" button to start the car rolling down the ramp. \n";795 }796 if (Prims.equality(numberShownAlready, 2)) {797 m = "After a good score you advance by one step and the red target gets smaller. \n";798 }799 if (Prims.equality(numberShownAlready, 3)) {800 m = "After each run, save your data by pressing the \"Analyze data\" button. \n";801 }802 if (Prims.equality(numberShownAlready, 4)) {803 m = "Before you can make a new run, you need to press the \"Set up new run\" button. \n";804 }805 if (Prims.equality(numberShownAlready, 5)) {806 m = "The \"Set up new run\" button returns the car to its previous starting position. \n";807 }808 }809 if (Prims.equality(Globals.getGlobal(42), 2)) {810 if (Prims.equality(numberShownAlready, 0)) {811 m = "In this challenge, the red target moves around each run.\n";812 }813 if (Prims.equality(numberShownAlready, 1)) {814 m = "Pay attention to the starting height above the floor. \n";815 }816 if (Prims.equality(numberShownAlready, 2)) {817 m = "The graph can help you find the best place to start the car. \n";818 }819 if (Prims.equality(numberShownAlready, 3)) {820 m = "Look carefully at the graph that shows starting height and distance traveled. \n";821 }822 if (Prims.equality(numberShownAlready, 4)) {823 m = "Clicking on the gear at the top right of the graph allows you to connect points. Try this.\n";824 }825 if (Prims.equality(numberShownAlready, 5)) {826 m = "Under the gear is an option to draw and drag a line. This can be a big help. \n";827 }828 if (Prims.equality(numberShownAlready, 5)) {829 m = "Expanding the scales on the graph can help you read values from the graph accurately.\n";830 m = (Dump("") + Dump(m) + Dump("\nDo this by dragging at the end of the scales. To undo this, use the option under the gear to show all the data.\n"));831 }832 }833 if (Prims.equality(Globals.getGlobal(42), 3)) {834 if (Prims.equality(numberShownAlready, 0)) {835 m = "For this challenge, the friction is lower than before.\n";836 }837 if (Prims.equality(numberShownAlready, 1)) {838 m = "Now when you save data, the points will trace out a different graph of distance against starting height.\n";839 }840 if (Prims.equality(numberShownAlready, 2)) {841 m = "Use the new graph of distance against starting height to predict starting positions at this challenge.\n";842 }843 }844 if (Prims.equality(numberShownAlready, 3)) {845 m = "One way to see the pattern is to clear out all the previous graph data before starting.\n";846 }847 if (Prims.equality(Globals.getGlobal(42), 4)) {848 if (Prims.equality(numberShownAlready, 0)) {849 m = "For this challenge, you can change only the starting position of the car.\n";850 }851 if (Prims.equality(numberShownAlready, 1)) {852 m = "Do you think a heavier car will travel further or less?\n";853 }854 if (Prims.equality(numberShownAlready, 2)) {855 m = "Note the friction value on the slider.\n";856 }857 if (Prims.equality(numberShownAlready, 3)) {858 m = "Hint: Think about Galileo's experiment at the Tower of Pisa.\n";859 }860 }861 if (Prims.equality(Globals.getGlobal(42), 5)) {862 if (Prims.equality(numberShownAlready, 0)) {863 m = "For this challenge, you cannot change the starting position of the car or the ramp height. You have to change friction.\n";864 }865 if (Prims.equality(numberShownAlready, 1)) {866 m = "To let the car go farther, do you think you should increase or decrease friction?\n";867 }868 if (Prims.equality(numberShownAlready, 2)) {869 m = "Hint: Use the graph that has friction on the x-axis.\n";870 }871 if (Prims.equality(numberShownAlready, 3)) {872 m = "On the graph, you want to see only the points generated by challenge 5. ";873 m = (Dump("") + Dump(m) + Dump("You can do this by selecting only the last items in the table.\n"));874 }875 }876 prettyPrint(m);877 Globals.setGlobal(1, Prims.replaceitem((Globals.getGlobal(42) - 1), Globals.getGlobal(1), (numberShownAlready + 1)));878 dataExportLogEvent((Dump("") + Dump("User received the message ") + Dump(m)), "", "", "");879}880function scoreDisplay() {881 if (!((Prims.equality(Globals.getGlobal(42), 1) && Prims.equality(Globals.getGlobal(43), 1)))) {882 return (Dump("") + Dump(Globals.getGlobal(41)) + Dump(" out of ") + Dump(Globals.getGlobal(54)));883 }884 else {885 return "&nbsp;";886 }887}888function analyzeData() {889 if (!(Globals.getGlobal(13))) {890 dataExportLogEvent("User tried to analyze data before a run.", "", "", "");891 return;892 }893 myClearOutput();894 captureFinalState();895 updateScore();896 getNextStep();897 if ((Prims.equality(Globals.getGlobal(70), 1) && Prims.equality(Globals.getGlobal(69), 1))) {898 prettyPrint("Data saved. Do you see the new point on the graph?\n");899 prettyPrint("Now set up a new run by pressing the \"Set up new run\" button.\n");900 }901 Globals.setGlobal(13, false);902 Globals.setGlobal(36, true);903 Globals.setGlobal(66, true);904 analyzeButton.disabled = true;905 setupNewRun.disabled = false;906 openCODAPTable()907}908function setupDataExport() {909 var computationalInputs = [["Challenge", "", 1, 5, true], ["Step", "", 1, 8, true], ["Start height", "m", 0, 1.5, true], ["Friction", "", 0, 0.3, true], ["Mass", "g", 100, 200, true]];910 var representationalInputs = [];911 var computationalOutputs = [["End distance", "m", 0, 6, true]];912 var studentInputs = [];913 var modelInformation = [["ramp", "RampGame.v5b.nlogo", "Jan-7-2014"]];914 var timeSeriesData = [];915 var setup = Prims.list(computationalInputs, representationalInputs, computationalOutputs, studentInputs, modelInformation, timeSeriesData);916}917function updateRunSeries(endpoint) {918 dataExportUpdateRunSeries(Prims.list(Globals.getGlobal(42), Globals.getGlobal(43), Globals.getGlobal(34), Globals.getGlobal(0), Globals.getGlobal(20), endpoint));919 dataExportLogEvent("User exported the model.", createRunParameterList(endpoint), "", "");920}921function createRunParameterList(endpoint) {922 return Prims.list(Globals.getGlobal(34), Globals.getGlobal(0), endpoint, Globals.getGlobal(20));923}924Globals.setGlobal(0, 0.18);world = new World(-150, 150, 0, 85, 2.07, false, false, {"default":{"rotate":true,"elements":[{"xcors":[150.0,40.0,150.0,260.0],"ycors":[5.0,250.0,205.0,250.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"airplane":{"rotate":true,"elements":[{"xcors":[150.0,135.0,120.0,120.0,15.0,15.0,120.0,135.0,105.0,120.0,150.0,180.0,210.0,165.0,180.0,285.0,285.0,180.0,180.0,165.0],"ycors":[0.0,15.0,60.0,105.0,165.0,195.0,180.0,240.0,270.0,285.0,270.0,285.0,270.0,240.0,180.0,195.0,165.0,105.0,60.0,15.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"ambulance":{"rotate":true,"elements":[{"xmin":30.0,"ymin":90.0,"xmax":210.0,"ymax":195.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[296.0,296.0,259.0,244.0,210.0,210.0],"ycors":[190.0,150.0,134.0,104.0,105.0,190.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":195.0,"ymin":60.0,"xmax":195.0,"ymax":105.0,"type":"rectangle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xcors":[238.0,252.0,219.0,218.0],"ycors":[112.0,141.0,141.0,112.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":234.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":69.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xmin":288.0,"ymin":158.0,"xmax":297.0,"ymax":173.0,"type":"rectangle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xmin":289.0,"ymin":180.0,"xmax":298.0,"ymax":172.0,"type":"rectangle","color":"rgba(237, 237, 49, 1.0)","filled":true,"marked":false},{"xmin":29.0,"ymin":151.0,"xmax":298.0,"ymax":158.0,"type":"rectangle","color":"rgba(215, 50, 41, 1.0)","filled":true,"marked":false},{"x1":210.0,"y1":90.0,"x2":210.0,"y2":195.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false},{"xmin":83.0,"ymin":116.0,"xmax":128.0,"ymax":133.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xmin":153.0,"ymin":111.0,"xmax":176.0,"ymax":134.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x1":165.0,"y1":105.0,"x2":165.0,"y2":135.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"xmin":14.0,"ymin":186.0,"xmax":33.0,"ymax":195.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":45.0,"y1":135.0,"x2":75.0,"y2":120.0,"type":"line","color":"rgba(52, 93, 169, 1.0)","filled":false,"marked":false},{"x1":75.0,"y1":135.0,"x2":45.0,"y2":120.0,"type":"line","color":"rgba(52, 93, 169, 1.0)","filled":false,"marked":false},{"x1":60.0,"y1":112.0,"x2":60.0,"y2":142.0,"type":"line","color":"rgba(52, 93, 169, 1.0)","filled":false,"marked":false}]},"arrow":{"rotate":true,"elements":[{"xcors":[150.0,0.0,105.0,105.0,195.0,195.0,300.0],"ycors":[0.0,150.0,150.0,293.0,293.0,150.0,150.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"ball":{"rotate":false,"elements":[{"x":0.0,"y":0.0,"diam":300.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"box":{"rotate":false,"elements":[{"xcors":[150.0,285.0,285.0,150.0],"ycors":[285.0,225.0,75.0,135.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[150.0,15.0,150.0,285.0],"ycors":[135.0,75.0,15.0,75.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[15.0,15.0,150.0,150.0],"ycors":[75.0,225.0,285.0,135.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":150.0,"y1":285.0,"x2":150.0,"y2":135.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false},{"x1":150.0,"y1":135.0,"x2":15.0,"y2":75.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false},{"x1":150.0,"y1":135.0,"x2":285.0,"y2":75.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false}]},"bug":{"rotate":true,"elements":[{"x":96.0,"y":182.0,"diam":108.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":110.0,"y":127.0,"diam":80.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":110.0,"y":75.0,"diam":80.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":150.0,"y1":100.0,"x2":80.0,"y2":30.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":150.0,"y1":100.0,"x2":220.0,"y2":30.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"bus":{"rotate":true,"elements":[{"xcors":[15.0,15.0,15.0,30.0,270.0,285.0,285.0,285.0,270.0,30.0],"ycors":[206.0,150.0,120.0,105.0,105.0,120.0,135.0,206.0,210.0,210.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":36.0,"ymin":126.0,"xmax":231.0,"ymax":159.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x1":60.0,"y1":135.0,"x2":60.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":60.0,"y1":120.0,"x2":60.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":90.0,"y1":120.0,"x2":90.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":120.0,"y1":120.0,"x2":120.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":150.0,"y1":120.0,"x2":150.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":180.0,"y1":120.0,"x2":180.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":210.0,"y1":120.0,"x2":210.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":240.0,"y1":135.0,"x2":240.0,"y2":165.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"xmin":15.0,"ymin":174.0,"xmax":285.0,"ymax":182.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":48.0,"y":187.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xmin":240.0,"ymin":127.0,"xmax":276.0,"ymax":205.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":195.0,"y":187.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x1":257.0,"y1":120.0,"x2":257.0,"y2":207.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"butterfly":{"rotate":true,"elements":[{"xcors":[150.0,209.0,225.0,225.0,195.0,165.0,150.0],"ycors":[165.0,199.0,225.0,255.0,270.0,255.0,240.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[150.0,89.0,75.0,75.0,105.0,135.0,150.0],"ycors":[165.0,198.0,225.0,255.0,270.0,255.0,240.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[139.0,100.0,55.0,25.0,10.0,10.0,25.0,40.0,85.0,139.0],"ycors":[148.0,105.0,90.0,90.0,105.0,135.0,180.0,195.0,194.0,163.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[162.0,200.0,245.0,275.0,290.0,290.0,275.0,260.0,215.0,162.0],"ycors":[150.0,105.0,90.0,90.0,105.0,135.0,180.0,195.0,195.0,165.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[150.0,135.0,120.0,135.0,150.0,165.0,180.0,165.0],"ycors":[255.0,225.0,150.0,120.0,105.0,120.0,150.0,225.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":135.0,"y":90.0,"diam":30.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x1":150.0,"y1":105.0,"x2":195.0,"y2":60.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false},{"x1":150.0,"y1":105.0,"x2":105.0,"y2":60.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false}]},"button":{"rotate":true,"elements":[{"xmin":30.0,"ymin":75.0,"xmax":285.0,"ymax":225.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":false},{"xmin":45.0,"ymin":90.0,"xmax":270.0,"ymax":210.0,"type":"rectangle","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":true}]},"car":{"rotate":true,"elements":[{"xcors":[300.0,279.0,261.0,240.0,226.0,213.0,203.0,185.0,159.0,135.0,75.0,0.0,0.0,0.0,300.0,300.0],"ycors":[180.0,164.0,144.0,135.0,132.0,106.0,84.0,63.0,50.0,50.0,60.0,150.0,165.0,225.0,225.0,180.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":180.0,"y":180.0,"diam":90.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":30.0,"y":180.0,"diam":90.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[162.0,132.0,134.0,209.0,194.0,189.0,180.0],"ycors":[80.0,78.0,135.0,135.0,105.0,96.0,89.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":47.0,"y":195.0,"diam":58.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":195.0,"y":195.0,"diam":58.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":150.0,"ymin":0.0,"xmax":165.0,"ymax":60.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"circle 2":{"rotate":false,"elements":[{"x":0.0,"y":0.0,"diam":300.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":30.0,"y":30.0,"diam":240.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"cow":{"rotate":false,"elements":[{"xcors":[200.0,197.0,179.0,177.0,166.0,140.0,93.0,78.0,72.0,49.0,48.0,37.0,25.0,25.0,45.0,103.0,179.0,198.0,252.0,272.0,293.0,285.0,255.0,242.0,224.0],"ycors":[193.0,249.0,249.0,196.0,187.0,189.0,191.0,179.0,211.0,209.0,181.0,149.0,120.0,89.0,72.0,84.0,75.0,76.0,64.0,81.0,103.0,121.0,121.0,118.0,167.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[73.0,86.0,62.0,48.0],"ycors":[210.0,251.0,249.0,208.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[25.0,16.0,9.0,23.0,25.0,39.0],"ycors":[114.0,195.0,204.0,213.0,200.0,123.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"crash":{"rotate":true,"elements":[{"xcors":[135.0,120.0,15.0,90.0,30.0,120.0,150.0,165.0,300.0,195.0,240.0,150.0],"ycors":[30.0,135.0,75.0,165.0,255.0,210.0,315.0,195.0,225.0,165.0,60.0,120.0],"type":"polygon","color":"rgba(237, 237, 49, 1.0)","filled":true,"marked":false},{"xcors":[135.0,90.0,105.0,30.0,120.0,45.0,120.0,195.0,150.0,240.0,150.0,165.0],"ycors":[135.0,75.0,150.0,135.0,180.0,210.0,195.0,270.0,180.0,150.0,150.0,45.0],"type":"polygon","color":"rgba(215, 50, 41, 1.0)","filled":true,"marked":false}]},"cylinder":{"rotate":false,"elements":[{"x":0.0,"y":0.0,"diam":300.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"dot":{"rotate":false,"elements":[{"x":90.0,"y":90.0,"diam":120.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"engine":{"rotate":true,"elements":[{"xmin":30.0,"ymin":105.0,"xmax":240.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[240.0,270.0,180.0,210.0],"ycors":[105.0,30.0,30.0,105.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[195.0,270.0,300.0,195.0],"ycors":[180.0,180.0,210.0,210.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":0.0,"y":165.0,"diam":90.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":240.0,"y":225.0,"diam":30.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":90.0,"y":165.0,"diam":90.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":195.0,"y":225.0,"diam":30.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":0.0,"ymin":30.0,"xmax":105.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":30.0,"ymin":60.0,"xmax":75.0,"ymax":105.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[195.0,165.0,240.0,240.0],"ycors":[180.0,150.0,150.0,180.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":135.0,"ymin":75.0,"xmax":165.0,"ymax":105.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":225.0,"ymin":120.0,"xmax":255.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":30.0,"ymin":203.0,"xmax":150.0,"ymax":218.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"face happy":{"rotate":false,"elements":[{"x":8.0,"y":8.0,"diam":285.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":60.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":180.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[150.0,90.0,62.0,47.0,67.0,90.0,109.0,150.0,192.0,210.0,227.0,251.0,236.0,212.0],"ycors":[255.0,239.0,213.0,191.0,179.0,203.0,218.0,225.0,218.0,203.0,181.0,194.0,217.0,240.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"face neutral":{"rotate":false,"elements":[{"x":8.0,"y":7.0,"diam":285.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":60.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":180.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xmin":60.0,"ymin":195.0,"xmax":240.0,"ymax":225.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"face sad":{"rotate":false,"elements":[{"x":8.0,"y":8.0,"diam":285.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":60.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":180.0,"y":75.0,"diam":60.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[150.0,90.0,62.0,47.0,67.0,90.0,109.0,150.0,192.0,210.0,227.0,251.0,236.0,212.0],"ycors":[168.0,184.0,210.0,232.0,244.0,220.0,205.0,198.0,205.0,220.0,242.0,229.0,206.0,183.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"fish":{"rotate":false,"elements":[{"xcors":[44.0,21.0,15.0,0.0,15.0,0.0,13.0,20.0,45.0],"ycors":[131.0,87.0,86.0,120.0,150.0,180.0,214.0,212.0,166.0],"type":"polygon","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xcors":[135.0,119.0,95.0,76.0,46.0,60.0],"ycors":[195.0,235.0,218.0,210.0,204.0,165.0],"type":"polygon","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xcors":[75.0,83.0,71.0,86.0,166.0,135.0],"ycors":[45.0,77.0,103.0,114.0,78.0,60.0],"type":"polygon","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xcors":[30.0,151.0,226.0,280.0,292.0,292.0,287.0,270.0,195.0,151.0,30.0],"ycors":[136.0,77.0,81.0,119.0,146.0,160.0,170.0,195.0,210.0,212.0,166.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":215.0,"y":106.0,"diam":30.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"flag":{"rotate":false,"elements":[{"xmin":60.0,"ymin":15.0,"xmax":75.0,"ymax":300.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[90.0,270.0,90.0],"ycors":[150.0,90.0,30.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":75.0,"y1":135.0,"x2":90.0,"y2":135.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":75.0,"y1":45.0,"x2":90.0,"y2":45.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"flower":{"rotate":false,"elements":[{"xcors":[135.0,165.0,180.0,180.0,150.0,165.0,195.0,195.0,165.0],"ycors":[120.0,165.0,210.0,240.0,300.0,300.0,240.0,195.0,135.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"x":85.0,"y":132.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":130.0,"y":147.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":192.0,"y":85.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":85.0,"y":40.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":177.0,"y":40.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":177.0,"y":132.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":70.0,"y":85.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":130.0,"y":25.0,"diam":38.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":96.0,"y":51.0,"diam":108.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":113.0,"y":68.0,"diam":74.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[189.0,219.0,249.0,279.0,234.0],"ycors":[233.0,188.0,173.0,188.0,218.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[180.0,150.0,105.0,75.0,135.0],"ycors":[255.0,210.0,210.0,240.0,240.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false}]},"house":{"rotate":false,"elements":[{"xmin":45.0,"ymin":120.0,"xmax":255.0,"ymax":285.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":120.0,"ymin":210.0,"xmax":180.0,"ymax":285.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[15.0,150.0,285.0],"ycors":[120.0,15.0,120.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":30.0,"y1":120.0,"x2":270.0,"y2":120.0,"type":"line","color":"rgba(0, 0, 0, 1.0)","filled":false,"marked":false}]},"leaf":{"rotate":false,"elements":[{"xcors":[150.0,135.0,120.0,60.0,30.0,60.0,60.0,15.0,30.0,15.0,40.0,45.0,60.0,90.0,105.0,120.0,105.0,120.0,135.0,150.0,165.0,180.0,195.0,180.0,195.0,210.0,240.0,255.0,263.0,285.0,270.0,285.0,240.0,240.0,270.0,240.0,180.0,165.0],"ycors":[210.0,195.0,210.0,210.0,195.0,180.0,165.0,135.0,120.0,105.0,104.0,90.0,90.0,105.0,120.0,120.0,60.0,60.0,30.0,15.0,30.0,60.0,60.0,120.0,120.0,105.0,90.0,90.0,104.0,105.0,120.0,135.0,165.0,180.0,195.0,210.0,210.0,195.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[135.0,135.0,120.0,105.0,105.0,135.0,165.0,165.0],"ycors":[195.0,240.0,255.0,255.0,285.0,285.0,240.0,195.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"line":{"rotate":false,"elements":[{"xmin":150.0,"ymin":0.0,"xmax":165.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"line half":{"rotate":true,"elements":[{"x1":150.0,"y1":0.0,"x2":150.0,"y2":150.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"pentagon":{"rotate":false,"elements":[{"xcors":[150.0,15.0,60.0,240.0,285.0],"ycors":[15.0,120.0,285.0,285.0,120.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"person":{"rotate":false,"elements":[{"x":110.0,"y":5.0,"diam":80.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[105.0,120.0,90.0,105.0,135.0,150.0,165.0,195.0,210.0,180.0,195.0],"ycors":[90.0,195.0,285.0,300.0,300.0,225.0,300.0,300.0,285.0,195.0,90.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":127.0,"ymin":79.0,"xmax":172.0,"ymax":94.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[195.0,240.0,225.0,165.0],"ycors":[90.0,150.0,180.0,105.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[105.0,60.0,75.0,135.0],"ycors":[90.0,150.0,180.0,105.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"plant":{"rotate":false,"elements":[{"xmin":135.0,"ymin":90.0,"xmax":165.0,"ymax":300.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[135.0,90.0,45.0,75.0,135.0],"ycors":[255.0,210.0,195.0,255.0,285.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[165.0,210.0,255.0,225.0,165.0],"ycors":[255.0,210.0,195.0,255.0,285.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[135.0,90.0,45.0,75.0,135.0],"ycors":[180.0,135.0,120.0,180.0,210.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[165.0,165.0,225.0,255.0,210.0],"ycors":[180.0,210.0,180.0,120.0,135.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[135.0,90.0,45.0,75.0,135.0],"ycors":[105.0,60.0,45.0,105.0,135.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[165.0,165.0,225.0,255.0,210.0],"ycors":[105.0,135.0,105.0,45.0,60.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[135.0,120.0,150.0,180.0,165.0],"ycors":[90.0,45.0,15.0,45.0,90.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"sheep":{"rotate":false,"elements":[{"x":203.0,"y":65.0,"diam":88.0,"type":"circle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"x":70.0,"y":65.0,"diam":162.0,"type":"circle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"x":150.0,"y":105.0,"diam":120.0,"type":"circle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"xcors":[218.0,240.0,255.0,278.0],"ycors":[120.0,165.0,165.0,120.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":false},{"x":214.0,"y":72.0,"diam":67.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":false},{"xmin":164.0,"ymin":223.0,"xmax":179.0,"ymax":298.0,"type":"rectangle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"xcors":[45.0,30.0,30.0,15.0,45.0],"ycors":[285.0,285.0,240.0,195.0,210.0],"type":"polygon","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"x":3.0,"y":83.0,"diam":150.0,"type":"circle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"xmin":65.0,"ymin":221.0,"xmax":80.0,"ymax":296.0,"type":"rectangle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"xcors":[195.0,210.0,210.0,240.0,195.0],"ycors":[285.0,285.0,240.0,210.0,210.0],"type":"polygon","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":true},{"xcors":[276.0,285.0,302.0,294.0],"ycors":[85.0,105.0,99.0,83.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":false},{"xcors":[219.0,210.0,193.0,201.0],"ycors":[85.0,105.0,99.0,83.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":false}]},"square":{"rotate":false,"elements":[{"xmin":30.0,"ymin":30.0,"xmax":270.0,"ymax":270.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"square 2":{"rotate":false,"elements":[{"xmin":30.0,"ymin":30.0,"xmax":270.0,"ymax":270.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":60.0,"ymin":60.0,"xmax":240.0,"ymax":240.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"star":{"rotate":false,"elements":[{"xcors":[151.0,185.0,298.0,207.0,242.0,151.0,59.0,94.0,3.0,116.0],"ycors":[1.0,108.0,108.0,175.0,282.0,216.0,282.0,175.0,108.0,108.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"target":{"rotate":false,"elements":[{"x":0.0,"y":0.0,"diam":300.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":30.0,"y":30.0,"diam":240.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":60.0,"y":60.0,"diam":180.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":90.0,"y":90.0,"diam":120.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":120.0,"y":120.0,"diam":60.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"tick mark":{"rotate":true,"elements":[{"xmin":135.0,"ymin":90.0,"xmax":165.0,"ymax":240.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"tiny dot":{"rotate":true,"elements":[{"x":135.0,"y":135.0,"diam":30.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"train":{"rotate":false,"elements":[{"xmin":30.0,"ymin":105.0,"xmax":240.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[240.0,270.0,180.0,210.0],"ycors":[105.0,30.0,30.0,105.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[195.0,270.0,300.0,195.0],"ycors":[180.0,180.0,210.0,210.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":0.0,"y":165.0,"diam":90.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":240.0,"y":225.0,"diam":30.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":90.0,"y":165.0,"diam":90.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":195.0,"y":225.0,"diam":30.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":0.0,"ymin":30.0,"xmax":105.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":30.0,"ymin":60.0,"xmax":75.0,"ymax":105.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[195.0,165.0,240.0,240.0],"ycors":[180.0,150.0,150.0,180.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":135.0,"ymin":75.0,"xmax":165.0,"ymax":105.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":225.0,"ymin":120.0,"xmax":255.0,"ymax":150.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":30.0,"ymin":203.0,"xmax":150.0,"ymax":218.0,"type":"rectangle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"tree":{"rotate":false,"elements":[{"x":118.0,"y":3.0,"diam":94.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":120.0,"ymin":195.0,"xmax":180.0,"ymax":300.0,"type":"rectangle","color":"rgba(157, 110, 72, 1.0)","filled":true,"marked":false},{"x":65.0,"y":21.0,"diam":108.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":116.0,"y":41.0,"diam":127.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":45.0,"y":90.0,"diam":120.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":104.0,"y":74.0,"diam":152.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"triangle":{"rotate":false,"elements":[{"xcors":[150.0,15.0,285.0],"ycors":[30.0,255.0,255.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"triangle 2":{"rotate":false,"elements":[{"xcors":[150.0,15.0,285.0],"ycors":[30.0,255.0,255.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[151.0,225.0,75.0],"ycors":[99.0,223.0,224.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false}]},"truck":{"rotate":true,"elements":[{"xmin":4.0,"ymin":45.0,"xmax":195.0,"ymax":187.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[296.0,296.0,259.0,244.0,208.0,207.0],"ycors":[193.0,150.0,134.0,104.0,104.0,194.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xmin":195.0,"ymin":60.0,"xmax":195.0,"ymax":105.0,"type":"rectangle","color":"rgba(255, 255, 255, 1.0)","filled":true,"marked":false},{"xcors":[238.0,252.0,219.0,218.0],"ycors":[112.0,141.0,141.0,112.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":234.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xmin":181.0,"ymin":185.0,"xmax":214.0,"ymax":194.0,"type":"rectangle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":144.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":24.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x":24.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x":144.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x":234.0,"y":174.0,"diam":42.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"turtle":{"rotate":true,"elements":[{"xcors":[215.0,240.0,246.0,228.0,215.0,193.0],"ycors":[204.0,233.0,254.0,266.0,252.0,210.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[195.0,225.0,245.0,260.0,269.0,261.0,240.0,225.0,210.0],"ycors":[90.0,75.0,75.0,89.0,108.0,124.0,105.0,105.0,105.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[105.0,75.0,55.0,40.0,31.0,39.0,60.0,75.0,90.0],"ycors":[90.0,75.0,75.0,89.0,108.0,124.0,105.0,105.0,105.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[132.0,134.0,107.0,108.0,150.0,192.0,192.0,169.0,172.0],"ycors":[85.0,64.0,51.0,17.0,2.0,18.0,52.0,65.0,87.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[85.0,60.0,54.0,72.0,85.0,107.0],"ycors":[204.0,233.0,254.0,266.0,252.0,210.0],"type":"polygon","color":"rgba(89, 176, 60, 1.0)","filled":true,"marked":false},{"xcors":[119.0,179.0,209.0,224.0,220.0,175.0,128.0,81.0,74.0,88.0],"ycors":[75.0,75.0,101.0,135.0,225.0,261.0,261.0,224.0,135.0,99.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"wheel":{"rotate":false,"elements":[{"x":3.0,"y":3.0,"diam":294.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x":30.0,"y":30.0,"diam":240.0,"type":"circle","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"x1":150.0,"y1":285.0,"x2":150.0,"y2":15.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":15.0,"y1":150.0,"x2":285.0,"y2":150.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x":120.0,"y":120.0,"diam":60.0,"type":"circle","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"x1":216.0,"y1":40.0,"x2":79.0,"y2":269.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":40.0,"y1":84.0,"x2":269.0,"y2":221.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":40.0,"y1":216.0,"x2":269.0,"y2":79.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true},{"x1":84.0,"y1":40.0,"x2":221.0,"y2":269.0,"type":"line","color":"rgba(141, 141, 141, 1.0)","filled":false,"marked":true}]},"wolf":{"rotate":false,"elements":[{"xcors":[253.0,245.0,245.0],"ycors":[133.0,131.0,133.0],"type":"polygon","color":"rgba(0, 0, 0, 1.0)","filled":true,"marked":false},{"xcors":[2.0,13.0,30.0,38.0,38.0,20.0,20.0,27.0,38.0,40.0,31.0,31.0,60.0,68.0,75.0,66.0,65.0,82.0,84.0,100.0,103.0,77.0,79.0,100.0,98.0,119.0,143.0,160.0,166.0,172.0,173.0,167.0,160.0,154.0,169.0,178.0,186.0,198.0,200.0,217.0,219.0,207.0,195.0,192.0,210.0,227.0,242.0,259.0,284.0,277.0,293.0,299.0,297.0,273.0,270.0],"ycors":[194.0,197.0,191.0,193.0,205.0,226.0,257.0,265.0,266.0,260.0,253.0,230.0,206.0,198.0,209.0,228.0,243.0,261.0,268.0,267.0,261.0,239.0,231.0,207.0,196.0,201.0,202.0,195.0,210.0,213.0,238.0,251.0,248.0,265.0,264.0,247.0,240.0,260.0,271.0,271.0,262.0,258.0,230.0,198.0,184.0,164.0,144.0,145.0,151.0,141.0,140.0,134.0,127.0,119.0,105.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[-1.0,14.0,36.0,40.0,53.0,82.0,134.0,159.0,188.0,227.0,236.0,238.0,268.0,269.0,281.0,269.0,269.0],"ycors":[195.0,180.0,166.0,153.0,140.0,131.0,133.0,126.0,115.0,108.0,102.0,98.0,86.0,92.0,87.0,103.0,113.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]},"x":{"rotate":false,"elements":[{"xcors":[270.0,225.0,30.0,75.0],"ycors":[75.0,30.0,225.0,270.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true},{"xcors":[30.0,75.0,270.0,225.0],"ycors":[75.0,30.0,225.0,270.0],"type":"polygon","color":"rgba(141, 141, 141, 1.0)","filled":true,"marked":true}]}}, {"default":{}}, 1);925function saveGameState() {926 var arr = [];927 for (i = 0; i <= 84; i++) {928 arr.push(Globals.getGlobal(i));929 }930 return { success: true, state: JSON.stringify(arr) };931}932function restoreGameState(state) {933 var arr = JSON.parse(state);934 for (i = 0; i <= 84; i++) {935 Globals.setGlobal(i, arr[i]);936 }937 Globals.setGlobal(66, true); // Ignore analysis status938 setupNewRun();939 return { success: true };...

Full Screen

Full Screen

search-component.js

Source:search-component.js Github

copy

Full Screen

...10 super(props);11 this.pressEnter = this.pressEnter.bind(this);12 this.description = React.createRef();13 this.state = {14 tag: getGlobal('search').search_arguments.tag.field,15 date_start: getGlobal('search').search_arguments.date_start.field,16 date_end: getGlobal('search').search_arguments.date_end.field,17 description: getGlobal('search').search_arguments.description.field,18 rank: getGlobal('search').search_arguments.rank.field,19 searchbydate: getGlobal('search').search_arguments.searchbydate.field,20 search_message: this.props.searchMessage,21 all_tags: this.props.all_tags22 }23 }24 componentDidMount() {25 getGlobal('enterTracker').tag_insert_tracker = false;26 getGlobal('enterTracker').component_tracker = "search";27 document.addEventListener("keydown", this.pressEnter, false);28 this.setState({29 tag: getGlobal('search').search_arguments.tag.field,30 date_start: getGlobal('search').search_arguments.date_start.field,31 date_end: getGlobal('search').search_arguments.date_end.field,32 description: getGlobal('search').search_arguments.description.field,33 rank: getGlobal('search').search_arguments.rank.field,34 searchbydate: getGlobal('search').search_arguments.searchbydate.field35 });36 }37 filter = memoize(38 (propTags, stateTags) => propTags.filter(item => stateTags.includes(item))39 );40 componentWillUnmount() {41 getGlobal('search').search_arguments.description.field = this.description.value;42 getGlobal('enterTracker').tag_insert_tracker = false;43 getGlobal('enterTracker').component_tracker = "";44 document.removeEventListener("keydown", this.pressEnter, false);45 }46 pressEnter(event) {47 if (event.keyCode === 13 && getGlobal('enterTracker').tag_insert_tracker === false && getGlobal('enterTracker').component_tracker === "search") {48 this.handleSearch();49 }50 }51 handleSearch() {52 let description = this.description.value;53 if ((this.state.tag === null || this.state.tag.length === 0) && this.state.searchbydate === false && description === "" && (this.state.rank === null || this.state.rank.length === 0)) {54 alert("Please enter something to search for.");55 } else {56 if (this.state.searchbydate === true) {57 if (this.state.date_end && this.state.date_start) {58 let start_set_to_midnight = this.state.date_start;59 if (getGlobal('search').view_all === true) {60 start_set_to_midnight.setHours(0, 0, 0, 0);61 }62 let end_set_to_midnight = this.state.date_end;63 if (getGlobal('search').view_all === true) {64 end_set_to_midnight.setHours(0, 0, 0, 0);65 }66 let start_date_in_ms = typeof start_set_to_midnight !== "number" ? start_set_to_midnight.getTime() : start_set_to_midnight;67 let end_date_in_ms = typeof end_set_to_midnight !== "number" ? end_set_to_midnight.getTime() : end_set_to_midnight;68 let test_start = start_date_in_ms;69 let test_end = end_date_in_ms;70 if (test_start > test_end) {71 start_date_in_ms = test_end;72 end_date_in_ms = test_start;73 }74 getGlobal('search').search_arguments.date_start.searched = start_date_in_ms;75 getGlobal('search').search_arguments.date_end.searched = end_date_in_ms;76 this.props.confirmTimelineSearch({tag: this.state.tag, date_start: start_date_in_ms, date_end: end_date_in_ms, description: description, rank: this.state.rank, searchbydate: this.state.searchbydate}, false, true);77 } else {78 alert("You must have a valid start and end date.")79 }80 } else {81 this.props.confirmTimelineSearch({tag: this.state.tag, date_start: "", date_end: "", description: description, rank: this.state.rank, searchbydate: this.state.searchbydate}, false, true);82 }83 getGlobal('search').search_arguments.description.field = description;84 }85 }86 resetSearch() {87 this.setState({ tag: null, date_start: new Date(), date_end: new Date(), description: "", rank: null, searchbydate: false });88 this.description.value = "";89 getGlobal('search').search_arguments.tag = { field: null, searched: null };90 getGlobal('search').search_arguments.date_start = { field: "", searched: "" };91 getGlobal('search').search_arguments.date_end = { field: "", searched: "" };92 getGlobal('search').search_arguments.description = { field: "", searched: "" };93 getGlobal('search').search_arguments.rank = { field: null, searched: null };94 getGlobal('search').search_arguments.searchbydate = { field: false, searched: false };95 getGlobal('enterTracker').tag_insert_tracker = false;96 getGlobal('enterTracker').component_tracker = "search";97 }98 handle_date_start_Change(date) {99 this.setState({ date_start: date }, function() {100 getGlobal('search').search_arguments.date_start.field = this.state.date_start;101 getGlobal('enterTracker').tag_insert_tracker = false;102 getGlobal('enterTracker').component_tracker = "search";103 });104 }105 handle_date_end_Change(date) {106 this.setState({ date_end: date }, function() {107 getGlobal('search').search_arguments.date_end.field = this.state.date_end;108 getGlobal('enterTracker').tag_insert_tracker = false;109 getGlobal('enterTracker').component_tracker = "search";110 });111 }112 handle_description_Change(event) {113 let description = event.target.value;114 this.setState({ description: description }, function() {115 getGlobal('search').search_arguments.description.field = description;116 });117 }118 searchByDate(searchby) {119 this.setState({ searchbydate: searchby }, function() {120 getGlobal('search').search_arguments.searchbydate.field = this.state.searchbydate;121 if (searchby === false) {122 this.setState({ date_start: "", date_end: "" }, function() {123 getGlobal('search').search_arguments.date_start.field = this.state.date_start;124 getGlobal('search').search_arguments.date_end.field = this.state.date_end;125 getGlobal('enterTracker').tag_insert_tracker = false;126 getGlobal('enterTracker').component_tracker = "search";127 });128 }129 });130 }131 handle_tracker_onClick() {132 getGlobal('enterTracker').tag_insert_tracker = false;133 getGlobal('enterTracker').component_tracker = "search";134 }135 render() {136 const { rank, tag, all_tags } = this.state;137 const options = [138 { value: '5', label: 'Very Important' },139 { value: '4', label: 'Important' },140 { value: '3', label: 'Average' },141 { value: '2', label: 'Less Important' },142 { value: '1', label: 'Least Important' }143 ];144 const updatedTags = this.filter(this.props.all_tags, all_tags);145 return (146 <div>147 <div className="theader">148 <h3>Searching timeline: <div className="float_right"><button className="button" onClick={this.props.viewSearch}>Hide</button></div></h3>149 <Select150 styles={Utilities.reactSelectStyles(this.props.cssTemplate)}151 value={tag}152 onChange={value => this.setState({ tag: value }, function() {153 getGlobal('search').search_arguments.tag.field = value;154 getGlobal('enterTracker').tag_insert_tracker = false;155 getGlobal('enterTracker').component_tracker = "search";156 })}157 options={Utilities.createTagOptions(updatedTags)}158 closeMenuOnSelect={false}159 placeholder="Select a tag (or tags)..."160 isMulti161 />162 <br/>163 { this.state.searchbydate === true ?164 <div>165 Select a date range: <DatePicker selected={this.state.date_start} onChange={this.handle_date_start_Change.bind(this)} /> to <DatePicker selected={this.state.date_end} onChange={this.handle_date_end_Change.bind(this)} />166 <br/>167 <button className="button" onClick={this.searchByDate.bind(this, false)}>Disable date search</button>168 </div>169 : <div><button className="button" onClick={this.searchByDate.bind(this, true)}>Search by date</button></div>170 }171 <br/>172 <Select173 styles={Utilities.reactSelectStyles(this.props.cssTemplate)}174 value={rank}175 onChange={value => this.setState({ rank: value }, function() {176 getGlobal('search').search_arguments.rank.field = value;177 getGlobal('enterTracker').tag_insert_tracker = false;178 getGlobal('enterTracker').component_tracker = "search";179 })}180 options={options}181 closeMenuOnSelect={false}182 placeholder="Select a rank (or rank)..."183 isMulti184 />185 <br/>186 Words in entry: <input ref={description => this.description = description} onBlur={this.handle_description_Change.bind(this)} onClick={this.handle_tracker_onClick.bind(this)} defaultValue={this.state.description} />187 <br/>188 <button className="button" onClick={this.handleSearch.bind(this)}>Search</button> <button className="button" onClick={this.resetSearch.bind(this)}>Reset</button>189 </div>190 { this.state.search_message !== "" ? <div>{this.state.search_message}</div> : "" }191 </div>192 )...

Full Screen

Full Screen

contract.mjs

Source:contract.mjs Github

copy

Full Screen

...32 const creatorPk = addressToPk(creator.address);33 // Setup application34 contract.setupApplication(master);35 assert.isDefined(contract.getApplicationId());36 assert.equal(getGlobal(ASK_PRICE), 0);37 assert.equal(getGlobal(BIDS_AMOUNT), 0);38 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));39 assert.deepEqual(getGlobal(ESCROW_ADDRESS), new Uint8Array(32));40 assert.deepEqual(getGlobal(CREATOR_ADDRESS), creatorPk);41 // Setup escrow account42 contract.setupEscrow();43 // Verify escrow storage44 assert.deepEqual(getGlobal(ESCROW_ADDRESS), addressToPk(contract.getEscrowAddress()));45 // Opt-in46 contract.optIn(master.address);47 // First ask offer48 contract.setPrice(master, 100, {49 addNFT: true50 });51 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));52 assert.equal(getGlobal(ASK_PRICE), 100);53 assert.equal(getGlobal(BIDS_AMOUNT), 0);54 // Update ask offer55 contract.setPrice(master, 1000);56 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));57 assert.equal(getGlobal(ASK_PRICE), 1000);58 assert.equal(getGlobal(BIDS_AMOUNT), 0);59 // First bid offer60 contract.optIn(thirdParty.address);61 assert.equal(getLocal(thirdParty.address, BID_PRICE), 0);62 assert.equal(getGlobal(BIDS_AMOUNT), 0);63 contract.bid(thirdParty, 100);64 assert.equal(getLocal(thirdParty.address, BID_PRICE), 100);65 assert.equal(getGlobal(BIDS_AMOUNT), 1);66 // Increase bid offer67 contract.bid(thirdParty, 900);68 assert.equal(getLocal(thirdParty.address, BID_PRICE), 900);69 assert.equal(getGlobal(BIDS_AMOUNT), 1);70 // Decrease bid offer71 contract.bid(thirdParty, 800);72 assert.equal(getLocal(thirdParty.address, BID_PRICE), 800);73 assert.equal(getGlobal(BIDS_AMOUNT), 1);74 // Remove ask offer and withdraw NFT75 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));76 assert.equal(getGlobal(ASK_PRICE), 1000);77 assert.equal(getGlobal(BIDS_AMOUNT), 1);78 contract.setPrice(master, 0, {79 removeNFT: true80 });81 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));82 assert.equal(getGlobal(ASK_PRICE), 0);83 assert.equal(getGlobal(BIDS_AMOUNT), 1);84 // Sell now with direct NFT transfer85 contract.sellNow(master, thirdParty.address, {86 directTransfer: true87 });88 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));89 assert.equal(getGlobal(ASK_PRICE), 0);90 assert.equal(getGlobal(BIDS_AMOUNT), 0);91 assert.equal(getLocal(thirdParty.address, BID_PRICE), 0);92 // First ask offer93 contract.setPrice(thirdParty, 1000, {94 addNFT: true95 });96 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(thirdParty.address));97 assert.equal(getGlobal(ASK_PRICE), 1000);98 assert.equal(getGlobal(BIDS_AMOUNT), 0);99 assert.equal(getLocal(master.address, BID_PRICE), 0);100 // Increase bid offer101 contract.bid(master, 100);102 assert.equal(getGlobal(BIDS_AMOUNT), 1);103 assert.equal(getLocal(master.address, BID_PRICE), 100);104 // Buy now while increasing bid offer105 contract.buyNow(master, {});106 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));107 assert.equal(getGlobal(ASK_PRICE), 0);108 assert.equal(getGlobal(BIDS_AMOUNT), 0);109 assert.equal(getLocal(master.address, BID_PRICE), 0);110 // First ask offer111 contract.setPrice(master, 1000, {112 addNFT: true113 });114 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));115 assert.equal(getGlobal(ASK_PRICE), 1000);116 // Increase bid offer117 contract.bid(thirdParty, 900);118 assert.equal(getGlobal(BIDS_AMOUNT), 1);119 assert.equal(getLocal(thirdParty.address, BID_PRICE), 900);120 // Decrease ask offer121 contract.setPrice(master, 800);122 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));123 assert.equal(getGlobal(ASK_PRICE), 800);124 // Buy now while decreasing bid offer125 contract.buyNow(thirdParty);126 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));127 assert.equal(getGlobal(ASK_PRICE), 0);128 assert.equal(getGlobal(BIDS_AMOUNT), 0);129 assert.equal(getLocal(thirdParty.address, BID_PRICE), 0);130 // Create bid offer without ask offer131 contract.bid(thirdParty, 900);132 assert.equal(getGlobal(BIDS_AMOUNT), 1);133 assert.equal(getLocal(thirdParty.address, BID_PRICE), 900);134 // First ask offer135 contract.setPrice(master, 1000, {136 addNFT: true137 });138 assert.deepEqual(getGlobal(OWNER_ADDRESS), addressToPk(master.address));139 assert.equal(getGlobal(ASK_PRICE), 1000);140 assert.equal(getGlobal(BIDS_AMOUNT), 1);141 assert.equal(getLocal(thirdParty.address, BID_PRICE), 900);142 // Sell now with direct NFT transfer143 contract.sellNow(master, thirdParty.address);144 assert.deepEqual(getGlobal(OWNER_ADDRESS), new Uint8Array(32));145 assert.equal(getGlobal(ASK_PRICE), 0);146 assert.equal(getGlobal(BIDS_AMOUNT), 0);147 assert.equal(getLocal(thirdParty.address, BID_PRICE), 0);148 });...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...14console.log('read local data')15let tmp = null16tmp = window.localStorage.gunLeftNum17if (tmp == undefined) {18 remote.getGlobal('charge').gunLeftNum = GUN_LEFT_DEFAULT_NUM 19} else {20 remote.getGlobal('charge').gunLeftNum = tmp21}22tmp = window.localStorage.gunLeftName23if (tmp == undefined) {24 remote.getGlobal('charge').gunLeftName = GUN_LEFT_DEFAULT_NAME 25} else {26 remote.getGlobal('charge').gunLeftName = tmp27}28tmp = window.localStorage.gunRightNum29if (tmp == undefined) {30 remote.getGlobal('charge').gunRightNum = GUN_RIGHT_DEFAULT_NUM 31} else {32 remote.getGlobal('charge').gunRightNum = tmp33}34tmp = window.localStorage.gunRightName35if (tmp == undefined) {36 remote.getGlobal('charge').gunRightName = GUN_RIGHT_DEFAULT_NAME 37} else {38 remote.getGlobal('charge').gunRightName = tmp39}40tmp = window.localStorage.appServerIp41if (tmp == undefined) {42 remote.getGlobal('charge').appServerIp = APP_SERVER_DEFAULT_IP 43} else {44 remote.getGlobal('charge').appServerIp = tmp45}46tmp = window.localStorage.appServerPort47if (tmp == undefined) {48 remote.getGlobal('charge').appServerPort = APP_SERVER_DEFAULT_PORT 49} else {50 remote.getGlobal('charge').appServerPort = tmp51}52tmp = window.localStorage.stationServerPort53if (tmp == undefined) {54 remote.getGlobal('charge').stationServerPort = STATION_SERVER_DEFAULT_PORT 55} else {56 remote.getGlobal('charge').stationServerPort = tmp 57}58tmp = window.localStorage.qrcodeTime59if (tmp == undefined) {60 remote.getGlobal('charge').qrcodeTime = QRCODE_DEFAULT_TIME 61} else {62 remote.getGlobal('charge').qrcodeTime = tmp 63}64tmp = window.localStorage.adverTime65if (tmp == undefined) {66 remote.getGlobal('charge').adverTime = ADVER_DEFAULT_TIME 67} else {68 remote.getGlobal('charge').adverTime = tmp 69}70tmp = window.localStorage.gunLeftAddr71if (tmp == undefined) {72 remote.getGlobal('charge').gunLeftAddr = GUN_LEFT_DEFAULT_ADDR 73} else {74 remote.getGlobal('charge').gunLeftAddr = tmp75}76tmp = window.localStorage.gunRightAddr77if (tmp == undefined) {78 remote.getGlobal('charge').gunRightAddr = GUN_RIGHT_DEFAULT_ADDR79} else {80 remote.getGlobal('charge').gunRightAddr = tmp 81}82console.log('gun left num: ' + remote.getGlobal('charge').gunLeftNum)83console.log('gun left name: ' + remote.getGlobal('charge').gunLeftName) 84console.log('gun right num: ' + remote.getGlobal('charge').gunRightNum)85console.log('gun right name: ' + remote.getGlobal('charge').gunRightName)86console.log('app server ip: ' + remote.getGlobal('charge').appServerIp)87console.log('app server port: ' + remote.getGlobal('charge').appServerPort)88console.log('station server port: ' + remote.getGlobal('charge').stationServerPort)89console.log('qrcode time: ' + remote.getGlobal('charge').qrcodeTime)90console.log('adver time: ' + remote.getGlobal('charge').adverTime)91console.log('gun left addr: ' + remote.getGlobal('charge').gunLeftAddr) 92console.log('gun right addr: ' + remote.getGlobal('charge').gunRightAddr)93// 设置二维码图片和文字94document.getElementById("left_name").innerHTML = remote.getGlobal('charge').gunLeftName95document.getElementById("right_name").innerHTML = remote.getGlobal('charge').gunRightName96document.getElementById("left_qrcode").src= "./qrcode/" + remote.getGlobal('charge').gunLeftNum + ".png";97document.getElementById("right_qrcode").src= "./qrcode/" + remote.getGlobal('charge').gunRightNum + ".png";98var indexTimer = setTimeout(function() {99 window.location.href = 'adver.html'100}, remote.getGlobal('charge').qrcodeTime * 1000)101setTimeout(function() {102 ipcRenderer.send('index-done', null)103}, 1000)104document.onkeydown = function (event) {105 var e = event || window.event || arguments.callee.caller.arguments[0];106 // Esc107 if (e && e.keyCode == 27) {108 clearTimeout(indexTimer)109 window.location.href = 'config.html'110 }...

Full Screen

Full Screen

adm-config.js

Source:adm-config.js Github

copy

Full Screen

2module.exports = {3 name: 'config',4 description: 'Shows all my configs options.',5 async execute(message, config, Discord, DiscordBot) {6 let embed = embedFormat(config.getGlobal(), Discord)7 .setTitle(`LeivaaDiscordJS Configs Commands:`)8 .addFields(9 { name: `${config.getGlobal().prefix}config loadDefaults`, value: `> ${DiscordBot.commands.get('loadDefaults').description}\n > **Usage**: \`${config.getGlobal().prefix}config loadDefaults\``},10 { name: `${config.getGlobal().prefix}config display`, value: `> ${DiscordBot.commands.get('cfg-display').description}\n > **Usage**: \`${config.getGlobal().prefix}config display\``},11 { name: `${config.getGlobal().prefix}config prefix`, value: `> ${DiscordBot.commands.get('prefix').description}\n > **Usage**: \`${config.getGlobal().prefix}config prefix {new_prefix}\``},12 { name: `${config.getGlobal().prefix}config maxDeleting`, value: `> ${DiscordBot.commands.get('maxDeleting').description}\n > **Usage**: \`${config.getGlobal().prefix}config maxDeleting {Number between 0 and 99}\``},13 { name: `${config.getGlobal().prefix}config colors`, value: `> ${DiscordBot.commands.get('colors').description}\n > **Usage**: \`${config.getGlobal().prefix}config colors\``},14 { name: `${config.getGlobal().prefix}config color`, value: `> ${DiscordBot.commands.get('color').description}\n > **Usage**: \`${config.getGlobal().prefix}config color {new_color}\``},15 { name: `${config.getGlobal().prefix}config welcomeChannel`, value: `> ${DiscordBot.commands.get('welcomeChannel').description}\n > **Usage**: \`${config.getGlobal().prefix}config welcomeChannel {channel_name/#channel}\``},16 { name: `${config.getGlobal().prefix}config welcomeMsg`, value: `> ${DiscordBot.commands.get('welcomeMsg').description}\n > **Usage**: \`${config.getGlobal().prefix}config welcomeMsg {new_msg}\``},17 { name: `${config.getGlobal().prefix}config reactionRole`, value: `> ${DiscordBot.commands.get('cfg-reactionRole').description}\n > **Usage**: \`${config.getGlobal().prefix}config reactionRole\``},18 )19 message.channel.send(embed);20 }...

Full Screen

Full Screen

print.js

Source:print.js Github

copy

Full Screen

1const { remote } = require('electron');2export const print = remote.getGlobal('services').print.print;3export const printInit = remote.getGlobal('services').print.init;4// export const omzetbonPrint = remote.getGlobal('services').print.omzetbonPrint;5export const printKitchen = remote.getGlobal('services').print.printKitchen;6export const getPrinters = remote.getGlobal('services').print.getPrinters;7export const printerSet = remote.getGlobal('services').print.printerSet;8export const extraPrinterSet = remote.getGlobal('services').print9 .extraPrinterSet;10export const extraPrinterDelete = remote.getGlobal('services').print11 .extraPrinterDelete;12export const printperdishSettingsGet = remote.getGlobal('services').print13 .printperdishSettingsGet;14export const printperdishSettingsSet = remote.getGlobal('services').print15 .printperdishSettingsSet;16export const printerGet = remote.getGlobal('services').print.printerGet;17export const printStatusSet = remote.getGlobal('services').print.printStatusSet;18export const printStatusGet = remote.getGlobal('services').print.printStatusGet;19export const accountGet = remote.getGlobal('services').print.accountGet;20export const accountSet = remote.getGlobal('services').print.accountSet;21export const kitchenTextSet = remote.getGlobal('services').print.kitchenTextSet;22export const kitchenTextGet = remote.getGlobal('services').print.kitchenTextGet;23export const kitchenTextDelete = remote.getGlobal('services').print24 .kitchenTextDelete;25export const lobbyTextGet = remote.getGlobal('services').print.lobbyTextGet;26export const lobbyTextSet = remote.getGlobal('services').print.lobbyTextSet;27export const lobbyTextDelete = remote.getGlobal('services').print28 .lobbyTextDelete;29export const bonAantalGet = remote.getGlobal('services').print.bonAantalGet;30export const bonAantalSet = remote.getGlobal('services').print.bonAantalSet;31export const volumeSet = remote.getGlobal('services').print.volumeSet;...

Full Screen

Full Screen

global-help.js

Source:global-help.js Github

copy

Full Screen

...3 name: 'help',4 description: 'Show all my commands',5 async execute(message, config, Discord, DiscordBot) {6 config.reload();7 let embed =embedFormat(config.getGlobal(), Discord)8 .setTitle(`LeivaaDiscordJS Commands:`)9 .addFields(10 { name: `${config.getGlobal().prefix}ping`, value: `> Just response 🏓 pong! \n > **Usage**: \`${ config.getGlobal().prefix }ping\``},11 { name: `${config.getGlobal().prefix}poll`, value: `> ${DiscordBot.commands.get('poll').description} \n > **Usage**: \`${ config.getGlobal().prefix }poll {Tittle}\``},12 { name: `${config.getGlobal().prefix}clear`, value: `> ${DiscordBot.commands.get('clear').description}\n > **Usage**: \`${config.getGlobal().prefix}clear \`${config.prefix}config maxDeleting {Number between 0 and 99}\``},13 { name: `${config.getGlobal().prefix}kick`, value: `> ${DiscordBot.commands.get('kick').description}\n > **Usage**: \`${ config.getGlobal().prefix }kick {@username}\``},14 { name: `${config.getGlobal().prefix}ban`, value: `> ${DiscordBot.commands.get('ban').description}\n > **Usage**: \`${ config.getGlobal().prefix }ban {@username} {Reason}\``},15 { name: `${config.getGlobal().prefix}config`, value: `> ${DiscordBot.commands.get('config').description} \n > **Usage**: \`${ config.getGlobal().prefix }config\``},16 { name: `${config.getGlobal().prefix}reactionRole`, value: `> ${DiscordBot.commands.get('adm-reactionRole').description} \n > **Usage**: \`${config.getGlobal().prefix}reactionRole\``},17 18 19 )20 return message.channel.send(embed);21 }...

Full Screen

Full Screen

globalSettings.js

Source:globalSettings.js Github

copy

Full Screen

...8const KEYCHAIN_INTEGRITY_STATE = 'keychainIntegrityState';9const AUTH_TIMELOCK = 'authTimelock';10const PIN_AUTH_ATTEMPTS_LEFT = 'pinAuthAttemptsLeft';11export const getKeychainIntegrityState = () =>12 getGlobal(KEYCHAIN_INTEGRITY_STATE, null);13export const saveKeychainIntegrityState = state =>14 saveGlobal(KEYCHAIN_INTEGRITY_STATE, state);15export const getAuthTimelock = () => getGlobal(AUTH_TIMELOCK, null);16export const saveAuthTimelock = ts => saveGlobal(AUTH_TIMELOCK, ts);17export const getPinAuthAttemptsLeft = () =>18 getGlobal(PIN_AUTH_ATTEMPTS_LEFT, null);19export const savePinAuthAttemptsLeft = amount =>20 saveGlobal(PIN_AUTH_ATTEMPTS_LEFT, amount);21export const getLanguage = () => getGlobal(LANGUAGE, 'en');22export const saveLanguage = language => saveGlobal(LANGUAGE, language);23export const getNetwork = () => getGlobal(NETWORK, networkTypes.sokol);24export const saveNetwork = network => saveGlobal(NETWORK, network);25export const getKeyboardHeight = () => getGlobal(KEYBOARD_HEIGHT, null);26export const setKeyboardHeight = height => saveGlobal(KEYBOARD_HEIGHT, height);27export const getNativeCurrency = () => getGlobal(NATIVE_CURRENCY, 'USD');28export const saveNativeCurrency = nativeCurrency =>29 saveGlobal(NATIVE_CURRENCY, nativeCurrency);30export const getImageMetadata = () => getGlobal(IMAGE_METADATA, {});31export const saveImageMetadata = imageMetadata =>...

Full Screen

Full Screen

Jest Testing Tutorial

LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.

Chapters

  1. What is Jest Framework
  2. Advantages of Jest - Jest has 3,898,000 GitHub repositories, as mentioned on its official website. Learn what makes Jest special and why Jest has gained popularity among the testing and developer community.
  3. Jest Installation - All the prerequisites and set up steps needed to help you start Jest automation testing.
  4. Using Jest with NodeJS Project - Learn how to leverage Jest framework to automate testing using a NodeJS Project.
  5. Writing First Test for Jest Framework - Get started with code-based tutorial to help you write and execute your first Jest framework testing script.
  6. Jest Vocabulary - Learn the industry renowned and official jargons of the Jest framework by digging deep into the Jest vocabulary.
  7. Unit Testing with Jest - Step-by-step tutorial to help you execute unit testing with Jest framework.
  8. Jest Basics - Learn about the most pivotal and basic features which makes Jest special.
  9. Jest Parameterized Tests - Avoid code duplication and fasten automation testing with Jest using parameterized tests. Parameterization allows you to trigger the same test scenario over different test configurations by incorporating parameters.
  10. Jest Matchers - Enforce assertions better with the help of matchers. Matchers help you compare the actual output with the expected one. Here is an example to see if the object is acquired from the correct class or not. -

|<p>it('check_object_of_Car', () => {</p><p> expect(newCar()).toBeInstanceOf(Car);</p><p> });</p>| | :- |

  1. Jest Hooks: Setup and Teardown - Learn how to set up conditions which needs to be followed by the test execution and incorporate a tear down function to free resources after the execution is complete.
  2. Jest Code Coverage - Unsure there is no code left unchecked in your application. Jest gives a specific flag called --coverage to help you generate code coverage.
  3. HTML Report Generation - Learn how to create a comprehensive HTML report based on your Jest test execution.
  4. Testing React app using Jest Framework - Learn how to test your react web-application with Jest framework in this detailed Jest tutorial.
  5. Test using LambdaTest cloud Selenium Grid - Run your Jest testing script over LambdaTest cloud-based platform and leverage parallel testing to help trim down your test execution time.
  6. Snapshot Testing for React Front Ends - Capture screenshots of your react based web-application and compare them automatically for visual anomalies with the help of Jest tutorial.
  7. Bonus: Import ES modules with Jest - ES modules are also known as ECMAScript modules. Learn how to best use them by importing in your Jest testing scripts.
  8. Jest vs Mocha vs Jasmine - Learn the key differences between the most popular JavaScript-based testing frameworks i.e. Jest, Mocha, and Jasmine.
  9. Jest FAQs(Frequently Asked Questions) - Explore the most commonly asked questions around Jest framework, with their answers.

Run Jest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful