diff --git a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/util/HelperMethodGenerator.java b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/util/HelperMethodGenerator.java index b1c8dc332f..327543ea15 100644 --- a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/util/HelperMethodGenerator.java +++ b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/util/HelperMethodGenerator.java @@ -14,6 +14,7 @@ import org.json.JSONObject; import de.fhg.iais.roberta.mode.general.ListElementOperations; +import de.fhg.iais.roberta.util.dbc.Assert; import de.fhg.iais.roberta.util.dbc.DbcException; import de.fhg.iais.roberta.util.syntax.FunctionNames; @@ -137,6 +138,17 @@ public String getHelperMethodDeclarations(Set> usedMethods) { * @return the helper method definitions */ public String getHelperMethodDefinitions(Set> usedMethods) { + return getHelperMethodDefinitions(usedMethods, 1); + } + + /** + * Same as getHelperMethodDefinitions(Set> usedMethods) + * but allows specifiying number of newLines + * + */ + public String getHelperMethodDefinitions(Set> usedMethods, int numOfNewLines) { + Assert.isTrue((numOfNewLines > 0)); + StringBuilder sb = new StringBuilder(); // guarantee order of methods for tests & consistency @@ -149,7 +161,9 @@ public String getHelperMethodDefinitions(Set> usedMethods) { for ( int sortedIndex : sortedIndices ) { String implementation = this.helperMethods.get(usedMethodsList.get(sortedIndex)); if ( implementation != null ) { // no implementation necessary for this method - sb.append('\n'); + for(int i =0; i= 0 + * @param vals Vals to be appended + * @return SourceBuilder + */ + public SourceBuilder addNLine(int numOfLines, Object... vals) { + Assert.isTrue(numOfLines >= 0); + + //if we want 2 blank lines we need 3 new lines + numOfLines += 1; + + final String sourceStringTrimmed = this.sb.toString().replace(" ", ""); + int newLineCounter = 0; + + //an Empty SourceBuilder does not have to go to the next line to ensure given number of new lines + if(sourceStringTrimmed.isEmpty()) + newLineCounter++; + + for(int i=0; (i < numOfLines) && (sourceStringTrimmed.length() - 1 - i >= 0); i++){ + if(sourceStringTrimmed.charAt(sourceStringTrimmed.length() - 1 - i) == '\n') { + newLineCounter++; + }else { + break; + } + } + + for(int i=0; (i < (numOfLines - newLineCounter)); i++){ + nlI(); + } + + add(vals); + return this; + } + + public SourceBuilder addLine(Object... vals) { + return addNLine(0, vals); + } + + /** + * Makes sure there are a given amount of new Lines, 0 will make sure we are in the next + * Line 1 will make sure we have one Line white space, etc., + * + * @param numOfLines to ensure are there, will add additional new Lines if needed + * @return SourceBuilder + */ + public SourceBuilder ensureBlankLines(int numOfLines) { + return addNLine(numOfLines, ""); + } + + public SourceBuilder ensureNextLine() { + return ensureBlankLines(0); + } + public SourceBuilder add(Object... vals) { for ( Object val : vals ) { this.sb.append(val); diff --git a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/AbstractLanguageVisitor.java b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/AbstractLanguageVisitor.java index 6009753c25..e4c969c472 100644 --- a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/AbstractLanguageVisitor.java +++ b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/AbstractLanguageVisitor.java @@ -104,7 +104,7 @@ public void generateCode(boolean withWrapping) { generateProgramSuffix(withWrapping); } - private void generateProgramMainBody() { + protected void generateProgramMainBody() { this.programPhrases .stream() .filter(phrase -> phrase.getKind().getCategory() != Category.METHOD || phrase.getKind().hasName("METHOD_CALL")) diff --git a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/prog/AbstractPythonVisitor.java b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/prog/AbstractPythonVisitor.java index f5d84c3769..a3156516f4 100644 --- a/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/prog/AbstractPythonVisitor.java +++ b/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/visitor/lang/codegen/prog/AbstractPythonVisitor.java @@ -705,7 +705,6 @@ public Void visitIsListEmptyFunct(IsListEmptyFunct isListEmptyFunct) { @Override public Void visitMethodVoid(MethodVoid methodVoid) { - nlIndent(); this.src.add("def ", methodVoid.getCodeSafeMethodName(), '('); List paramList = new ArrayList<>(); for ( Expr l : methodVoid.getParameters().get() ) { @@ -731,7 +730,6 @@ public Void visitMethodVoid(MethodVoid methodVoid) { @Override public Void visitMethodReturn(MethodReturn methodReturn) { - nlIndent(); this.src.add("def ", methodReturn.getCodeSafeMethodName(), '('); List paramList = new ArrayList<>(); for ( Expr l : methodReturn.getParameters().get() ) { @@ -859,8 +857,7 @@ protected String getLanguageVarTypeFromBlocklyType(BlocklyType type) { protected void addPassIfProgramIsEmpty() { if ( this.getBean(UsedHardwareBean.class).isProgramEmpty() ) { - nlIndent(); - this.src.add("pass"); + this.src.addLine("pass"); } } @@ -1024,11 +1021,10 @@ public Void visitDebugAction(DebugAction debugAction) { @Override protected void generateProgramSuffix(boolean withWrapping) { - nlIndent(); - this.src.add("if __name__ == \"__main__\":"); + this.src.ensureBlankLines(1); + this.src.addLine("if __name__ == \"__main__\":"); incrIndentation(); - nlIndent(); - this.src.add("main()"); + this.src.addLine("main()"); decrIndentation(); } @@ -1043,15 +1039,6 @@ protected void generateProgramPrefix(boolean withWrapping) { visitorGenerateGlobalVariables(); } - @Override - protected void generateUserDefinedMethods() { - super.generateUserDefinedMethods(); - if ( this.programPhrases.stream().filter(phrase -> phrase.getKind().getCategory() == Category.METHOD && !phrase.getKind().hasName("METHOD_CALL")).count() > 0 ) { - nlIndent(); - } - } - - protected void collectVariablesForFunctionGlobals() { //since we are not in a scope yet these will be out global variables this.getBean(UsedHardwareBean.class).getInScopeVariables().forEach(s -> { @@ -1061,7 +1048,80 @@ protected void collectVariablesForFunctionGlobals() { @Override protected void visitorGenerateNN() { + this.src.ensureBlankLines(1); generateNNStuff("python"); } + //TODO Python-Code generation now always uses preceeding new line + //move these functions to abstarct language visitor once all other visiros are also changed + @Override + protected void generateProgramMainBody() { + //this is fine since MainTask[] will add a new line(this is a empty line when we add it to our code) + //we dont need an additional nlIndent() at the beginning of this + this.programPhrases + .stream() + .filter(phrase -> phrase.getKind().getCategory() != Category.METHOD || phrase.getKind().hasName("METHOD_CALL")) + .forEach(p -> { + src.ensureNextLine(); + p.accept(this); + }); + } + + @Override + protected void generateUserDefinedMethods() { + boolean isEmpty = this.programPhrases.stream().filter(phrase -> phrase.getKind().getCategory() == Category.METHOD && !phrase.getKind().hasName("METHOD_CALL")).count() == 0; + if ( !isEmpty ) { + this.programPhrases + .stream() + .filter(phrase -> phrase.getKind().getCategory() == Category.METHOD && !phrase.getKind().hasName("METHOD_CALL")) + .forEach(e -> { + src.ensureBlankLines(1); + e.accept(this); + }); + //we dont want to add training new lines anymore, but this is the easiest way to do it - python method style guide 2 new lines before and after method declaration + src.ensureBlankLines(1); + } + } + + /** + * this function should not be changed for a consitant behavour, this may lead to minor changes in visitors + * right now most visitors to this in the suffix, but some in the prefix -- make sure to remove helper function logic from visitor or methods will be + * generated more than once + * + * @return returns true if helper-methods were added + */ + @Override + protected void visitorGenerateHelperMethods(){ + String helperMethodImpls = + this + .getBean(CodeGeneratorSetupBean.class) + .getHelperMethodGenerator() + .getHelperMethodDefinitions(this.getBean(CodeGeneratorSetupBean.class).getUsedMethods(), 1) + .trim(); + + boolean hasMethods = helperMethodImpls != null && !helperMethodImpls.isEmpty(); + + if ( hasMethods ) { + this.src.ensureBlankLines(1); + this.src.addLine(helperMethodImpls); + this.src.ensureBlankLines(1); + } + } + + /** + * this will be called from inside MaiNTask since we need the variable list, right now a lot of visitors to bascially this with some varaition + * please unify this to one function + * @return was a user-method or variable added to the code + */ + @Override + protected void visitorGenerateUserVariablesAndMethods(MainTask mainTask) { + StmtList variables = mainTask.variables; + boolean hasVariables = !(variables.get().isEmpty()); + if ( hasVariables ) { + this.src.ensureNextLine(); + variables.accept(this); + } + generateUserDefinedMethods(); + } + } diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/controlFlowNestedLoops.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/controlFlowNestedLoops.py index 219915f64e..26192ece8f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/controlFlowNestedLoops.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/controlFlowNestedLoops.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/functionsBasic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/functionsBasic.py index e448c75950..9e6c6ae9d2 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/functionsBasic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/functionsBasic.py @@ -49,7 +49,6 @@ def ____retNumber2(___x): ___x = ___x / float(2) return ___x - def run(): global ___n1, ___b, ___n2, ___n3 # Basic Functions START diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperations.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperations.py index 4004ed50ee..f723ab2fff 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperations.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperations.py @@ -7,7 +7,6 @@ import os import time - def _median(l): l = sorted(l) l_len = len(l) @@ -24,6 +23,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperationsBasic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperationsBasic.py index 100a1bd3f9..219b34ab1d 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperationsBasic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/listOperationsBasic.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathAndLists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathAndLists.py index 30aad9d8bf..9288c89047 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathAndLists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathAndLists.py @@ -7,7 +7,6 @@ import os import time - def _median(l): l = sorted(l) l_len = len(l) @@ -24,6 +23,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathBasics.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathBasics.py index ec4d008e4b..1c4c948f88 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathBasics.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathBasics.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathFunctions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathFunctions.py index 20cc5eee50..6ba0013da5 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathFunctions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathFunctions.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-1.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-1.py index f035262316..f69c2487e4 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-1.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-1.py @@ -7,7 +7,6 @@ import os import time - def _isPrime(number): if(number == 0 or number == 1): return False diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-2.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-2.py index 4dda8e9fca..d98b0eb4ba 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-2.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathLogic-2.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathPower.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathPower.py index 892691d8a5..96985d64ef 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathPower.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/mathPower.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/neuralNetwork.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/neuralNetwork.py index a7ef1ef9fc..3596fad4cc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/neuralNetwork.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/neuralNetwork.py @@ -34,6 +34,7 @@ def ____nnStep(): ____h1n2 = ____b_h1n2 + ____n1 * ____w_n1_h1n2 + ____n3 * ____w_n3_h1n2 ____n2 = ____b_n2 + ____h1n1 * ____w_h1n1_n2 + ____h1n2 * ____w_h1n2_n2 ____n4 = ____b_n4 + ____h1n1 * ____w_h1n1_n4 + ____h1n2 * ____w_h1n2_n4 + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -60,7 +61,6 @@ def ____runNN(): ____nnStep() ___n = ____n2 - def run(): global ___n, ____n1, ____n3, ____h1n1, ____h1n2, ____b_h1n1, ____w_n1_h1n1, ____w_n3_h1n1, ____b_h1n2, ____w_n1_h1n2, ____w_n3_h1n2, ____b_n2, ____w_h1n1_n2, ____w_h1n2_n2, ____b_n4, ____w_h1n1_n4, ____w_h1n2_n4 ____runNN() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/orderOfOperations.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/orderOfOperations.py index 2dff4b09f2..7e205114f6 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/orderOfOperations.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/orderOfOperations.py @@ -7,7 +7,6 @@ import os import time - def _randInt(min_val, max_val): val = int.from_bytes(os.urandom(4), byteorder='big') if min_val < max_val: @@ -78,7 +77,6 @@ def ____divisionOperations(___item5): ___item5 = ( ( 6 / float(_randInt(10 - 1, 100 - 1)) ) % ( 5 ) ) ___item5 = ( ( _randDouble() / float(5) ) % ( 5 ) ) - def run(): global ___item ____plusOperations(___item) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/strings.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/strings.py index 137a1bec57..f5c593b02f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/strings.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/ev3dev/strings.py @@ -7,7 +7,6 @@ import os import time - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/controlFlowNestedLoops.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/controlFlowNestedLoops.py index a3d6825da1..b25f6579f1 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/controlFlowNestedLoops.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/controlFlowNestedLoops.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/functionsBasic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/functionsBasic.py index 75e4133948..0915b90832 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/functionsBasic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/functionsBasic.py @@ -36,7 +36,6 @@ def ____retNumber2(___x): ___x = ___x / float(2) return ___x - def run(): global timer1, ___n1, ___b, ___n2, ___n3 # Basic Functions START diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperations.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperations.py index 862b4b14c9..609194a267 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperations.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperations.py @@ -2,7 +2,6 @@ import random import math - def _median(l): l = sorted(l) l_len = len(l) @@ -19,6 +18,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperationsBasic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperationsBasic.py index 612ad59f3a..5307fe8f2c 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperationsBasic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/listOperationsBasic.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathAndLists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathAndLists.py index e60025f46d..ecaca28893 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathAndLists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathAndLists.py @@ -2,7 +2,6 @@ import random import math - def _median(l): l = sorted(l) l_len = len(l) @@ -19,6 +18,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathBasics.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathBasics.py index c94c7afeda..a58a9c76ef 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathBasics.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathBasics.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathFunctions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathFunctions.py index e417aaa7e6..0183f92a3f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathFunctions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathFunctions.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-1.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-1.py index f30e681949..ca7d1a491a 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-1.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-1.py @@ -2,7 +2,6 @@ import random import math - def _isPrime(number): if(number == 0 or number == 1): return False diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-2.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-2.py index 8b6be96d32..8df4adaadf 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-2.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathLogic-2.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathPower.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathPower.py index b2202d2ce2..a5d9746b56 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathPower.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/mathPower.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/neuralNetwork.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/neuralNetwork.py index 63de0b6d4f..e9bbb85000 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/neuralNetwork.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/neuralNetwork.py @@ -29,6 +29,7 @@ def ____nnStep(): ____h1n2 = ____b_h1n2 + ____n1 * ____w_n1_h1n2 + ____n3 * ____w_n3_h1n2 ____n2 = ____b_n2 + ____h1n1 * ____w_h1n1_n2 + ____h1n2 * ____w_h1n2_n2 ____n4 = ____b_n4 + ____h1n1 * ____w_h1n1_n4 + ____h1n2 * ____w_h1n2_n4 + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -47,7 +48,6 @@ def ____runNN(): ____nnStep() ___n = ____n2 - def run(): global timer1, ___n, ____n1, ____n3, ____h1n1, ____h1n2, ____b_h1n1, ____w_n1_h1n1, ____w_n3_h1n1, ____b_h1n2, ____w_n1_h1n2, ____w_n3_h1n2, ____b_n2, ____w_h1n1_n2, ____w_h1n2_n2, ____b_n4, ____w_h1n1_n4, ____w_h1n2_n4 ____runNN() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/orderOfOperations.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/orderOfOperations.py index 25da03192f..960f9be537 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/orderOfOperations.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/orderOfOperations.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -55,7 +54,6 @@ def ____divisionOperations(___item5): ___item5 = ( ( 6 / float(random.randint(10 - 1, 100 - 1)) ) % ( 5 ) ) ___item5 = ( ( random.random() / float(5) ) % ( 5 ) ) - def run(): global timer1, ___item ____plusOperations(___item) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/strings.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/strings.py index e3e19b1754..b4127041cc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/strings.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/common/targetLanguage/microbitv2/strings.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/action_sound.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/action_sound.py index 43d7b69a8c..202aaa5baa 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/action_sound.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/action_sound.py @@ -8,7 +8,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___n = 0 def ____sounds(): @@ -20,7 +19,6 @@ def ____sounds(): music.pitch(349, 250) music.pitch(391, 125) - def run(): global timer1, ___n ____sounds() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_dualmotor_without_pin.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_dualmotor_without_pin.py index 1632667655..224b8a196d 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_dualmotor_without_pin.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_dualmotor_without_pin.py @@ -2,7 +2,6 @@ import random import math - def servo_get_angle(angle): if (angle < 0): angle = 0 @@ -47,7 +46,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() calliopemini.pin1.set_analog_period(20) - ___n = 50 def ____move(): @@ -139,7 +137,6 @@ def ____wait(): break calliopemini.sleep(700) - def run(): global timer1, ___n ____move() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_fourdigitdisplay_without_pin.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_fourdigitdisplay_without_pin.py index 6a7ed7074c..9d97557739 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_fourdigitdisplay_without_pin.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_fourdigitdisplay_without_pin.py @@ -3,7 +3,6 @@ import math from tm1637 import TM1637 - def set_brightness(val): global brightness if val < 0 or val >= 10: @@ -20,7 +19,6 @@ class ContinueLoop(Exception): pass fdd = TM1637() brightness = 9 - ___n = 0 ___b = True ___s = "" @@ -57,7 +55,6 @@ def ____action(): global timer1, ___n, ___b, ___s, ___c, ___i, ___nl, ___bl, ___sl, ___cl, ___il ____display() - def run(): global timer1, ___n, ___b, ___s, ___c, ___i, ___nl, ___bl, ___sl, ___cl, ___il ____action() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_ledbar_without_pin.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_ledbar_without_pin.py index 48e2cbba26..d49a1c0366 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_ledbar_without_pin.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actor_ledbar_without_pin.py @@ -2,7 +2,6 @@ import random import math - def write16(di, dcki, data): state = dcki.read_digital() for i in range(15,-1,-1): @@ -37,14 +36,12 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___n = 0 def ____lights(): global timer1, ___n set_led(___n,___n) - def run(): global timer1, ___n ____lights() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_pins.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_pins.py index a2885925cf..b3b54f3eae 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_pins.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_pins.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___off = 0 ___on = 1 ___analogon = 255 @@ -101,7 +100,6 @@ def ____wait(): break calliopemini.sleep(800) - def run(): global timer1, ___off, ___on, ___analogon ____pin() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_singlemotor_and_motionkit_without_pins.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_singlemotor_and_motionkit_without_pins.py index 413c0d9319..05deed40cc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_singlemotor_and_motionkit_without_pins.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/actors_singlemotor_and_motionkit_without_pins.py @@ -2,7 +2,6 @@ import random import math - def servo_get_angle(angle): if (angle < 0): angle = 0 @@ -31,7 +30,6 @@ class ContinueLoop(Exception): pass calliopemini.pin_A1_RX.set_analog_period(20) calliopemini.pin_A1_TX.set_analog_period(20) - ___off = 0 ___max = 100 ___negative = 0 @@ -116,7 +114,6 @@ def ____wait(): break calliopemini.sleep(500) - def run(): global timer1, ___off, ___max, ___negative ____move() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_led.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_led.py index 0ed90ad9cb..8cfa162ba5 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_led.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_led.py @@ -9,7 +9,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() callibot = Callibot2() - def ____wait(): global timer1 calliopemini.sleep(700) @@ -17,7 +16,6 @@ def ____wait(): if calliopemini.button_a.is_pressed() == True: break - def run(): global timer1 print("R RGB RED") @@ -64,6 +62,5 @@ def main(): finally: callibot.stop() - if __name__ == "__main__": main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_motor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_motor.py index 8cec3178c4..b1926bd986 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_motor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_motor.py @@ -9,7 +9,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() callibot = Callibot2() - def ____wait(): global timer1 while True: @@ -17,7 +16,6 @@ def ____wait(): break calliopemini.sleep(500) - def run(): global timer1 calliopemini.display.scroll("Curve Right") @@ -67,6 +65,5 @@ def main(): finally: callibot.stop() - if __name__ == "__main__": main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_sensor.py index 02f4db8a54..83b2ad747d 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/callibot_sensor.py @@ -9,7 +9,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() callibot = Callibot2() - def run(): global timer1 print("callibiot sensor tests press a to go through") @@ -42,6 +41,5 @@ def main(): finally: callibot.stop() - if __name__ == "__main__": main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/colour.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/colour.py index b991a27b5e..bdcf62a984 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/colour.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/colour.py @@ -9,7 +9,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() np = neopixel.NeoPixel(calliopemini.pin_RGB, 3) - ___color = (255, 0, 0) def ____wait(): @@ -21,7 +20,6 @@ def ____wait(): calliopemini.display.scroll("Next Color") calliopemini.sleep(500) - def run(): global timer1, ___color np[1] = ((153, 153, 153)) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/control.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/control.py index 90563b1d57..19cf34c988 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/control.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/control.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___numberVar = 0 ___booleanVar = True ___stringVar = "" @@ -63,7 +62,6 @@ def ____control(): if ___booleanVar: break - def run(): global timer1, ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___imageVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___imageList ____control() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/functions.py index 77ca9ea568..074d752d7d 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/functions.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___Element = 0 def ____macheEtwas(): @@ -19,7 +18,6 @@ def ____macheEtwas2(): calliopemini.display.scroll("Hallo") return 0 - def run(): global timer1, ___Element ____macheEtwas() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/images.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/images.py index 9a10c922ca..4f2a243a1f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/images.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/images.py @@ -8,7 +8,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() brightness = 9 - def run(): global timer1 calliopemini.display.show(calliopemini.Image('00000:00000:00000:00000:00000')) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/lists.py index 2648ba254c..a286fb8cef 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/lists.py @@ -2,13 +2,11 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___numberVar = 0 ___booleanVar = True ___stringVar = "" @@ -57,7 +55,6 @@ def ____lists(): ___numberList = ___numberList[0:-1 -___numberVar] ___numberList = ___numberList[0:] - def run(): global timer1, ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___imageVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___imageList, ___item2 ____lists() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/logic.py index 147e37f122..595da99254 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/logic.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___numberVar = 0 ___booleanVar = True @@ -26,7 +25,6 @@ def ____logic(): calliopemini.display.scroll(str(False)) calliopemini.display.scroll(str(___numberVar if ( ___booleanVar ) else ___numberVar)) - def run(): global timer1, ___numberVar, ___booleanVar ____logic() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/math.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/math.py index 3a52af7e9b..28a3b85838 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/math.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/math.py @@ -2,7 +2,6 @@ import random import math - def _median(l): l = sorted(l) l_len = len(l) @@ -28,12 +27,12 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___numberVar = 0 ___numberList = [0, 0] @@ -85,8 +84,6 @@ def ____math(): calliopemini.display.scroll(str(_median(___numberList))) calliopemini.display.scroll(str(_standard_deviation(___numberList))) - - def run(): global timer1, ___numberVar, ___numberList ____math() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_dual.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_dual.py index bb41efd501..1e301e6fc2 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_dual.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_dual.py @@ -2,7 +2,6 @@ import random import math - def set_both_motors(speed_A, speed_B): digit_0 = 0 digit_1 = 0 @@ -39,7 +38,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - def run(): global timer1 set_both_motors(50, 100) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_single.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_single.py index 697ac0d923..504cc17680 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_single.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/motor_single.py @@ -2,7 +2,6 @@ import random import math - def set_motor(port, speed): digit = 0 if (speed < 0): @@ -22,7 +21,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___item = -100 def run(): diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_rx.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_rx.py index 2bf6df96d2..3766efadec 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_rx.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_rx.py @@ -5,7 +5,6 @@ import music import neopixel - def receive_message(type): global rssi details = radio.receive_full() @@ -37,7 +36,6 @@ class ContinueLoop(Exception): pass np = neopixel.NeoPixel(calliopemini.pin_RGB, 3) brightness = 9 rssi = 0 - radio.on() ___colours = [(255, 0, 0), (255, 153, 0), (255, 255, 0), (51, 255, 51), (102, 204, 204)] diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_tx.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_tx.py index a74339110d..c99fed4e9e 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_tx.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/radio_tx.py @@ -5,7 +5,6 @@ import music import neopixel - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -13,7 +12,6 @@ class ContinueLoop(Exception): pass np = neopixel.NeoPixel(calliopemini.pin_RGB, 3) brightness = 9 rssi = 0 - radio.on() ___colours = [(255, 0, 0), (255, 153, 0), (255, 255, 0), (51, 255, 51), (102, 204, 204)] diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_moisture.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_moisture.py index 4544be7b8c..4988bd221b 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_moisture.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_moisture.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - def run(): global timer1 print("Moisture sensor test") diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_pins.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_pins.py index 5f6e5d9093..b734d8f3b3 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_pins.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_pins.py @@ -8,7 +8,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - def ____sensors(): global timer1 calliopemini.display.scroll(str(calliopemini.pin1.read_analog())) @@ -179,7 +178,6 @@ def ____sensorsWaitUntil(): if machine.time_pulse_us(calliopemini.pin19, 0) < 30: break - def run(): global timer1 ____sensors() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_ultrasonic_and_colourtcs3472.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_ultrasonic_and_colourtcs3472.py index 83bb4505ee..4dc421fdfc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_ultrasonic_and_colourtcs3472.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensor_ultrasonic_and_colourtcs3472.py @@ -4,14 +4,13 @@ from machine import time_pulse_us from tcs3472 import tcs3472 - def measure_distance_cm(echo=calliopemini.pin_A1_RX, trigger=calliopemini.pin_A1_RX): trigger.write_digital(1) trigger.write_digital(0) msec = time_pulse_us(echo, 1) echo_time = msec / 1000000 dist_cm = (echo_time / 2) * 34300 - return dist_cm + return dist_cm class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -20,7 +19,6 @@ class ContinueLoop(Exception): pass color_sensor = tcs3472() LIGHT_CONST = 40 - ___colourVar = (255, 0, 0) def ____sensors(): @@ -29,7 +27,6 @@ def ____sensors(): ___colourVar = color_sensor.rgb() calliopemini.display.scroll(str(int( color_sensor.light() / LIGHT_CONST))) - def run(): global timer1, ___colourVar ____sensors() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_config_pin_pull.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_config_pin_pull.py index fd1b7dfb83..dc01810da0 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_config_pin_pull.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_config_pin_pull.py @@ -7,7 +7,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - def run(): global timer1 diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_waitUntil_without_pins_and_callibot_and_ultrasonic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_waitUntil_without_pins_and_callibot_and_ultrasonic.py index fd25146db2..5264ea9c54 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_waitUntil_without_pins_and_callibot_and_ultrasonic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_waitUntil_without_pins_and_callibot_and_ultrasonic.py @@ -10,7 +10,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() sht31 = SHT31() - ___colourVar = (255, 0, 0) ___numberList = [0, 0] @@ -101,7 +100,6 @@ def ____sensorsWaitUntil(): if sht31.get_temp_humi("t") < 30: break - def run(): global timer1, ___colourVar, ___numberList ____sensorsWaitUntil() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_without_pins_and_callibot_and_ultrasonic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_without_pins_and_callibot_and_ultrasonic.py index 496aa09602..f66630cf83 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_without_pins_and_callibot_and_ultrasonic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/sensors_without_pins_and_callibot_and_ultrasonic.py @@ -15,7 +15,6 @@ class ContinueLoop(Exception): pass LIGHT_CONST = 40 sht31 = SHT31() - def ____buttons(): global timer1 print("Button A (B to Cancel)") @@ -210,7 +209,6 @@ def ____external(): if calliopemini.button_a.is_pressed(): break - def run(): global timer1 ____buttons() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/text.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/text.py index 18eefcdfaa..e1d07a96a9 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/text.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/text.py @@ -2,13 +2,11 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - ___Element = ["", "", ""] ___Element2 = "" diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_LEDs.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_LEDs.py index 6f57139054..a15dc4ecd3 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_LEDs.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_LEDs.py @@ -9,7 +9,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() np = neopixel.NeoPixel(calliopemini.pin_RGB, 3) - def run(): global timer1 print("Rotating through LEDs press A to continue") @@ -25,7 +24,6 @@ def run(): break np[0] = ((0, 0, 0)) np.show() - print("center LED RED") while True: if calliopemini.button_a.is_pressed() == True: @@ -38,7 +36,6 @@ def run(): break np[1] = ((0, 0, 0)) np.show() - print("right LED RED") while True: if calliopemini.button_a.is_pressed() == True: @@ -51,7 +48,6 @@ def run(): break np[2] = ((0, 0, 0)) np.show() - print("all LEDs RED") while True: if calliopemini.button_a.is_pressed() == True: @@ -63,7 +59,6 @@ def run(): if calliopemini.button_a.is_pressed() == True: break np.clear() - print("right LED green") while True: if calliopemini.button_a.is_pressed() == True: diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_logotouch_and_sound.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_logotouch_and_sound.py index ad517a1618..75a427cfa4 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_logotouch_and_sound.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliopev3/v3_logotouch_and_sound.py @@ -8,7 +8,6 @@ class ContinueLoop(Exception): pass timer1 = calliopemini.running_time() - def run(): global timer1 calliopemini.speaker.on() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/action.py index e909d1dafe..71e1b60120 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/action.py @@ -174,7 +174,6 @@ def ____move(): Ed.DriveRightMotor(Ed.STOP, Ed.SPEED_1, 1) Ed.ReadClapSensor() - ____action() ___soundfile1 = Ed.TuneString(7,"c8e8g8z") Ed.PlayTune(___soundfile1) @@ -185,5 +184,4 @@ def ____move(): Ed.PlayTune(___soundfile2) while (Ed.ReadMusicEnd() == Ed.MUSIC_NOT_FINISHED): pass -Ed.ReadClapSensor() - +Ed.ReadClapSensor() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/control_logic.py index 8c1fdc1fcc..c2a70476bc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/control_logic.py @@ -1,4 +1,5 @@ import Ed + Ed.EdisonVersion = Ed.V2 Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_SLOW @@ -54,7 +55,5 @@ def ____logic(): ___booleanVar = True ___booleanVar = False - ____control() -____logic() - +____logic() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/math_lists.py index f642e203e2..80ac498207 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/math_lists.py @@ -92,7 +92,5 @@ def ____lists(): ___numberVar = ___numberList[___numberVar] ___numberList[___numberVar] = ___numberVar - ____math() -____lists() - +____lists() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/sensors.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/sensors.py index 29caaa16e2..8959fd466f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/sensors.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/sensors.py @@ -96,7 +96,5 @@ def ____sensorWaitUntil(): break pass - ____sensors() -____sensorWaitUntil() - +____sensorWaitUntil() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/text_messages_functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/text_messages_functions.py index e19fc76fe2..22f44f5d38 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/text_messages_functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv2/text_messages_functions.py @@ -55,11 +55,9 @@ def ____function_return_numberList(): global ___numberVar, ___booleanVar, ___numberList return ___numberList - ____text() ____messages() ____function_parameters(___numberVar, ___booleanVar, ___numberList) ___numberVar = ____function_return_numberVar() ___booleanVar = ____function_return_booleanVar() -___numberList = ____function_return_numberList() - +___numberList = ____function_return_numberList() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/action.py index e909d1dafe..71e1b60120 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/action.py @@ -174,7 +174,6 @@ def ____move(): Ed.DriveRightMotor(Ed.STOP, Ed.SPEED_1, 1) Ed.ReadClapSensor() - ____action() ___soundfile1 = Ed.TuneString(7,"c8e8g8z") Ed.PlayTune(___soundfile1) @@ -185,5 +184,4 @@ def ____move(): Ed.PlayTune(___soundfile2) while (Ed.ReadMusicEnd() == Ed.MUSIC_NOT_FINISHED): pass -Ed.ReadClapSensor() - +Ed.ReadClapSensor() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/control_logic.py index 8c1fdc1fcc..c2a70476bc 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/control_logic.py @@ -1,4 +1,5 @@ import Ed + Ed.EdisonVersion = Ed.V2 Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_SLOW @@ -54,7 +55,5 @@ def ____logic(): ___booleanVar = True ___booleanVar = False - ____control() -____logic() - +____logic() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/math_lists.py index f642e203e2..80ac498207 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/math_lists.py @@ -92,7 +92,5 @@ def ____lists(): ___numberVar = ___numberList[___numberVar] ___numberList[___numberVar] = ___numberVar - ____math() -____lists() - +____lists() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/sensors.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/sensors.py index 29caaa16e2..8959fd466f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/sensors.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/sensors.py @@ -96,7 +96,5 @@ def ____sensorWaitUntil(): break pass - ____sensors() -____sensorWaitUntil() - +____sensorWaitUntil() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/text_messages_functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/text_messages_functions.py index e19fc76fe2..22f44f5d38 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/text_messages_functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/edisonv3/text_messages_functions.py @@ -55,11 +55,9 @@ def ____function_return_numberList(): global ___numberVar, ___booleanVar, ___numberList return ___numberList - ____text() ____messages() ____function_parameters(___numberVar, ___booleanVar, ___numberList) ___numberVar = ____function_return_numberVar() ___booleanVar = ____function_return_booleanVar() -___numberList = ____function_return_numberList() - +___numberList = ____function_return_numberList() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/action.py index d568f65c87..c45ff2c4d0 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/action.py @@ -7,7 +7,6 @@ import os import time - def _busyWait(): time.sleep(0.0) @@ -52,7 +51,6 @@ def _scaleSpeed(m, speed_pct): class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass - predefinedImages = { 'OLDGLASSES': u'\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u0007\u00fc\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0080\u00ff\u0001\u00f0\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u00fe\u003f\u00f0\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u00e0\u00ff\u0000\u00f0\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00ff\u000f\u00c0\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u00f0\u003f\u0000\u00e0\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0080\u00ff\u0003\u00c0\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u00f8\u001f\u0000\u00e0\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u00c0\u00ff\u0000\u0080\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u00fc\u000f\u0000\u00e0\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u00e0\u007f\u0000\u0080\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u00fe\u0007\u0000\u00e0\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u00f0\u003f\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u00ff\u0003\u0000\u00f0\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u00f8\u001f\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0080\u00ff\u0001\u0000\u00f0\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00f8\u000f\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u00c0\u00ff\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00fc\u0007\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u00c0\u00ff\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u00fe\u0003\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u00c0\u007f\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u00fe\u0001\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u00e0\u003f\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u00ff\u0001\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u00f0\u003f\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u00ff\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u00f0\u001f\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0080\u00ff\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u00f8\u001f\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0080\u007f\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u00f8\u000f\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u00c0\u007f\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00c0\u003f\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u00fc\u0007\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00c0\u003f\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u00fc\u0007\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00e0\u001f\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u001f\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u001f\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u00fe\u0003\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u001f\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0080\u0001\u00fe\u0003\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u001f\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00f0\u000f\u00ff\u0003\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00f0\u001f\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00f8\u001f\u00ff\u0003\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u003f\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003e\u007c\u00ff\u0007\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u003f\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u00f8\u00ff\u0007\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u00f0\u00ff\u001f\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00e3\u00c7\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00fb\u00df\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000', 'TACHO': u'\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u007f\u0009\u0010\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u0007\u0009\u0010\u00e0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u0000\r\u0010\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u001f\u0000\u0005\u0010\u0000\u00f9\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0003\u0000\u0005\u0000\u0000\u00c9\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u0002\u0000\u0005\u0000\u0000\u0005\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u003f\u0002\u0000\u0005\u0000\u0080\u0004\u007c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u000f\u0006\u0000\u0002\u0000\u0080\u0002\u00f0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0003\u0004\u0000\u0002\u0000\u0080\u0002\u00c0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00c1\u0000\u0000\u0002\u0000\u0080\u0001\u0040\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u00c0\u0001\u0000\u0002\u0000\u0040\u0001\u0060\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u003f\u0080\u0001\u0000\u0002\u0000\u00c0\u0000\u0020\u001c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u001f\u0080\u0003\u0000\u0000\u0000\u00c0\u0000\u0000\u0078\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u0000\u0007\u0000\u0000\u0000\u0040\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0013\u0000\u0007\u00cc\u0003\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0027\u0000\n\u0008\u00fa\u00c0\u0002\u0000\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u002c\u0000\u000e\u0008\u008a\u0080\u0082\u000f\u0000\u0040\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0068\u0000\u0014\u00e8\u008b\u0080\u0082\u0008\u0000\u0020\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u003f\u0050\u0000\u001c\u0028\u0088\u0080\u00a2\u0008\u0000\u00d0\u001c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u001f\u0060\u0000\u002c\u0028\u0088\u0080\u00be\u0008\u0000\u0038\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u001f\u00c0\u0000\u0038\u00e8\u00fb\u0080\u00a0\u0008\u0000\u000c\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u000f\u00c0\u0000\u0058\u0000\u0000\u0080\u00a0\u000f\u0000\u0003\u0070\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0007\u0080\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0003\u0000\u0000\u00b0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0003\u0000\u0000\u0070\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0006\u0000\u0000\u00e0\u0001\u0000\u0000\u0000\u00ec\u0001\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u000c\u0060\u0000\u00a0\u0002\u0000\u0000\u0000\u0028\u00f8\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007e\u0018\u0040\u00df\u00c7\u0003\u0000\u0000\u0000\u0028\u0088\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0040\u0051\u0044\u0005\u0000\u0000\u0000\u00e8\u008b\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u003f\u0000\u0040\u0051\u00c4\u000e\u0000\u0000\u0000\u0028\u008a\u0000\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u003f\u0000\u0040\u0051\u0084\n\u0000\u0000\u0000\u0028\u008a\u0000\u0000\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u001f\u0000\u0040\u0051\u0084\u0014\u0000\u0000\u0000\u00e8\u00fb\u0000\u0080\u0019\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u001f\u0000\u0040\u00df\u0007\u0015\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u000f\u0000\u0000\u0000\u0000\u0029\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0030\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u000f\u0000\u0000\u0000\u0000\u002b\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0070\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0007\u0000\u0000\u0000\u0000\u0052\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0060\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0007\u0000\u0000\u0000\u0000\u0072\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u000f\u0000\u0000\u0000\u0000\u00a4\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0033\u0000\u0000\u0000\u0000\u00e4\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0043\u0000\u0000\u0000\u0000\u004c\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u008f\u0001\u0000\u0000\u0000\u0088\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0071\u00c6\u0007\u0000\u0000\u0088\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0081\u004f\u00f4\u0001\u0000\u0010\u0005\u0000\u0000\u0000\u00c0\u003e\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0001\u0040\u0014\u0001\u0000\u0010\u0005\u0000\u0000\u0000\u0080\u00a2\u000f\u00e0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0000\u00c0\u0017\u0001\u0000\u0030\n\u0000\u0000\u0000\u0080\u00a2\u0008\u0038\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0000\u0040\u0014\u0001\u0000\u0020\u001a\u0000\u0000\u0000\u0080\u00be\u0008\u0007\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0040\u0014\u0001\u0000\u0020\u0014\u0000\u0000\u0000\u0080\u00a2\u00e8\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u00c0\u00f7\u0001\u0000\u0040\u002c\u0000\u0000\u0000\u0080\u00a2\u0008\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0040\u0028\u0000\u0000\u0000\u0080\u00be\u000f\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u00c0\u0050\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0080\u0050\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0080\u00a0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0003\u0000\u0000\u0000\u0000\u0000\u00a1\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007e\u000e\u0000\u0000\u0000\u0000\u0000\u00e1\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0072\u0070\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u001e\u00c0\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0080\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u00e0\u0001\u0000\u0000\u0080\u0003\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007f\u0000\u0020\u00f8\u0000\u0000\u0080\u0003\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u0000\u0020\u0088\u0000\u0000\u0080\u0003\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u000f\u00e0\u008b\u0000\u0000\u0000\u0003\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00f0\u0020\u008a\u0000\u0000\u0000\u0007\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00c0\u0027\u008a\u0000\u0000\u0000\u0007\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u003f\u00e0\u00fb\u0000\u0000\u0000\u000e\u0080\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0000\u003e\u00c0\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0000\u007c\u0070\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0001\u0000\u0000\u0000\u0000\u0000\u00c0\u0007\u0000\u0000\u0000\u0000\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0002\u0000\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0004\u0000\n\u0000\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0067\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0004\u0000\n\u0000\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u001f\u0000\u0002\u0000\u0000\u0000\u0000\u0000\u0024\u0000\u0009\u0000\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0007\u0000\u0082\u000f\u0000\u0000\u0000\u0000\u0094\n\u0079\u0000\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u000f\u0000\u0082\u0008\u0000\u0000\u0000\u0000\u008c\u0095\u0048\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u000f\u0000\u00a2\u0008\u0000\u0000\u0000\u0000\u0094\u0094\u0048\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u0000\u00be\u0008\u0000\u0000\u0000\u0000\u00a4\u0054\u0048\u0000\u0000\u00f8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u001f\u0000\u00a0\u0008\u0000\u0000\u0000\u0000\u0000\u0040\u0000\u0000\u0000\u0078\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u003f\u0000\u00a0\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007c\u003e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u003f\u00f8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u0067\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u007f\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0000\u003e\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u001f\u0000\u0070\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u000f\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u00e0\u001f\u00fe\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0003\u0000\u0080\u0001\u0000\u0000\u0000\u0000\u00f8\u0001\u00f8\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0001\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u007c\u0000\u00e0\u0007\u0000\u0000\u003c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u00be\u0000\u0090\u000f\u0000\u0000\u00a0\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0000\u003e\u0000\u0006\u0000\u0000\u0000\u0000\u009f\u0000\u0010\u001e\u0000\u0000\u00a0\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0078\u0080\u00c1\u0000\u000c\u0000\u0000\u0000\u0000\u00cf\u0000\u0030\u001e\u0000\u0000\u00be\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u003c\u0080\u0080\u0000\u001c\u0000\u0000\u0000\u0080\u0087\u0004\u0012\u003c\u0000\u0000\u0082\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u003c\u0080\u0080\u0000\u001c\u0000\u0000\u0000\u00c0\u00c3\u009b\u003d\u0078\u0020\u0000\u0082\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u003e\u0080\u00be\u0000\u0018\u0000\u0000\u0000\u00c0\u0083\u0091\u0018\u00f8\u0010\u0000\u00be\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u001f\u0080\u0080\u0000\u0018\u0000\u0000\u0000\u00c0\u00c3\u0064\u0032\u00f8\u0009\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u001f\u0080\u00be\u0000\u0018\u0000\u0000\u0000\u00c0\u00c1\u00f1\u0038\u00f0\u0007\u0000\u0010\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u001f\u0080\u0080\u0000\u0038\u0000\u0000\u0000\u00c0\u0001\u00fa\u0005\u00f0\u000f\u0000\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u0080\u00be\u0000\u0038\u0000\u0000\u0000\u00e0\u0001\u0064\u0002\u00f0\u001f\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u001f\u0080\u0080\u0000\u0038\u0000\u0000\u0000\u00e0\u0001\u0060\u0000\u00f0\u003f\u0000\n\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u001f\u0080\u00be\u0000\u0038\u0000\u0000\u0000\u00e0\u0001\u0060\u0000\u00f0\u007f\u0080\u0005\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u001f\u0080\u0080\u0000\u0038\u0000\u0000\u0000\u00e0\u0001\u00fe\u0007\u00f0\u00ff\u0041\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u001c\u0080\u00be\u0000\u0018\u0000\u0000\u0000\u00c0\u0003\u0062\u0004\u00f8\u00ff\u0033\u0002\u0000\u0000\u0000\u0000\u0000\u00c0\u007f\u003c\u0080\u0080\u0000\u001c\u0000\u0000\u0000\u00c0\u0003\u0063\u000c\u0088\u00ff\u001f\u0003\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u003c\u0080\u00be\u0000\u001c\u0000\u0000\u0000\u00c0\u0083\u0003\u001c\u0008\u00ff\u003f\u0001\u0000\u0000\u0000\u0000\u0000\u00fc\u000f\u003c\u0080\u0080\u0000\u001c\u0000\u0000\u0000\u00c0\u0087\u0003\u001c\u000c\u00fe\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u00ff\u0007\u007c\u0080\u00ff\u0000\u001e\u0000\u0000\u0000\u00c0\u008f\u00ff\u001f\u000e\u00fc\u00ff\u0003\u0000\u0000\u0000\u0000\u00c0\u00ff\u0003\u00f8\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0080\u009f\u0007\u001e\u0006\u00f8\u00ff\u001f\u0000\u0000\u0000\u0000\u00f8\u00ff\u0001\u00f0\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u003f\u0003\u000c\u0003\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u00ff\u007f\u0000\u00f0\u0001\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u007f\u0000\u00c0\u0003\u0080\u00ff\u00ff\u0007\u0000\u0000\u00e0\u00ff\u001f\u0000\u00e0\u0003\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u00fe\u0001\u00e0\u0001\u0000\u00fe\u00ff\u00ff\u0007\u00e0\u00ff\u00ff\u0007\u0000\u00c0\u000f\u0000\u00f0\u0001\u0000\u0000\u0000\u0000\u00fc\u000f\u00fc\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u00c0\u001f\u0000\u00f8\u0001\u0000\u0000\u0000\u0000\u00f8\u00ff\u007f\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u00ff\u0000\u007f\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u001f\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u00fe\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u000f\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u00f8\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u00f0\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u003e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000', @@ -60,6 +58,7 @@ class ContinueLoop(Exception): pass 'EYESOPEN': u'\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0040\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00b0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00b0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00b0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00d8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00cc\u0060\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u00cc\u007c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u0003\u0000\u0000\u0000\u00cc\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u0000\u0000\u0000\u008c\u0037\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u001f\u0000\u0000\u000c\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u007f\u0000\u0000\u000c\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u0000\u0000\u000c\u001c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0000\u0000\u0006\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u007f\u0000\u0000\u0006\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u003f\u0000\u0000\u0006\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u001e\u0000\u0000\u0006\u0007\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0000\u00fc\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0003\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0000\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0003\u0000\u0000\u0000\u0000\u00c0\u0003\u0000\u00c0\u003f\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0083\u0001\u0000\u0000\u0000\u0000\u0060\u0003\u0000\u00f0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0083\u0001\u0000\u0000\u0000\u0000\u0060\u0003\u0000\u00f8\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c3\u0000\u0000\u0000\u0000\u0000\u0020\u0003\u0000\u00fc\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c3\u0018\u0000\u0000\u0000\u0018\u0030\u0003\u0000\u00fe\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u001f\u0000\u0000\u0000\u0000\u00c3\u003f\u0000\u0000\u0000\u00fc\u0030\u0003\u0080\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u0001\u0000\u0000\u0000\u0083\u001f\u0000\u0000\u0000\u00ee\u003b\u0003\u00c0\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0007\u0000\u0000\u0080\u0001\u000e\u0000\u0000\u0000\u0086\u001f\u0003\u00e0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0007\u00e0\u001f\u0000\u0000\u0080\u0001\u0007\u0000\u0000\u0000\u0006\u001e\u0003\u00f0\u000f\u0000\u0000\u00fe\u0007\u0000\u0000\u00fc\u0000\u0000\u003f\u0000\u0000\u0080\u0081\u0003\u0000\u0000\u0000\u000c\u0000\u0003\u00f8\u0007\u0000\u00e0\u00ff\u007f\u0000\u0000\u003f\u0000\u0000\u00fc\u0000\u00c0\u009f\u00c1\u0001\u0000\u0000\u0000\u000c\u0000\u0003\u00f8\u0007\u0000\u00fc\u00ff\u00ff\u0003\u0080\u000f\u0000\u0000\u00f0\u0081\u00ff\u009f\u00e1\u0000\u0000\u0000\u0000\u0018\u0000\u0003\u00e0\u0003\u0000\u00ff\u0001\u00f8\u000f\u00c0\u0007\u0000\u0000\u00e0\u00ff\u00ff\u009f\u0071\u0000\u0000\u0000\u0000\u0018\u0000\u0003\u00c0\u0003\u0080\u001f\u0000\u0080\u001f\u00e0\u0001\u0000\u0000\u0080\u00ff\u00ff\u009f\u003b\u0000\u0000\u0000\u0000\u0030\u0000\u0003\u00c0\u0001\u00e0\u0007\u0000\u0000\u007e\u00f0\u0000\u0000\u0000\u0000\u00ff\u00ff\u001f\u001f\u0000\u0000\u0000\u0000\u0060\u0000\u0003\u0000\u0000\u00f0\u0001\u0000\u0000\u00f8\u0070\u0000\u0000\u0000\u0000\u00fe\u00ff\u001f\u000c\u0000\u0000\u0000\u0000\u0060\u0000\u0003\u0000\u0000\u00f8\u0000\u0000\u0000\u00f0\u0079\u0000\u0000\u0000\u0000\u00fe\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00c0\u0000\u0003\u0000\u0000\u003c\u0000\u0000\u0000\u00c0\u003f\u0000\u0000\u0000\u0000\u00fc\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0080\u0001\u0003\u0000\u0000\u001e\u0000\u0000\u0000\u0080\u001f\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0080\u0003\u0003\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u001f\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0003\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u00f0\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u000e\u0006\u0003\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u00f0\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u007e\u000c\u0003\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u00e0\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00f6\r\u0003\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u001f\u0000\u00e0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u00c6\u000f\u0003\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u00c0\u007f\u0000\u00e0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u000e\u0006\u0003\u0000\u00f0\u0000\u0000\u0000\u0000\u0080\u0003\u0000\u00e0\u00c3\u0000\u00c0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u000c\u0000\u0007\u0000\u0070\u0000\u0000\u0000\u0000\u0080\u0003\u0000\u00f0\u0081\u0001\u00c0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0018\u0000\u0007\u0000\u0070\u0000\u0000\u0000\u0000\u0080\u0003\u0000\u00f0\u0081\u0001\u00c0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0018\u0000\u0006\u0000\u0038\u0000\u0000\u0000\u003e\u0080\u0003\u0000\u00f8\u0081\u0003\u00c0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0030\u0000\u0006\u0000\u0038\u0000\u0000\u0080\u00ff\u0080\u0003\u0000\u00f8\u0081\u0003\u00c0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0030\u0000\u0006\u0000\u0038\u0000\u0000\u00e0\u00ff\u0083\u0003\u0000\u00f8\u00c3\u0003\u00c0\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0060\u0000\u0006\u0000\u003f\u0000\u0000\u00e0\u000f\u0083\u0003\u0000\u00f8\u00ff\u0003\u00c0\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0000\u0006\u00f0\u001f\u0000\u0000\u00f0\u0007\u0086\u0003\u0000\u00f8\u00ff\u0003\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0006\u00ff\u001f\u0000\u0000\u00f0\u0007\u0086\u0003\u0000\u00f0\u00ff\u0001\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0001\u00fe\u00ff\u001f\u0000\u0000\u00f8\u0007\u008e\u0003\u0000\u00f0\u00ff\u0001\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u00fe\u00ff\u001f\u0000\u0000\u00f8\u0007\u000e\u0007\u0000\u00e0\u00ff\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u00fe\u00ff\u001f\u0000\u0000\u00f8\u000f\u000f\u0007\u0000\u00c0\u007f\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u00ff\u00ff\u001f\u0000\u0000\u00f8\u00ff\u000f\u0007\u0000\u0000\u001f\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u00ff\u00ff\u001f\u0000\u0000\u00f8\u00ff\u000f\u000f\u0000\u0000\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u003c\u00fb\u00ff\u001f\u0000\u0000\u00f0\u00ff\u0007\u000e\u0000\u0000\u0000\u0000\u0070\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00fb\u00ff\u001f\u0000\u0000\u00f0\u00ff\u0007\u001e\u0000\u0000\u0000\u0000\u0078\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00f9\u00ff\u001f\u0000\u0000\u00e0\u00ff\u0003\u001c\u0000\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u00e0\u00ff\u0003\u003c\u0000\u0000\u0000\u0000\u003c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u0080\u00ff\u0000\u0078\u0000\u0000\u0000\u0000\u001e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u003f\u0000\u0000\u0000\u003e\u0000\u0070\u0000\u0000\u0000\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u00f0\u0000\u0000\u0000\u0000\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u00e0\u0001\u0000\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u00e0\u0007\u0000\u0000\u00e0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u00f0\u000f\u0000\u0000\u00f0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u00f0\u003f\u0000\u0000\u00fc\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00f8\u00ff\u0000\u0000\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u00fc\u00ff\u0007\u00e0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00c3\u0003\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u001f\u0080\u0007\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u000f\u0000\u0000\u0000\u0000\u00ff\u00ff\u00fb\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u001e\u0000\u0000\u0000\u0080\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u003c\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u0000\u0000\u0000\u00f0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0001\u0000\u0000\u00f8\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0007\u0000\u0000\u00fe\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u001f\u0000\u0080\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u0001\u00f8\u00ef\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00f3\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u007f\u00f0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u0007\u00f0\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000', 'FLOWERS': u'\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0003\u001e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u0000\u0078\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0038\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0018\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000c\u0000\u0080\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u000e\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0000\u00fc\u0001\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0080\u0007\u000e\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00c0\u0000\u0010\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0070\u0000\u0060\u0003\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u00f8\u000f\u00e0\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0038\u0000\u00c0\u0006\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u00ff\u007f\u00e0\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0018\u0000\u0080\u0006\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00e1\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u000c\u0000\u0000\u000f\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00e7\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0006\u0000\u0000\u00ee\u001f\u0080\u00e1\u000f\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ef\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0006\u0000\u0000\u00fe\u00ff\u00c0\u00fc\u007f\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u0006\u0000\u0000\u00ff\u00ff\u00c3\u001e\u00f0\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u0003\u0000\u0080\u00ff\u00ff\u00ef\u0007\u00c0\u0003\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0007\u00ff\u0001\u0000\u0003\u0000\u00c0\u00ff\u00ff\u00ff\u0001\u0000\u0007\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00e7\u00ff\u000f\u0000\u0003\u0000\u00e0\u00ff\u00ff\u00ff\u0000\u0000\u0006\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00fb\u00ff\u003f\u0000\u0003\u0000\u00f0\u00ff\u00ff\u007f\u0000\u0000\u000c\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u0003\u0000\u00f8\u00ff\u00ff\u007f\u0000\u0000\u001c\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0003\u0000\u00f8\u00ff\u00ff\u007f\u0000\u0000\u0018\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0003\u0007\u0000\u00fc\u00ff\u00ff\u00ff\u0000\u0000\u0018\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00ff\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u0007\u0006\u0000\u00fc\u00ff\u00ff\u00ff\u0000\u0000\u0030\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u001f\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u000f\u0006\u0000\u00fc\u00ff\u00ff\u00ff\u0000\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u0007\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u001f\u000e\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u001f\u001c\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u0000\u00fe\u00ff\u00ff\u00ff\u003f\u0038\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u007f\u0000\u0000\u0000\u00fc\u00ff\u00ff\u00ff\u003f\u0078\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u003f\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u007f\u00f0\u0000\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0030\u0000\u00f0\u00ff\u00ff\u00ff\u001f\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u007f\u00c0\u0007\u00fe\u00ff\u00ff\u00ff\u0001\u0000\u0018\u0000\u00f0\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u007f\u0080\u00ff\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u0018\u0000\u00f0\u00ff\u00ff\u00ff\u000f\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u0000\u00fc\u00ff\u00ff\u00ff\u00ff\u0001\u0000\u001c\u0000\u00f0\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0000\u00fe\u00ff\u00ff\u00ff\u00ff\u0000\u0000\u000c\u0000\u00e0\u00ff\u00ff\u00ff\u0007\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u00ff\u0000\u001f\u00fc\u00ff\u00ff\u00ff\u0000\u0000\u0006\u0000\u00e0\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00c0\u0007\u00fc\u00ff\u00ff\u00ff\u0001\u0000\u0007\u0000\u00e0\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00e0\u0001\u00f8\u00ff\u00ff\u00ff\u0007\u00c0\u0003\u0000\u00c0\u00ff\u00ff\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u00ff\u00e0\u0000\u00f8\u00ff\u00ff\u00ff\u001f\u00f0\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u0070\u0000\u00f0\u00ff\u00ff\u003f\u00ff\u007f\u0000\u0000\u0080\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u0078\u0000\u00e0\u00ff\u00ff\u001f\u00fc\u000f\u0000\u0000\u0080\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u00ff\u0038\u0000\u00c0\u00ff\u00ff\u000f\u0018\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u007f\u0038\u0000\u0080\u00ff\u00ff\u0007\u0030\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u007f\u001c\u0000\u0000\u00ff\u00ff\u0003\u0070\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u007f\u001c\u0000\u0000\u00fc\u00ff\u0000\u0060\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u003f\u001c\u0000\u0000\u00f0\u001f\u0000\u0060\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u003f\u001c\u0000\u0000\u0070\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u0001\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u001f\u001c\u0000\u0000\u0070\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u001f\u001c\u0000\u0000\u0070\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u000f\u001c\u0000\u0000\u0070\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u0003\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u0007\u0038\u0000\u0000\u0068\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u0007\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u0003\u0038\u0000\u0000\u0068\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u0007\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u0001\u0078\u0000\u0000\u006c\u0000\u0000\u00c0\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u000f\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u0000\u0070\u0000\u0000\u00c4\u0000\u0000\u0060\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u000f\u0000\u0000\u0000\u00e0\u00ff\u00ff\u003f\u0000\u00e0\u0000\u0000\u00c2\u0000\u0000\u0060\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u001f\u0000\u0000\u0000\u00f0\u00ff\u00ff\u000f\u0000\u00e0\u0001\u0000\u00c3\u0001\u0000\u0070\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u003f\u0000\u0000\u0000\u00f8\u00ff\u00ff\u0001\u0000\u00c0\u0007\u00c0\u0081\u0001\u0000\u0030\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u007f\u0000\u0000\u0000\u00fc\u00ff\u0003\u0000\u0000\u0000\u001f\u0070\u0000\u0003\u0000\u0018\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u0000\u0000\u0000\u00fe\u00ff\u0007\u0000\u0000\u0000\u00fe\u003f\u0000\u0007\u0000\u001c\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u0001\u0000\u0000\u00ff\u00ff\u000f\u0000\u0000\u0000\u00f0\u0007\u0000\u001e\u0000\u000f\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u0007\u0000\u00c0\u00ff\u00ff\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0078\u00c0\u0003\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u001f\u0000\u00f0\u00ff\u00ff\u001f\u0000\u00e0\u0007\u0000\u0000\u0000\u00f0\u00ff\u0001\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u0000\u00fe\u00ff\u00ff\u001f\u0000\u00f8\u001f\u0000\u0000\u0000\u0080\u003f\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u00fe\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u00ff\u00ff\u0000\u007e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u003f\u0000\u007f\u00f0\u0080\u00ff\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0080\u001f\u00c0\u00e1\u00ff\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0080\u0007\u0000\u00f1\u00e0\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0007\u0000\u0033\u0080\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0003\u0000\n\u0000\u001e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0003\u0000\n\u0000\u001e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0001\u0000\u0004\u0000\u003c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0001\u0000\u0004\u0000\u003c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u00c0\u0001\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u007f\u0080\u0001\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00fe\u00ff\u00ff\u00ff\u003f\u0080\u0001\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u00ff\u00ff\u00fe\u00ff\u00ff\u00ff\u003f\u0000\u0001\u0000\u0000\u0000\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u007f\u00fe\u00ff\u00ff\u00ff\u003f\u0000\u0003\u0000\u0002\u0000\u0018\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u00ff\u00ff\u00ff\u007f\u00fc\u00ff\u00ff\u00ff\u001f\u0000\u0002\u0000\u0006\u0000\u001c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u00ff\u00ff\u003f\u00fc\u00ff\u00ff\u00ff\u001f\u00c0\u0007\u0000\u0007\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u00ff\u001f\u00f8\u00ff\u00ff\u00ff\u000f\u00f0\u0001\u0000\u000f\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u00ff\u00ff\u000f\u00f8\u00ff\u00ff\u00ff\u000f\u007c\u0000\u00c0\u000f\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u00ff\u0007\u00f0\u00ff\u00ff\u00ff\u0007\u001e\u0000\u00f0\u003f\u0080\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u00ff\u0003\u00e0\u00ff\u00ff\u00ff\u0003\u001e\u0000\u00fc\u00ff\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u00ff\u0000\u00c0\u00ff\u00ff\u00ff\u0001\u000f\u0000\u00f8\u00ff\u0003\u0038\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u003f\u0000\u0080\u00ff\u00ff\u00ff\u0000\u000f\u0000\u00f8\u00ff\u0000\u00e0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u0007\u0000\u0000\u00ff\u00ff\u007f\u0080\u0007\u0000\u00f0\u00ff\u0000\u00e0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00ff\u001f\u0080\u0007\u0000\u00f0\u007f\u0000\u00c0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f0\u00ff\u0007\u0080\u0007\u0000\u00f0\u007f\u0000\u00c0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00ff\u0000\u0080\u0007\u0000\u00f0\u003f\u0000\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0007\u0000\u00f0\u003f\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u000f\u0000\u0038\u0038\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000f\u0000\u0008\u0020\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u001f\u0000\u0000\u0000\u0000\u0080\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u001e\u0000\u0000\u0000\u0000\u00c0\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007e\u0000\u0001\u0000\u0000\u00c0\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fc\u00c1\u0001\u0000\u0000\u00e0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u00ff\u0000\u0000\u0000\u00e0\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u00ff\u0000\u0000\u0002\u00f8\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u009f\u0000\u0000\u000e\u00fe\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0000\u0000\u00fe\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0000\u0000\u00f2\u003f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u00c3\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0001\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0003\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00c0\u0003\u0080\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u000f\u00e0\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u003f\u00f8\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00ff\u00ff\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00fe\u007f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00f8\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00e0\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000', } + _brickConfiguration = { 'wheel-diameter': 5.6, 'track-width': 18.0, @@ -194,7 +193,6 @@ def ____lights(): hal.ledOff() hal.resetLED() - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____action() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/control_logic.py index 4cb2322acc..3e29030b27 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/control_logic.py @@ -93,7 +93,6 @@ def ____logic(): hal.drawText(str(None), ___numberVar, ___numberVar) hal.drawText(str(___numberVar if ( ___booleanVar ) else ___numberVar), ___numberVar, ___numberVar) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____control() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/math_lists.py index f2fcf293b6..568c77b1ac 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/math_lists.py @@ -7,7 +7,6 @@ import os import time - def _median(l): l = sorted(l) l_len = len(l) @@ -43,6 +42,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass @@ -156,7 +156,6 @@ def ____lists(): hal.drawText(str(___numberList[-1 -___numberVar:-1 -___numberVar]), ___numberVar, ___numberVar) hal.drawText(str(___numberList[-1 -___numberVar:]), ___numberVar, ___numberVar) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____math() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_default.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_default.py index 0ea2caf47e..6506de5d96 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_default.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_default.py @@ -157,7 +157,6 @@ def ____waitUntil(): break hal.waitFor(15) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____sensors() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_ht.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_ht.py index d982742d55..237af571c8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_ht.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_ht.py @@ -77,7 +77,6 @@ def ____waitUntil(): break hal.waitFor(15) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____sensors() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_infrared_sound.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_infrared_sound.py index fe2bb48f64..144f56364c 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_infrared_sound.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/sensors_infrared_sound.py @@ -46,7 +46,6 @@ def ____waitUntil(): break hal.waitFor(15) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____sensors() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/text_colours_messages_functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/text_colours_messages_functions.py index 7c44d20b0e..a007408134 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/text_colours_messages_functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/text_colours_messages_functions.py @@ -100,7 +100,6 @@ def ____function_return_connectionList(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList return ___connectionList - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___connectionVar, ___numberList, ___booleanList, ___stringList, ___colourList, ___connectionList ____text() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/textlyJava.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/textlyJava.py index 0ce0362960..744c426a61 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/textlyJava.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/ev3dev/textlyJava.py @@ -7,7 +7,6 @@ import os import time - def _isPrime(number): if(number == 0 or number == 1): return False diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_display_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_display_test.py index 741ec46a72..128fb165d9 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_display_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_display_test.py @@ -91,7 +91,6 @@ def ____getBrightness(): microbit.display.scroll(str(microbit.display.get_pixel(0, 0))) microbit.display.clear() - def run(): global timer1, ___Animation # This program tests all display blocks (except the serial monitor) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_test.py index 422ce028c0..c4b53bcdf8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_test.py @@ -2,7 +2,6 @@ import random import math - def drive(speedLeft, speedRight): sR = scale(speedRight) sL = scale(speedLeft) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_turn_steer_block_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_turn_steer_block_test.py index 095d98d2de..4a1adc46d8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_turn_steer_block_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_drive_turn_steer_block_test.py @@ -3,7 +3,6 @@ import math import music - def drive(speedLeft, speedRight): sR = scale(speedRight) sL = scale(speedLeft) @@ -166,7 +165,6 @@ def ____steerDriveTest(): drive(0, 0) music.pitch(261, 250, microbit.pin16) - def run(): global timer1, ___speed ____steerDriveTest() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_move_motor_left_right_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_move_motor_left_right_test.py index 06ad38cb54..1c2be3c268 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_move_motor_left_right_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_move_motor_left_right_test.py @@ -2,7 +2,6 @@ import random import math - def scale(speed): if speed == 0: return 0 @@ -64,7 +63,6 @@ def ____motorLeftRightOn(): setSpeed("MOT_R", 0) setSpeed("MOT_L", 0) - def run(): global timer1, ___speed # This program tests the move motor left/right blocks diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_servo_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_servo_test.py index 1741b2b941..5d687a58ae 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_servo_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/action_servo_test.py @@ -2,7 +2,6 @@ import random import math - def servo_set_angle(pin, angle): if (angle < 0): angle = 0 if (angle > 180): angle = 180 @@ -14,6 +13,7 @@ def servo_set_angle(pin, angle): class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass + microbit.pin1.set_analog_period(20) microbit.pin13.set_analog_period(20) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/actuib_RGB_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/actuib_RGB_test.py index 17f8b9aff9..cd747466d9 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/actuib_RGB_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/actuib_RGB_test.py @@ -3,7 +3,6 @@ import math import neopixel - def led_set_colour(x, colour): global np np[x] = colour @@ -11,6 +10,7 @@ def led_set_colour(x, colour): class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass + np = neopixel.NeoPixel(microbit.pin0, 8) timer1 = microbit.running_time() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/colour_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/colour_test.py index 167aa91c02..891891745e 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/colour_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/colour_test.py @@ -3,7 +3,6 @@ import math import neopixel - def led_set_colour(x, colour): global np np[x] = colour @@ -11,6 +10,7 @@ def led_set_colour(x, colour): class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass + np = neopixel.NeoPixel(microbit.pin0, 8) timer1 = microbit.running_time() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/messages_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/messages_test.py index 31264e3450..e69baa4408 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/messages_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/messages_test.py @@ -3,7 +3,6 @@ import math import radio - def receive_message(type): msg = radio.receive() if type == "Number": diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_distance_sensor_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_distance_sensor_test.py index 0d5bcd0ccf..a737702352 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_distance_sensor_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_distance_sensor_test.py @@ -4,7 +4,6 @@ import music import machine - def ultrasonic_get_distance(echo, trigger): trigger.write_digital(0) microbit.sleep(2) @@ -15,7 +14,7 @@ def ultrasonic_get_distance(echo, trigger): duration = machine.time_pulse_us(echo, 1) distance = duration * 0.0343 / 2 - return round(distance, 2) + return round(distance, 2) class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_gestures_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_gestures_test.py index fcfaab3c60..fb3ee0459c 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_gestures_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_gestures_test.py @@ -3,7 +3,6 @@ import math import music - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_infrared_obstacle_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_infrared_obstacle_test.py index 7918a7dc3b..0f1a5aaca9 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_infrared_obstacle_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_infrared_obstacle_test.py @@ -2,7 +2,6 @@ import random import math - def drive(speedLeft, speedRight): sR = scale(speedRight) sL = scale(speedLeft) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_line_follower_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_line_follower_test.py index 4839afca16..106f41d507 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_line_follower_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_line_follower_test.py @@ -2,7 +2,6 @@ import random import math - def drive(speedLeft, speedRight): sR = scale(speedRight) sL = scale(speedLeft) @@ -102,7 +101,6 @@ def ____followLineTest(): ___speedRight = 20 drive(___speedLeft, ___speedRight) - def run(): global timer1, ___speedLeft, ___speedRight ____lineSensorsLEDTest() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_remaining_sensors_test.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_remaining_sensors_test.py index 51853eb12b..3a8d54cc6c 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_remaining_sensors_test.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_remaining_sensors_test.py @@ -2,7 +2,6 @@ import random import math - def drive(speedLeft, speedRight): sR = scale(speedRight) sL = scale(speedLeft) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/action.py index e443bd8561..910e5b78ca 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/action.py @@ -31,7 +31,6 @@ def RGBAsString(rgb): color_diffs.append((color_diff, color)) return min(color_diffs)[1] - _trackWidth = 11.5 _circumference = 20.420352248333657 _diffPortsSwapped = False @@ -47,7 +46,6 @@ def RGBAsString(rgb): "black": (0,0,0) } - def ____action(): ____drive() ____move() @@ -123,7 +121,6 @@ def ____lights(): mbuild.quad_rgb_sensor.set_led(RGBAsString((204, 0, 0)), 1) mbuild.quad_rgb_sensor.off_led(1) - def run(): ____action() @@ -137,4 +134,5 @@ def main(): finally: mbot2.motor_stop("all") mbot2.EM_stop("all") + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/connection.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/connection.py index f8374dfc99..c700979038 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/connection.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/connection.py @@ -2,7 +2,6 @@ import time import math, random - def run(): cyberpi.wifi_broadcast.set("Channel1", "1") cyberpi.wifi_broadcast.set("Channel1", 0) @@ -16,4 +15,5 @@ def main(): cyberpi.display.show_label("Exeption on Mbot 2", 16, int(8 * 0 + 5), int(17 * 0)) cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1)) raise + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/control_logic.py index 19db970cf0..5c42c89e99 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/control_logic.py @@ -57,7 +57,6 @@ def ____logic(): cyberpi.console.println(None) cyberpi.console.println(___numberVar if ( ___booleanVar ) else ___booleanVar) - def run(): global ___booleanVarFalse, ___booleanVar, ___numberList, ___booleanList, ___stringList, ___colorList, ___numberVar, ___stringVar ____control() @@ -70,4 +69,5 @@ def main(): cyberpi.display.show_label("Exeption on Mbot 2", 16, int(8 * 0 + 5), int(17 * 0)) cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1)) raise + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/math_lists.py index ed659a8335..b961c93374 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/math_lists.py @@ -136,7 +136,6 @@ def ____math(): cyberpi.console.println(str(___numberVar)) cyberpi.console.println(chr((int)(___numberVar))) - def run(): global ___numberVar, ___booleanVar, ___stringVar, ___colorVar, ___numberList, ___booleanList, ___stringList, ___colorList ____math() @@ -149,4 +148,5 @@ def main(): cyberpi.display.show_label("Exeption on Mbot 2", 16, int(8 * 0 + 5), int(17 * 0)) cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1)) raise + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/sensors.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/sensors.py index 80cb3f423d..fa79ab3fc9 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/sensors.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/sensors.py @@ -1,6 +1,7 @@ import cyberpi, mbot2, mbuild import time import math, random + _timer1 = cyberpi.timer.get() _timer2 = cyberpi.timer.get() _timer3 = cyberpi.timer.get() @@ -18,7 +19,6 @@ "black": (0,0,0) } - ___numVar = 0 ___colourVar = (204, 0, 0) ___numList = [] @@ -120,7 +120,6 @@ def ____wait_until(): if (mbot2.EM_get_angle("EM1") / 360) > 2: break - def run(): global _timer1, _timer2, _timer3, _timer4, _timer5, ___numVar, ___colourVar, ___numList, ___booleanVar ____sensors() @@ -136,4 +135,5 @@ def main(): finally: mbot2.motor_stop("all") mbot2.EM_stop("all") + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/text_colours_functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/text_colours_functions.py index 5b7048664e..e050adc6c4 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/text_colours_functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/mbot2/text_colours_functions.py @@ -11,7 +11,6 @@ def RGBAsString(rgb): color_diffs.append((color_diff, color)) return min(color_diffs)[1] - _colors = { "red": (204,0,0), "yellow": (255,255,0), @@ -23,7 +22,6 @@ def RGBAsString(rgb): "black": (0,0,0) } - ___colorVar = (204, 0, 0) ___stringVar = "1" ___booleanVar = True @@ -166,7 +164,6 @@ def ____function_returnColorList(): global ___colorVar, ___stringVar, ___booleanVar, ___numberVar, ___numberList, ___booleanList, ___stringList, ___colorList return ___colorList - def run(): global ___colorVar, ___stringVar, ___booleanVar, ___numberVar, ___numberList, ___booleanList, ___stringList, ___colorList ____colours() @@ -188,4 +185,5 @@ def main(): cyberpi.display.show_label("Exeption on Mbot 2", 16, int(8 * 0 + 5), int(17 * 0)) cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1)) raise + main() \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/messages.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/messages.py index e6e86dcb13..396d746eba 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/messages.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/messages.py @@ -3,7 +3,6 @@ import math import radio - def receive_message(type): msg = radio.receive() if type == "Number": diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/sensor_gesture_compass_accelerometer.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/sensor_gesture_compass_accelerometer.py index 8fec8f44b1..46e9a38da8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/sensor_gesture_compass_accelerometer.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbit/sensor_gesture_compass_accelerometer.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/messages.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/messages.py index e6e86dcb13..396d746eba 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/messages.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/messages.py @@ -3,7 +3,6 @@ import math import radio - def receive_message(type): msg = radio.receive() if type == "Number": diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/sensor_gesture_compass_accelerometer.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/sensor_gesture_compass_accelerometer.py index 8fec8f44b1..46e9a38da8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/sensor_gesture_compass_accelerometer.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/sensor_gesture_compass_accelerometer.py @@ -2,7 +2,6 @@ import random import math - class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/textlyJava.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/textlyJava.py index ca72788121..d7619c46b5 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/textlyJava.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/microbitv2/textlyJava.py @@ -3,7 +3,6 @@ import math import radio - def _isPrime(number): if(number == 0 or number == 1): return False diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/action.py index 6d8999e858..cc4a550763 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/action.py @@ -4,13 +4,11 @@ import time import random from roberta import Hal -h = Hal() +h = Hal() from roberta import FaceRecognitionModule faceRecognitionModule = FaceRecognitionModule("faceRecognitionModule") - - ___numberVar = 0 ___booleanVar = True ___stringVar = "" @@ -216,7 +214,6 @@ def ____lights(): h.randomEyes(___numberVar) h.rasta(___numberVar) - def run(): h.setAutonomousLife('ON') global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/control_logic.py index 827e9cec71..055dc79d3c 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/control_logic.py @@ -4,14 +4,12 @@ import time import random from roberta import Hal -h = Hal() +h = Hal() class BreakOutOfALoop(Exception): pass class ContinueLoop(Exception): pass - - ___numberVar = 0 ___booleanVar = True ___stringVar = "" @@ -77,7 +75,6 @@ def ____logic(): h.say(str(None)) h.say(str(___numberVar if ( ___booleanVar ) else ___numberVar)) - def run(): h.setAutonomousLife('ON') global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/math_lists.py index efe30929d1..ab31a326c8 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/math_lists.py @@ -30,9 +30,8 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) -h = Hal() - +h = Hal() ___numberVar = 0 ___booleanVar = True @@ -132,7 +131,6 @@ def ____lists(): h.say(str(___numberList[0:-1 -___numberVar])) h.say(str(___numberList[0:])) - def run(): h.setAutonomousLife('ON') global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/sensors.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/sensors.py index e185c14688..9f94783d1e 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/sensors.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/sensors.py @@ -4,20 +4,17 @@ import time import random from roberta import Hal + h = Hal() h.sonar.subscribe("OpenRobertaApp") h.mark.subscribe("RobertaLab", 500, 0.0) - from roberta import FaceRecognitionModule faceRecognitionModule = FaceRecognitionModule("faceRecognitionModule") - from roberta import SpeechRecognitionModule speechRecognitionModule = SpeechRecognitionModule("speechRecognitionModule") speechRecognitionModule.pauseASR() h.sonar.subscribe("OpenRobertaApp") - - ___numberVar = 0 ___booleanVar = True ___stringVar = "" @@ -253,7 +250,6 @@ def ____sensorsWaitUntil(): break h.wait(15) - def run(): h.setAutonomousLife('ON') global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/text_colours_functions.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/text_colours_functions.py index 9ef27a4b9e..7a3f45c98e 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/text_colours_functions.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/nao/text_colours_functions.py @@ -4,9 +4,8 @@ import time import random from roberta import Hal -h = Hal() - +h = Hal() ___numberVar = 0 ___booleanVar = True @@ -133,7 +132,6 @@ def ____function_return_colourList(): global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList return ___colourList - def run(): h.setAutonomousLife('ON') global ___numberVar, ___booleanVar, ___stringVar, ___colourVar, ___numberList, ___booleanList, ___stringList, ___colourList diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/action.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/action.py index 91f9ad8960..6012a9722f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/action.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/action.py @@ -99,14 +99,11 @@ def turnForDegrees(RV, speed, degrees): _digitalPinValues = [0 for i in range(8)] currentSpeed = [0, 0, 0] - - def run(RV): time.sleep(1) resetOdometry(RV, 0, 0, 0) - driveForDistance(RV, 30, 0, 30) - time.sleep(500/1000) + time.sleep(500 / 1000) turnForDegrees(RV, -30, 20) driveToPosition(RV, 10, 10, 30) setSpeedOmnidrivePercent(30, 0, 0) @@ -139,4 +136,3 @@ def stop(RV): def cleanup(RV): pass - diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/control_logic.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/control_logic.py index 80862fa54f..3af6a37f79 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/control_logic.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/control_logic.py @@ -18,7 +18,6 @@ def isBumped(): MAXROTATION = 0.57 - ___booleanFalse = None ___booleanTrue = None ___number = None @@ -69,13 +68,12 @@ def ____control(): if ___booleanTrue: break time.sleep(0.2) - time.sleep(500/1000) + time.sleep(500 / 1000) while True: if isBumped() == True: break time.sleep(0.2) - def run(RV): global ___booleanFalse, ___booleanTrue, ___number, ___numberList time.sleep(1) @@ -83,7 +81,6 @@ def run(RV): ___booleanTrue = True ___number = 0 ___numberList = [0, 0, 0] - ____control() ____logic() @@ -106,4 +103,3 @@ def stop(RV): def cleanup(RV): pass - diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/math_lists.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/math_lists.py index b7367b0dbc..46b8e21b6f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/math_lists.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/math_lists.py @@ -26,6 +26,7 @@ def _standard_deviation(l): for i in l: sd += (i - mean)*(i - mean) return math.sqrt(sd / len(l)) + sys.stdout = io.StringIO() sys.stderr = io.StringIO() ROBOTINOIP = "127.0.0.1:80" @@ -34,7 +35,6 @@ def _standard_deviation(l): MAXROTATION = 0.57 - ___booleanFalse = None ___booleanTrue = None ___number = None @@ -107,7 +107,6 @@ def ____math(): ___string = str(___number) ___string = chr((int)(___number)) - def run(RV): global ___booleanFalse, ___booleanTrue, ___number, ___numberList, ___string, ___numberlist2 time.sleep(1) @@ -117,7 +116,6 @@ def run(RV): ___numberList = [0, 0, 0] ___string = "" ___numberlist2 = [] - ____math() ____lists() @@ -140,4 +138,3 @@ def stop(RV): def cleanup(RV): pass - diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/sensor.py index fe1b078910..1d3620f88b 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/sensor.py @@ -107,7 +107,6 @@ def resetOdometry(RV, x, y, z): _timer4 = None _timer5 = None - ___Element5 = None ___Element6 = None ___Element7 = None @@ -150,19 +149,18 @@ def run(RV): ___Element14 = getOdometry('rot') * (180 / math.pi) ___Element15 = getDistance(1) ___Element16 = isBumped() - ___Element = ((time.time() - _timer1)/1000) - ___Element17 = ((time.time() - _timer2)/1000) - ___Element18 = ((time.time() - _timer3)/1000) - ___Element19 = ((time.time() - _timer4)/1000) - ___Element20 = ((time.time() - _timer5)/1000) + ___Element = ((time.time() - _timer1) / 1000) + ___Element17 = ((time.time() - _timer2) / 1000) + ___Element18 = ((time.time() - _timer3) / 1000) + ___Element19 = ((time.time() - _timer4) / 1000) + ___Element20 = ((time.time() - _timer5) / 1000) ___Element2 = getColourBlob(RV, [40, 56, 42, 100, 53, 100]) - resetOdometry(RV, 0, RV.readFloatVector(1)[1], RV.readFloatVector(1)[2]) resetOdometry(RV, RV.readFloatVector(1)[0], 0, RV.readFloatVector(1)[2]) resetOdometry(RV, RV.readFloatVector(1)[0], RV.readFloatVector(1)[1], 0) resetOdometry(RV, 0, 0, 0) ___Element2 = getMarkers(RV) - time.sleep(500/1000) + time.sleep(500 / 1000) ___Element2 = getMarkerInformation(RV, 0) RV.writeFloat(4, 100) time.sleep(0.005) @@ -186,4 +184,3 @@ def stop(RV): def cleanup(RV): pass - diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/timer.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/timer.py index c7a2478918..c50f0f8dba 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/timer.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/robotino/timer.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import math, random, time, requests, threading, sys, io + sys.stdout = io.StringIO() sys.stderr = io.StringIO() ROBOTINOIP = "127.0.0.1:80" @@ -9,7 +10,6 @@ _timer1 = None - ___Element = None ___Element2 = None ___Element3 = None @@ -20,12 +20,11 @@ def run(RV): global ___Element, ___Element2, ___Element3, ___Element4, ___Element5, _timer1 time.sleep(1) _timer1 = time.time() - ___Element = ((time.time() - _timer1)/1000) - ___Element2 = ((time.time() - _timer1)/1000) - ___Element3 = ((time.time() - _timer1)/1000) - ___Element4 = ((time.time() - _timer1)/1000) - ___Element5 = ((time.time() - _timer1)/1000) - + ___Element = ((time.time() - _timer1) / 1000) + ___Element2 = ((time.time() - _timer1) / 1000) + ___Element3 = ((time.time() - _timer1) / 1000) + ___Element4 = ((time.time() - _timer1) / 1000) + ___Element5 = ((time.time() - _timer1) / 1000) _timer1 = time.time() _timer2 = time.time() _timer3 = time.time() @@ -51,4 +50,3 @@ def stop(RV): def cleanup(RV): pass - diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/actionSoundLight.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/actionSoundLight.py index d5541dd884..9b37b2ee4b 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/actionSoundLight.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/actionSoundLight.py @@ -15,7 +15,6 @@ def set_status_light(color): color = 'black' hub.status_light.on(color) - hub = spike.PrimeHub() def run(): diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/control.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/control.py index f359d02ec9..a487fbcc40 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/control.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/control.py @@ -7,7 +7,6 @@ def set_status_light(color): color = 'black' hub.status_light.on(color) - touch_sensor_B = spike.ForceSensor('F') hub = spike.PrimeHub() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/sensor.py index c38e595a31..f47a64b7ca 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spike/sensor.py @@ -13,7 +13,6 @@ def set_status_light(color): color = 'black' hub.status_light.on(color) - touch_sensor_B = spike.ForceSensor('F') touch_sensor_B = spike.ForceSensor('F') ultrasonic_sensor_U = spike.DistanceSensor('D') diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDisplay.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDisplay.py index 5b9b1dacd4..dae7ccdfd2 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDisplay.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDisplay.py @@ -15,11 +15,8 @@ def show_animation(image_list): wait(500 * len(image_list) - 10) hub.display.icon(image_list[len(image_list)-1]) - - hub = PrimeHub() - ___item = [Matrix([[0, 100, 0, 100, 0], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [0, 100, 100, 100, 0], [0, 0, 100, 0, 0]]), Matrix([[0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 100, 100, 100, 0], [0, 0, 100, 0, 0], [0, 0, 0, 0, 0]]), Matrix([[0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [100, 0, 0, 0, 100], [0, 100, 100, 100, 0]]), Matrix([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [100, 0, 0, 0, 100], [0, 100, 100, 100, 0]]), Matrix([[0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [100, 0, 100, 0, 100]]), Matrix([[100, 0, 0, 0, 100], [0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [100, 100, 100, 100, 100], [100, 0, 100, 0, 100]]), Matrix([[0, 0, 0, 0, 0], [100, 100, 0, 100, 100], [0, 0, 0, 0, 0], [0, 100, 100, 100, 0], [0, 0, 0, 0, 0]]), Matrix([[0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [0, 0, 100, 0, 0], [0, 100, 0, 100, 0], [0, 0, 100, 0, 0]]), Matrix([[100, 0, 0, 0, 100], [0, 0, 0, 0, 0], [100, 100, 100, 100, 100], [0, 0, 100, 0, 100], [0, 0, 100, 100, 100]]), Matrix([[100, 100, 100, 100, 100], [100, 100, 0, 100, 100], [0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 100, 100, 100, 0]]), Matrix([[0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [0, 0, 0, 100, 0], [0, 0, 100, 0, 0], [0, 100, 0, 0, 0]])] def run(): diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDrive.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDrive.py index 068013a43f..4f1d78db3b 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDrive.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionDrive.py @@ -102,17 +102,14 @@ def turn_for(power, degrees, direction): drive_base.settings(turn_rate = tr) drive_base.turn( sign * degrees * direction ) - left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE) right_motor = Motor(Port.B) TRACKWIDTH = 11.5 * 10 WHEEL_DIAMETER = 56 drive_base = DriveBase(left_motor, right_motor, wheel_diameter=WHEEL_DIAMETER, axle_track=TRACKWIDTH) -drive_base.settings(straight_acceleration=810*10, turn_acceleration=810*10) - +drive_base.settings(straight_acceleration=810 * 10, turn_acceleration=810 * 10) hub = PrimeHub() - def run(): drive_straight(30,10) drive_straight(30,10* -1) @@ -127,7 +124,7 @@ def run(): wait(500) diff_drive(-30, -30, False) wait(500) - drive_base.drive(0,0) + drive_base.drive(0, 0) wait(500) turn_for(30,20,1) turn_for(30,20,-1) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionLight.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionLight.py index a69894588f..2ab8b47ba6 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionLight.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionLight.py @@ -23,22 +23,19 @@ def hub_light_on(color): elif color == Color.WHITE : hub.light.on(Color(0,0,100)) - -Color.MAGENTA = Color(315,50,15) -Color.BLUE = Color(225,20,20) -Color.AZURE = Color(200,20,20) -Color.CYAN = Color(150,20,20) -Color.YELLOW = Color(55,35,35) -Color.RED = Color(350,35,35) -Color.BLACK = Color(0,10,10) -Color.WHITE = Color(0,0,70) - +Color.MAGENTA = Color(315, 50, 15) +Color.BLUE = Color(225, 20, 20) +Color.AZURE = Color(200, 20, 20) +Color.CYAN = Color(150, 20, 20) +Color.YELLOW = Color(55, 35, 35) +Color.RED = Color(350, 35, 35) +Color.BLACK = Color(0, 10, 10) +Color.WHITE = Color(0, 0, 70) color_sensor_F = ColorSensor(Port.C) color_sensor_F.detectable_colors([Color.MAGENTA, Color.BLUE, Color.AZURE, Color.CYAN, Color.YELLOW, Color.RED, Color.BLACK, Color.WHITE, Color.NONE]) hub = PrimeHub() - def run(): hub_light_on(Color.MAGENTA) wait(500) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionMove.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionMove.py index d52822359e..614b0cd1aa 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionMove.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionMove.py @@ -12,13 +12,10 @@ def get_deg_sec_from_percent(percent): percent = 100 return int(810.0 * (percent/100.0)) - motorA = Motor(Port.A) motorB = Motor(Port.B) - hub = PrimeHub() - def run(): motorA.run_angle(rotation_angle = 360 * 1, speed = get_deg_sec_from_percent(30)) motorA.run_angle(rotation_angle = 360 * -30, speed = get_deg_sec_from_percent(-30)) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionSounds.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionSounds.py index a7d84b701f..8555557058 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionSounds.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/actionSounds.py @@ -8,12 +8,9 @@ def show_animation(image_list): wait(500 * len(image_list) - 10) hub.display.icon(image_list[len(image_list)-1]) - - hub = PrimeHub() hub.speaker.volume(15) - ___A = 440 ___C = float(261.6) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/colours.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/colours.py index 118b979d32..5f08c1ed39 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/colours.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/colours.py @@ -12,20 +12,17 @@ def hub_light_on(color): elif color == Color.WHITE : hub.light.on(Color(0,0,100)) - -Color.MAGENTA = Color(315,50,15) -Color.BLUE = Color(225,20,20) -Color.AZURE = Color(200,20,20) -Color.CYAN = Color(150,20,20) -Color.YELLOW = Color(55,35,35) -Color.RED = Color(350,35,35) -Color.BLACK = Color(0,10,10) -Color.WHITE = Color(0,0,70) - +Color.MAGENTA = Color(315, 50, 15) +Color.BLUE = Color(225, 20, 20) +Color.AZURE = Color(200, 20, 20) +Color.CYAN = Color(150, 20, 20) +Color.YELLOW = Color(55, 35, 35) +Color.RED = Color(350, 35, 35) +Color.BLACK = Color(0, 10, 10) +Color.WHITE = Color(0, 0, 70) hub = PrimeHub() - def run(): hub_light_on(Color.MAGENTA) wait(500) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/control.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/control.py index 41095f5253..e0a868d976 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/control.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/control.py @@ -10,11 +10,8 @@ def display_text(text): text_list[idx] = '?' hub.display.text("".join(text_list)) - - hub = PrimeHub() - ___item2 = [0, 0, 0] def run(): diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/controlWait.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/controlWait.py index e6a6e7a658..908e5561d4 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/controlWait.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/controlWait.py @@ -5,11 +5,9 @@ import umath as math import urandom as random - touch_sensor_B = ForceSensor(Port.F) hub = PrimeHub() - def run(): while True: if True: diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/empty.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/empty.py index 2cae550f6b..853d2ba184 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/empty.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/empty.py @@ -3,10 +3,8 @@ import umath as math import urandom as random - hub = PrimeHub() - def run(): pass diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/mathImports.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/mathImports.py index ff1121c500..8fbfc192d0 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/mathImports.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/mathImports.py @@ -10,11 +10,8 @@ def display_text(text): text_list[idx] = '?' hub.display.text("".join(text_list)) - - hub = PrimeHub() - ___item = 0 def run(): @@ -24,7 +21,7 @@ def run(): # thjs is a J display_text(str(chr((int)(74)))) ___item = math.sqrt(math.pi) + math.sin(math.e) - ___item = - (10 **math.e**math.log(math.log(abs((1 + 5 ** 0.5) / 2 * (1 + 5 ** 0.5) / 2 + math.cos(math.sqrt(2)))))/math.log(10)) + ___item = - (10 ** math.e**math.log(math.log(abs((1 + 5 ** 0.5) / 2 * (1 + 5 ** 0.5) / 2 + math.cos(math.sqrt(2))))) / math.log(10)) ___item += 1 display_text(str(min(max(( ( math.ceil(___item) ) % ( math.floor(___item) ) ), 1), 2))) display_text(str(random.randint(1, 100))) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensor.py index 4b1dc68c22..3c35779ec3 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensor.py @@ -52,18 +52,16 @@ def hsv2rgb(color): elif 0.0 <= h < 360: rgb = (c, 0, x) - return list(map(lambda n: (n + m) * 255, rgb)) - - -Color.MAGENTA = Color(315,50,15) -Color.BLUE = Color(225,20,20) -Color.AZURE = Color(200,20,20) -Color.CYAN = Color(150,20,20) -Color.YELLOW = Color(55,35,35) -Color.RED = Color(350,35,35) -Color.BLACK = Color(0,10,10) -Color.WHITE = Color(0,0,70) + return list(map(lambda n: (n + m) * 255, rgb)) +Color.MAGENTA = Color(315, 50, 15) +Color.BLUE = Color(225, 20, 20) +Color.AZURE = Color(200, 20, 20) +Color.CYAN = Color(150, 20, 20) +Color.YELLOW = Color(55, 35, 35) +Color.RED = Color(350, 35, 35) +Color.BLACK = Color(0, 10, 10) +Color.WHITE = Color(0, 0, 70) touch_sensor_B = ForceSensor(Port.F) touch_sensor_B = ForceSensor(Port.F) @@ -73,7 +71,6 @@ def hsv2rgb(color): stopWatch = StopWatch() hub = PrimeHub() - def run(): display_text(str((Button.LEFT in hub.buttons.pressed()))) display_text(str(touch_sensor_B.pressed())) @@ -103,15 +100,15 @@ def run(): break display_text(str("Ambient Light Above 30%")) while True: - if int(hsv2rgb(color_sensor_F.hsv())[0]/2.55) < 30: + if int(hsv2rgb(color_sensor_F.hsv())[0] / 2.55) < 30: break display_text(str("Red Above 30%")) while True: - if int(hsv2rgb(color_sensor_F.hsv())[1]/2.55) < 30: + if int(hsv2rgb(color_sensor_F.hsv())[1] / 2.55) < 30: break display_text(str("Green Above 30%")) while True: - if int(hsv2rgb(color_sensor_F.hsv())[2]/2.55) < 30: + if int(hsv2rgb(color_sensor_F.hsv())[2] / 2.55) < 30: break display_text(str("Blue Above 30%")) while True: diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGesture.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGesture.py index cc7b246de6..16ed790d42 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGesture.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGesture.py @@ -56,13 +56,10 @@ def is_tapped(threshold = 5000): wait(20) return False - - stopWatch = StopWatch() hub = PrimeHub() hub.imu.reset_heading(0) - def run(): display_text(str((hub.imu.up() == Side.TOP))) while True: diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGyro.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGyro.py index a65a3f5f11..e18e4afc9e 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGyro.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/spikePybricks/sensorGyro.py @@ -11,12 +11,9 @@ def display_text(text): text_list[idx] = '?' hub.display.text("".join(text_list)) - - hub = PrimeHub() hub.imu.reset_heading(0) - def run(): while True: display_text(str("".join(str(arg) for arg in ["x", hub.imu.tilt()[0], "y", hub.imu.tilt()[1], "z", int(hub.imu.heading()%180 if abs(hub.imu.heading()%360) < 180 else -abs(hub.imu.heading()%360 - 360))]))) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/camera.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/camera.py index a7e42d3db0..7952ee77bf 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/camera.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/camera.py @@ -5,7 +5,6 @@ import math import time - def get_ball_information(detector): if detector.detected(): return [detector.get_center_x(), @@ -61,7 +60,6 @@ def get_line_information(detector, index): TXT_M_USB1_1_camera.set_width(320) TXT_M_USB1_1_camera.set_fps(15) TXT_M_USB1_1_camera.start() - motion_detector_M = txt_factory.camera_factory.create_motion_detector(0, 100, 320, 20, 100) TXT_M_USB1_1_camera.add_detector(motion_detector_M) motion_detector_M2 = txt_factory.camera_factory.create_motion_detector(0, 100, 320, 20, 49) @@ -81,7 +79,6 @@ def get_line_information(detector, index): txt_factory.initialized() time.sleep(0.1) - def camera_initialized(): while True: try: @@ -97,7 +94,6 @@ def camera_initialized(): except Exception: pass - def ____motion(): print("Motiondetectors") while True: diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/combi_sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/combi_sensor.py index b0ff95fa33..fb0e100ba5 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/combi_sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/combi_sensor.py @@ -15,8 +15,6 @@ TXT_M_I2C_1_combined_sensor_6pin.init_gyrometer(250, 12.5) time.sleep(0.1) - - def ____combiSensor(): print("CombiSensor aka IMU") print("Acceleration X") diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/diff_drive.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/diff_drive.py index 609e01aa66..94803814b0 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/diff_drive.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/diff_drive.py @@ -3,7 +3,6 @@ import math import time - def diffdrive_turn_degrees(speed, degrees): if degrees < 0: speed = -speed @@ -79,7 +78,6 @@ def speed_to_pwm(speed): TRACK_WIDTH = 15 STEPS_PER_ROTATION = 128 - def run(): print("Driving Forwards") diffdrive(30) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/display.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/display.py index 941ccb6e4e..080a63dbbf 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/display.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/display.py @@ -3,7 +3,6 @@ import math import time - def clear_display(): for i in range(8): display.set_attr("line" + str(i) + ".text", "") @@ -44,12 +43,10 @@ def get_closest_color(hex_value): "black": 0x000000 } - def run(): for color, value in led_colors.items(): if color != "red": display.set_attr(color + "Led.visible", str(False).lower()) - print("Display Test") print("Show Text on Display ") display.set_attr("line" + str(0) + ".text", str("ROW 0")) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/gesture_environment_sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/gesture_environment_sensor.py index feb69700af..c7d7d539d6 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/gesture_environment_sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/gesture_environment_sensor.py @@ -15,8 +15,6 @@ TXT_M_I2C_2_gesture_sensor.enable_proximity() time.sleep(0.1) - - def ____environmentalSensor(): print("Environmental Sensor") print("starting calibration if needed this takes a few minutes") diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/led.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/led.py index 06567d341e..e0f036341a 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/led.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/led.py @@ -6,11 +6,11 @@ txt_factory.init_input_factory() txt_factory.init_output_factory() TXT_M = txt_factory.controller_factory.create_graphical_controller() + TXT_M_O5_led = txt_factory.output_factory.create_led(TXT_M, 5) txt_factory.initialized() time.sleep(0.1) - def run(): print("LED on port O5 test") print("LED ON") diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/motor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/motor.py index a11d05d4e4..5a81b4ee76 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/motor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/motor.py @@ -3,7 +3,6 @@ import math import time - def motor_start(motor, speed): motor.set_speed(speed_to_pwm(speed), Motor.CCW) motor.start() @@ -46,7 +45,6 @@ def speed_to_pwm(speed): time.sleep(0.1) STEPS_PER_ROTATION = 128 - def run(): print("Moving Motors") print("M1 Motor for 2 seconds") diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/omni_drive.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/omni_drive.py index 865861458f..3d04576db2 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/omni_drive.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/omni_drive.py @@ -3,7 +3,6 @@ import math import time - def motor_start(motor, speed): motor.set_speed(speed_to_pwm(speed), Motor.CCW) motor.start() @@ -110,7 +109,6 @@ def speed_to_pwm(speed): WHEEL_BASE = 10.2 STEPS_PER_ROTATION = 128 - def run(): print("Driving Forwards") omnidrive_curve(30, 30, 30, 30) diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sensor.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sensor.py index 3b1ed93094..5ce1e1e189 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sensor.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sensor.py @@ -4,7 +4,6 @@ import math import time - def motor_start(motor, speed): motor.set_speed(speed_to_pwm(speed), Motor.CCW) motor.start() diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sound.py b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sound.py index 092ab455aa..652f4a902f 100644 --- a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sound.py +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/txt4/sound.py @@ -5,10 +5,10 @@ txt_factory.init() txt_factory.init_input_factory() TXT_M = txt_factory.controller_factory.create_graphical_controller() + txt_factory.initialized() time.sleep(0.1) - def run(): TXT_M.get_loudspeaker().play("01_Airplane.wav", False) while TXT_M.get_loudspeaker().is_playing(): diff --git a/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.objects.js b/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.objects.js index 98bc6691fb..d7be2f04f4 100644 --- a/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.objects.js +++ b/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.objects.js @@ -1,3 +1,3 @@ -var __extends=this&&this.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])},t(e,s)};return function(e,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function i(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),__spreadArray=this&&this.__spreadArray||function(t,e,s){if(s||2===arguments.length)for(var i,r=0,o=e.length;r=0)switch(t.stopImmediatePropagation(),o){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);this.isMouseOn(e)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());for(var a=-1,c=0;c-1&&this.selected)switch(t.stopImmediatePropagation(),a){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}if(n>=0&&this.selected){if(this.w>=this.MIN_SIZE_OBJECT&&this.h>=this.MIN_SIZE_OBJECT)switch(n){case 0:this.x+=o,this.y+=h,this.w-=o,this.h-=h;break;case 1:this.y+=h,this.w+=o,this.h-=h;break;case 2:this.w+=o,this.h+=h;break;case 3:this.x+=o,this.w-=o,this.h+=h}else this.wthis.x&&t.startXthis.y&&t.startY=1&&(l.r=a[0]),a.length>=2&&(l.movable=a[1]>0),l.updateCorners(),l}return __extends(e,t),e.prototype.draw=function(t,e){if(t.save(),e.save(),this.type!==n.Obstacle&&this.type!==n.ColorArea||(this.type===n.Obstacle&&(t.shadowColor="#3e3e3e",t.shadowOffsetY=5,t.shadowOffsetX=5,t.shadowBlur=5,t.globalCompositeOperation="lighten"),t.fillStyle=this.color,t.beginPath(),t.arc(this.x,this.y,this.r,0,2*Math.PI),t.fill()),this.type===n.ColorArea&&(e.fillStyle=this.color,e.beginPath(),e.arc(this.x,this.y,this.r,0,2*Math.PI),e.fill()),this.selected){var s=Math.round(this.x),i=Math.round(this.y),r=Math.round(this.r);t.restore(),t.save(),t.lineWidth=2,t.strokeStyle="gray",t.fillStyle="black",t.beginPath(),t.arc(Math.round(s-r),Math.round(i-r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s+r),Math.round(i-r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s-r),Math.round(i+r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s+r),Math.round(i+r),5,0,2*Math.PI),t.stroke(),t.fill()}t.restore(),e.restore()},e.prototype.handleKeyEvent=function(t){if(this.selected){switch(t.stopImmediatePropagation(),t.key){case"ArrowUp":this.y-=this.SHIFT;break;case"ArrowLeft":this.x-=this.SHIFT;break;case"ArrowDown":this.y+=this.SHIFT;break;case"ArrowRight":this.x+=this.SHIFT}if("c"===t.key&&(t.ctrlKey||t.metaKey)){this.myScene.uniqueObjectId,a.Circle;this.myScene.objectToCopy=c.copy(this),t.preventDefault()}this.updateCorners(),s("#robotLayer").attr("tabindex",0),s("#robotLayer").trigger("focus")}},e.prototype.handleMouseDown=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t;if(this.isDown=i.checkInCircle(e.startX,e.startY,this.x,this.y,this.r),this.isDown&&(t.stopImmediatePropagation(),this.mouseOldX=e.startX,this.mouseOldY=e.startY),this.isDown&&!this.selected)s("#robotLayer").css("cursor","pointer"),this.selected=!0;else if(this.selected&&!this.movable){this.corners.forEach((function(t){t.isDown=i.checkInCircle(e.startX,e.startY,t.x,t.y,15)}));var o=this.corners.map((function(t){return t.isDown})).indexOf(!0);if(o>=0)switch(t.stopImmediatePropagation(),o){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);i.checkInCircle(e.startX,e.startY,this.x,this.y,this.r)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());var a=-1;if(!this.movable)for(var c=0;c-1&&this.selected)switch(t.stopImmediatePropagation(),a){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}n>=0&&this.selected?(Math.abs(o)>=Math.abs(h)?e.startX0){var e=o.getDotProduct(t,this.lastMove);this.lastMoveBumped?e&&(e<-.9||e&&e>.9)&&this.moveTo({x:this.x+t.x,y:this.y+t.y}):(this.lastMoveBumped=!1,this.moveTo({x:this.x+t.x,y:this.y+t.y}))}this.lastMove=t,this.collisions=[]},e.prototype.addObserver=function(t){this.observers.push(t)},e.prototype.notifyObservers=function(){for(var t=0,e=this.observers;t=0&&(t.stopImmediatePropagation(),s("#robotLayer").css("cursor","move"))}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);this.isMouseOn(e)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());for(var a=-1,c=0;c-1&&this.selected&&(s("#robotLayer").css("cursor","move"),t.stopImmediatePropagation()),n>=0&&this.selected){switch(n){case 0:this.ax+=o,this.ay+=h;break;case 1:this.bx+=o,this.by+=h;break;case 2:this.cx+=o,this.cy+=h}this.updateCorners()}else this.isDown&&(this.ax+=o,this.ay+=h,this.bx+=o,this.by+=h,this.cx+=o,this.cy+=h,this.updateCorners())},e.prototype.getLines=function(){return[{x1:this.ax,x2:this.bx,y1:this.ay,y2:this.by},{x1:this.bx,x2:this.cx,y1:this.by,y2:this.cy},{x1:this.ax,x2:this.cx,y1:this.ay,y2:this.cy}]},e.prototype.moveTo=function(t){var e=this.ax-t.x,s=this.ay-t.y;this.ax=t.x,this.ay=t.y,this.bx-=e,this.by-=s,this.cx-=e,this.cy-=s,this.updateCorners()},e.prototype.isMouseOn=function(t){var e=Math.floor(Math.abs((this.bx-this.ax)*(this.cy-this.ay)-(this.cx-this.ax)*(this.by-this.ay)));return Math.floor(Math.abs((this.ax-t.startX)*(this.by-t.startY)-(this.bx-t.startX)*(this.ay-t.startY)))+Math.floor(Math.abs((this.bx-t.startX)*(this.cy-t.startY)-(this.cx-t.startX)*(this.by-t.startY)))+Math.floor(Math.abs((this.cx-t.startX)*(this.ay-t.startY)-(this.ax-t.startX)*(this.cy-t.startY)))<=e},e.prototype.updateCorners=function(){0==this.corners.length?(this.corners[0]={x:this.ax,y:this.ay,isDown:!1},this.corners[1]={x:this.bx,y:this.by,isDown:!1},this.corners[2]={x:this.cx,y:this.cy,isDown:!1}):(this.corners[0]={x:this.ax,y:this.ay,isDown:this.corners[0].isDown},this.corners[1]={x:this.bx,y:this.by,isDown:this.corners[1].isDown},this.corners[2]={x:this.cx,y:this.cy,isDown:this.corners[2].isDown}),this.redraw()},e}(h);e.TriangleSimulationObject=d;var p=function(){function t(t,e,s,i){this.x=t,this.y=e,this.w=s,this.h=i}return t.prototype.getLines=function(){return i.getLinesFromRectangle(this)},t.prototype.getTolerance=function(){return 0},t}();e.Ground=p;var f=function(t){function e(e,s,i,r,o,h,n,a){var c=t.call(this,e,s,i,r,{x:90*o+10,y:90*h+10})||this;switch(c.w=90,c.h=90,c.type=r,c.rcjType=n,c.index=String(a),c.rcjType){case"checkPoint":c.color="#FFA500";break;case"start":c.color="#81E881"}return c}return __extends(e,t),e.prototype.draw=function(t,e){t.save(),this.rcjType&&(t.lineWidth=2,t.strokeStyle=this.color,t.strokeRect(this.x,this.y,this.w,this.h)),t.fillText(this.index,this.x+60,this.y+15),t.restore()},e.prototype.handleMouseDown=function(t){},e.prototype.handleMouseMove=function(t){},e}(l);e.RcjSimulationLabel=f})); +var __extends=this&&this.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])},t(e,s)};return function(e,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function i(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),__spreadArray=this&&this.__spreadArray||function(t,e,s){if(s||2===arguments.length)for(var i,r=0,o=e.length;r=0)switch(t.stopImmediatePropagation(),o){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);this.isMouseOn(e)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());for(var a=-1,c=0;c-1&&this.selected)switch(t.stopImmediatePropagation(),a){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}if(n>=0&&this.selected){if(this.w>=this.MIN_SIZE_OBJECT&&this.h>=this.MIN_SIZE_OBJECT)switch(n){case 0:this.x+=o,this.y+=h,this.w-=o,this.h-=h;break;case 1:this.y+=h,this.w+=o,this.h-=h;break;case 2:this.w+=o,this.h+=h;break;case 3:this.x+=o,this.w-=o,this.h+=h}else this.wthis.x&&t.startXthis.y&&t.startY=1&&(l.r=a[0]),a.length>=2&&(l.movable=a[1]>0),l.updateCorners(),l}return __extends(e,t),e.prototype.draw=function(t,e){if(t.save(),e.save(),this.type!==n.Obstacle&&this.type!==n.ColorArea||(this.type===n.Obstacle&&(t.shadowColor="#3e3e3e",t.shadowOffsetY=5,t.shadowOffsetX=5,t.shadowBlur=5,t.globalCompositeOperation="lighten"),t.fillStyle=this.color,t.beginPath(),t.arc(this.x,this.y,this.r,0,2*Math.PI),t.fill()),this.type===n.ColorArea&&(e.fillStyle=this.color,e.beginPath(),e.arc(this.x,this.y,this.r,0,2*Math.PI),e.fill()),this.selected){var s=Math.round(this.x),i=Math.round(this.y),r=Math.round(this.r);t.restore(),t.save(),t.lineWidth=2,t.strokeStyle="gray",t.fillStyle="black",t.beginPath(),t.arc(Math.round(s-r),Math.round(i-r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s+r),Math.round(i-r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s-r),Math.round(i+r),5,0,2*Math.PI),t.stroke(),t.fill(),t.beginPath(),t.arc(Math.round(s+r),Math.round(i+r),5,0,2*Math.PI),t.stroke(),t.fill()}t.restore(),e.restore()},e.prototype.handleKeyEvent=function(t){if(this.selected){switch(t.stopImmediatePropagation(),t.key){case"ArrowUp":this.y-=this.SHIFT;break;case"ArrowLeft":this.x-=this.SHIFT;break;case"ArrowDown":this.y+=this.SHIFT;break;case"ArrowRight":this.x+=this.SHIFT}if("c"===t.key&&(t.ctrlKey||t.metaKey)){this.myScene.uniqueObjectId,a.Circle;this.myScene.objectToCopy=c.copy(this),t.preventDefault()}this.updateCorners(),s("#robotLayer").attr("tabindex",0),s("#robotLayer").trigger("focus")}},e.prototype.handleMouseDown=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t;if(this.isDown=i.checkInCircle(e.startX,e.startY,this.x,this.y,this.r),this.isDown&&(t.stopImmediatePropagation(),this.mouseOldX=e.startX,this.mouseOldY=e.startY),this.isDown&&!this.selected)s("#robotLayer").css("cursor","pointer"),this.selected=!0;else if(this.selected&&!this.movable){this.corners.forEach((function(t){t.isDown=i.checkInCircle(e.startX,e.startY,t.x,t.y,15)}));var o=this.corners.map((function(t){return t.isDown})).indexOf(!0);if(o>=0)switch(t.stopImmediatePropagation(),o){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);i.checkInCircle(e.startX,e.startY,this.x,this.y,this.r)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());var a=-1;if(!this.movable)for(var c=0;c-1&&this.selected)switch(t.stopImmediatePropagation(),a){case 0:case 2:s("#robotLayer").css("cursor","nwse-resize");break;case 1:case 3:s("#robotLayer").css("cursor","nesw-resize")}n>=0&&this.selected?(Math.abs(o)>=Math.abs(h)?e.startX0){var e=o.getDotProduct(t,this.lastMove);this.lastMoveBumped?e&&(e<-.9||e&&e>.9)&&this.moveTo({x:this.x+t.x,y:this.y+t.y}):this.moveTo({x:this.x+t.x,y:this.y+t.y})}this.lastMove=t,this.collisions=[]},e.prototype.addObserver=function(t){this.observers.push(t)},e.prototype.notifyObservers=function(){for(var t=0,e=this.observers;t=0&&(t.stopImmediatePropagation(),s("#robotLayer").css("cursor","move"))}},e.prototype.handleMouseMove=function(t){t&&!t.startX&&i.extendMouseEvent(t,r.SimulationRoberta.Instance.scale,s("#robotLayer"));var e=t,o=e.startX-this.mouseOldX,h=e.startY-this.mouseOldY;this.mouseOldX=e.startX,this.mouseOldY=e.startY;var n=this.corners.map((function(t){return t.isDown})).indexOf(!0);this.isMouseOn(e)&&(s("#robotLayer").css("cursor","pointer"),s("#robotLayer").data("hovered",!0),this.selected&&t.stopImmediatePropagation());for(var a=-1,c=0;c-1&&this.selected&&(s("#robotLayer").css("cursor","move"),t.stopImmediatePropagation()),n>=0&&this.selected){switch(n){case 0:this.ax+=o,this.ay+=h;break;case 1:this.bx+=o,this.by+=h;break;case 2:this.cx+=o,this.cy+=h}this.updateCorners()}else this.isDown&&(this.ax+=o,this.ay+=h,this.bx+=o,this.by+=h,this.cx+=o,this.cy+=h,this.updateCorners())},e.prototype.getLines=function(){return[{x1:this.ax,x2:this.bx,y1:this.ay,y2:this.by},{x1:this.bx,x2:this.cx,y1:this.by,y2:this.cy},{x1:this.ax,x2:this.cx,y1:this.ay,y2:this.cy}]},e.prototype.moveTo=function(t){var e=this.ax-t.x,s=this.ay-t.y;this.ax=t.x,this.ay=t.y,this.bx-=e,this.by-=s,this.cx-=e,this.cy-=s,this.updateCorners()},e.prototype.isMouseOn=function(t){var e=Math.floor(Math.abs((this.bx-this.ax)*(this.cy-this.ay)-(this.cx-this.ax)*(this.by-this.ay)));return Math.floor(Math.abs((this.ax-t.startX)*(this.by-t.startY)-(this.bx-t.startX)*(this.ay-t.startY)))+Math.floor(Math.abs((this.bx-t.startX)*(this.cy-t.startY)-(this.cx-t.startX)*(this.by-t.startY)))+Math.floor(Math.abs((this.cx-t.startX)*(this.ay-t.startY)-(this.ax-t.startX)*(this.cy-t.startY)))<=e},e.prototype.updateCorners=function(){0==this.corners.length?(this.corners[0]={x:this.ax,y:this.ay,isDown:!1},this.corners[1]={x:this.bx,y:this.by,isDown:!1},this.corners[2]={x:this.cx,y:this.cy,isDown:!1}):(this.corners[0]={x:this.ax,y:this.ay,isDown:this.corners[0].isDown},this.corners[1]={x:this.bx,y:this.by,isDown:this.corners[1].isDown},this.corners[2]={x:this.cx,y:this.cy,isDown:this.corners[2].isDown}),this.redraw()},e}(h);e.TriangleSimulationObject=d;var p=function(){function t(t,e,s,i){this.x=t,this.y=e,this.w=s,this.h=i}return t.prototype.getLines=function(){return i.getLinesFromRectangle(this)},t.prototype.getTolerance=function(){return 0},t}();e.Ground=p;var f=function(t){function e(e,s,i,r,o,h,n,a){var c=t.call(this,e,s,i,r,{x:90*o+10,y:90*h+10})||this;switch(c.w=90,c.h=90,c.type=r,c.rcjType=n,c.index=String(a),c.rcjType){case"checkPoint":c.color="#FFA500";break;case"start":c.color="#81E881"}return c}return __extends(e,t),e.prototype.draw=function(t,e){t.save(),this.rcjType&&(t.lineWidth=2,t.strokeStyle=this.color,t.strokeRect(this.x,this.y,this.w,this.h)),t.fillText(this.index,this.x+60,this.y+15),t.restore()},e.prototype.handleMouseDown=function(t){},e.prototype.handleMouseMove=function(t){},e}(l);e.RcjSimulationLabel=f})); //# sourceMappingURL=simulation.objects.js.map //# sourceMappingURL=simulation.objects.js.map diff --git a/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.roberta.js b/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.roberta.js index b9baf7d353..f3060f5c71 100644 --- a/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.roberta.js +++ b/OpenRobertaServer/staticResources/js/app/simulation/simulationLogic/simulation.roberta.js @@ -1,3 +1,3 @@ -var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0?(this.scale*=1.025,this.scale>15&&(this.scale=15),s=!0):n<0&&(this.scale*=.925,this.scale<.25&&(this.scale=.25),s=!0),s){var c=this.scale-t,l=a("#canvasDiv").position(),u=this.scene.uCanvas.width*c,h=this.scene.uCanvas.height*c;l.top=l.top-h/2,l.left=l.left-u/2,a("#canvasDiv").css({top:l.top}),a("#canvasDiv").css({left:l.left}),this.scene.resetAllCanvas(!1)}return!1},e.prototype.importConfigData=function(){a("#backgroundFileSelector").val(null),a("#backgroundFileSelector").attr("accept",".json"),a("#backgroundFileSelector").off();var e=this;a("#backgroundFileSelector").onWrap("change",(function(t){var n=t.target.files[0],r=new FileReader;return r.onload=function(t){try{var n=JSON.parse(t.target.result);e.setNewConfig(n)}catch(e){console.error(e)}},r.readAsText(n),!1})),a("#backgroundFileSelector").clickWrap()},e.prototype.importImage=function(){var e=a("#backgroundFileSelector");e.val(null),e.attr("accept",".png, .jpg, .jpeg, .svg"),e.clickWrap();var t=this;e.on("change",(function(e){var n=e.target.files[0],i=new FileReader;return i.onload=function(){var e=new Image;e.onload=function(){var n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);var i=n.toDataURL("image/png"),o=new Image(n.width,n.height);o.src=i,o.onload=function(){t.scene.customBackgroundLoaded?t.scene.imgBackgroundList[t.scene.imgBackgroundList.length-1]=o:t.scene.imgBackgroundList.push(o),t.setBackground(t.scene.imgBackgroundList.length-1)},r.isLocalStorageAvailable()&&(a("#show-message-confirm").oneWrap("shown.bs.modal",(function(){a("#confirm").off(),a("#confirm").on("click",(function(e){e.preventDefault(),localStorage.setItem("customBackground",JSON.stringify({image:i.replace(/^data:image\/(png|jpg);base64,/,""),timestamp:(new Date).getTime()}))})),a("#confirmCancel").off(),a("#confirmCancel").on("click",(function(e){e.preventDefault()}))})),s.displayPopupMessage("Blockly.Msg.POPUP_BACKGROUND_STORAGE",l.Msg.POPUP_BACKGROUND_STORAGE,l.Msg.YES,l.Msg.NO))},"string"==typeof i.result&&(e.src=i.result)},i.readAsDataURL(n),!1}))},e.prototype.init=function(e,t,n,r){var s=this;this.robotType=r||this.robotType,this.storedPrograms=e,this.resetRenderUntil(e.length);var a=[];this.interpreters=e.map((function(e){var t=JSON.parse(e.javaScriptProgram);return a.push(e.configuration),new i.Interpreter(t,new o.RobotSimBehaviour,s.callbackOnTermination.bind(s),s.breakpoints,e.programName,e.updateNNView)})),this.updateDebugMode(this.debugMode);var c=e.map((function(e){return e.programName}));this.scene.init(this.robotType,t,this.interpreters,a,c,this.importPoses,n)},e.prototype.initColorPicker=function(e){var t=this;e&&e.length>0?this.colorpicker=new c("#colorpicker",{shades:1,hues:8,customColors:e,setText:!1}):this.colorpicker=new c("#colorpicker",{shades:1,hues:8,setText:!1}),this.colorpicker.on("change",(function(e){t.scene.changeColorWithColorPicker(e)}));var n=c.prototype.close;c.prototype.close=function(){a(".huebee__container").off("mouseup touchend",(function(e){e.stopPropagation(),t.resetColorpickerCursor()})),n.call(this)};var r=c.prototype.open;c.prototype.open=function(){r.call(this),a(".huebee__container").on("mouseup touchend",(function(e){t.resetColorpickerCursor()})),a(".huebee").draggable({})}},e.prototype.initEvents=function(){var e=this,t=this;a(window).on("focus",(function(){return t.start(),!1})),a(window).on("blur",(function(){return t.stop(),!1})),a("#simDiv").on("wheel mousewheel touchmove",(function(t){e.handleMouseWheel(t)})),a("#canvasDiv").on("mousedown touchstart mousemove touchmove mouseup touchend mouseout touchcancel",(function(t){e.handleMouse(t)})),a("#robotLayer").on("click touchstart",(function(e){a("#robotLayer").attr("tabindex",0),a("#robotLayer").trigger("focus"),e.preventDefault()})),a("#blocklyDiv").on("click touchstart",(function(e){a("#blocklyDiv").trigger("focus"),e.preventDefault()}))},e.prototype.interpreterAddEvent=function(e){this.updateBreakpointEvent(),this.interpreters&&this.interpreters.forEach((function(t){return t.addEvent(e)}))},e.prototype.removeBreakPoint=function(e){for(var t=0;t0&&null!==this.interpreters)for(t=0;t0&&y.push(n),n.items&&n.items.obstacles&&n.items.obstacles>0){var k={};k.id=t.scene.uniqueObjectId,k.shape=f.SimObjectShape.Rectangle,k.color="#ff0000",k.newObjecttype=f.SimObjectType.Obstacle,k.p={x:n.x*t.TILE_SIZE+t.TILE_SIZE/4+10,y:n.y*t.TILE_SIZE+t.TILE_SIZE/4+10},k.params=[.5*t.TILE_SIZE,.5*t.TILE_SIZE],I.push(k)}})),d.length>=2&&b.length>=2&&v.length>=2&&E.length>=2){d.sort((function(e,t){return e.x-t.x})),b.sort((function(e,t){return e.y-t.y})),v.sort((function(e,t){return e.x-t.x})),E.sort((function(e,t){return e.y-t.y}));var k={id:t.scene.uniqueObjectId,p:{x:d[0].x*t.TILE_SIZE+10,y:d[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.TILE_SIZE*(d[d.length-1].x-d[0].x+1),t.EV_WALL_SIZE],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},S={id:t.scene.uniqueObjectId,p:{x:b[0].x*t.TILE_SIZE+t.TILE_SIZE,y:b[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.EV_WALL_SIZE,t.TILE_SIZE*(b[b.length-1].y-b[0].y+1)],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},T={id:t.scene.uniqueObjectId,p:{x:v[0].x*t.TILE_SIZE+10,y:v[0].y*t.TILE_SIZE+t.TILE_SIZE},params:[t.TILE_SIZE*(v[v.length-1].x-v[0].x+1),t.EV_WALL_SIZE],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},w={id:t.scene.uniqueObjectId,p:{x:E[0].x*t.TILE_SIZE+10,y:E[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.EV_WALL_SIZE,t.TILE_SIZE*(E[E.length-1].y-E[0].y+1)],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle};I.push(k,S,T,w);var L=h.filter((function(e){return e.tileType.image.startsWith("ev3")}));!function(e,n){n.save(),n.translate(e.x*t.TILE_SIZE+t.TILE_SIZE/2,e.y*t.TILE_SIZE+t.TILE_SIZE/2);var r=0;switch(e.rot){case 0:break;case 90:r=Math.PI/2;break;case 180:r=Math.PI;break;case 270:r=270*Math.PI/180}n.rotate(r),n.beginPath(),n.moveTo(-t.TILE_SIZE/2,-t.TILE_SIZE/2),n.lineTo(t.TILE_SIZE/2,-t.TILE_SIZE/2),n.lineTo(t.TILE_SIZE/2,t.TILE_SIZE/2),n.closePath(),n.fillStyle="#000000",n.fill(),n.restore()}(L[Math.floor(Math.random()*L.length)],u)}if(g?m=t.getTilePose(g,e.tiles[g.next],{}):(i.rc="error",i.message="Unknown start tile"),p||(i.rc="error",i.message="Unknown evacuation zone entrance tile"),"ok"===i.rc){t.deleteAllColorArea(),t.deleteAllObstacle(),function(e,n){n.save(),n.translate(e.x*t.TILE_SIZE+t.TILE_SIZE/2,e.y*t.TILE_SIZE+t.TILE_SIZE/2);var r=0;switch(e.dir){case"top":break;case"right":r=Math.PI/2;break;case"bottom":r=Math.PI;break;case"left":r=270*Math.PI/180}n.rotate(r),n.fillStyle="#33B8CA",n.fillRect(-t.TILE_SIZE/2,-t.TILE_SIZE/2,t.TILE_SIZE,t.EV_WALL_SIZE),n.restore()}(p,u),function(e){e.strokeStyle="#dddddd",e.lineWidth=1;for(var n=1;n0)for(var u=0;u0)for(u=0;u0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0?(this.scale*=1.025,this.scale>15&&(this.scale=15),s=!0):n<0&&(this.scale*=.925,this.scale<.25&&(this.scale=.25),s=!0),s){var c=this.scale-t,l=a("#canvasDiv").position(),u=this.scene.uCanvas.width*c,h=this.scene.uCanvas.height*c;l.top=l.top-h/2,l.left=l.left-u/2,a("#canvasDiv").css({top:l.top}),a("#canvasDiv").css({left:l.left}),this.scene.resetAllCanvas(!1)}return!1},e.prototype.importConfigData=function(){a("#backgroundFileSelector").val(null),a("#backgroundFileSelector").attr("accept",".json"),a("#backgroundFileSelector").off();var e=this;a("#backgroundFileSelector").onWrap("change",(function(t){var n=t.target.files[0],r=new FileReader;return r.onload=function(t){try{var n=JSON.parse(t.target.result);e.setNewConfig(n)}catch(e){console.error(e)}},r.readAsText(n),!1})),a("#backgroundFileSelector").clickWrap()},e.prototype.importImage=function(){var e=a("#backgroundFileSelector");e.val(null),e.attr("accept",".png, .jpg, .jpeg, .svg"),e.clickWrap();var t=this;e.on("change",(function(e){var n=e.target.files[0],o=new FileReader;return o.onload=function(){var e=new Image;e.onload=function(){var n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);var o=n.toDataURL("image/png"),i=new Image(n.width,n.height);i.src=o,i.onload=function(){t.scene.customBackgroundLoaded?t.scene.imgBackgroundList[t.scene.imgBackgroundList.length-1]=i:t.scene.imgBackgroundList.push(i),t.setBackground(t.scene.imgBackgroundList.length-1)},r.isLocalStorageAvailable()&&(a("#show-message-confirm").oneWrap("shown.bs.modal",(function(){a("#confirm").off(),a("#confirm").on("click",(function(e){e.preventDefault(),localStorage.setItem("customBackground",JSON.stringify({image:o.replace(/^data:image\/(png|jpg);base64,/,""),timestamp:(new Date).getTime()}))})),a("#confirmCancel").off(),a("#confirmCancel").on("click",(function(e){e.preventDefault()}))})),s.displayPopupMessage("Blockly.Msg.POPUP_BACKGROUND_STORAGE",l.Msg.POPUP_BACKGROUND_STORAGE,l.Msg.YES,l.Msg.NO))},"string"==typeof o.result&&(e.src=o.result)},o.readAsDataURL(n),!1}))},e.prototype.init=function(e,t,n,r){var s=this;this.robotType=r||this.robotType,this.storedPrograms=e,this.resetRenderUntil(e.length);var a=[];this.interpreters=e.map((function(e){var t=JSON.parse(e.javaScriptProgram);return a.push(e.configuration),new o.Interpreter(t,new i.RobotSimBehaviour,s.callbackOnTermination.bind(s),s.breakpoints,e.programName,e.updateNNView)})),this.updateDebugMode(this.debugMode);var c=e.map((function(e){return e.programName}));this.scene.init(this.robotType,t,this.interpreters,a,c,this.importPoses,n)},e.prototype.initColorPicker=function(e){var t=this;e&&e.length>0?this.colorpicker=new c("#colorpicker",{shades:1,hues:8,customColors:e,setText:!1}):this.colorpicker=new c("#colorpicker",{shades:1,hues:8,setText:!1}),this.colorpicker.on("change",(function(e){t.scene.changeColorWithColorPicker(e)}));var n=c.prototype.close;c.prototype.close=function(){a(".huebee__container").off("mouseup touchend",(function(e){e.stopPropagation(),t.resetColorpickerCursor()})),n.call(this)};var r=c.prototype.open;c.prototype.open=function(){r.call(this),a(".huebee__container").on("mouseup touchend",(function(e){t.resetColorpickerCursor()})),a(".huebee").draggable({})}},e.prototype.initEvents=function(){var e=this,t=this;a(window).on("focus",(function(){return t.start(),!1})),a(window).on("blur",(function(){return t.stop(),!1})),a("#simDiv").on("wheel mousewheel touchmove",(function(t){e.handleMouseWheel(t)})),a("#canvasDiv").on("mousedown touchstart mousemove touchmove mouseup touchend mouseout touchcancel",(function(t){e.handleMouse(t)})),a("#robotLayer").on("click touchstart",(function(e){a("#robotLayer").attr("tabindex",0),a("#robotLayer").trigger("focus"),e.preventDefault()})),a("#blocklyDiv").on("click touchstart",(function(e){a("#blocklyDiv").trigger("focus"),e.preventDefault()}))},e.prototype.interpreterAddEvent=function(e){this.updateBreakpointEvent(),this.interpreters&&this.interpreters.forEach((function(t){return t.addEvent(e)}))},e.prototype.removeBreakPoint=function(e){for(var t=0;t0&&null!==this.interpreters)for(t=0;t0)for(var u=0;u0)for(u=0;u0&&y.push(n),n.items&&n.items.obstacles&&n.items.obstacles>0){var v={};v.id=t.scene.uniqueObjectId,v.shape=f.SimObjectShape.Rectangle,v.color="#ff0000",v.newObjecttype=f.SimObjectType.Obstacle,v.p={x:n.x*t.TILE_SIZE+t.TILE_SIZE/4+10,y:n.y*t.TILE_SIZE+t.TILE_SIZE/4+10},v.params=[.5*t.TILE_SIZE,.5*t.TILE_SIZE],k.push(v)}})),d.length>=2&&g.length>=2&&_.length>=2&&S.length>=2){d.sort((function(e,t){return e.x-t.x})),g.sort((function(e,t){return e.y-t.y})),_.sort((function(e,t){return e.x-t.x})),S.sort((function(e,t){return e.y-t.y}));var T={id:t.scene.uniqueObjectId,p:{x:d[0].x*t.TILE_SIZE+10,y:d[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.TILE_SIZE*(d[d.length-1].x-d[0].x+1),t.EV_WALL_SIZE],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},w={id:t.scene.uniqueObjectId,p:{x:g[0].x*t.TILE_SIZE+t.TILE_SIZE,y:g[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.EV_WALL_SIZE,t.TILE_SIZE*(g[g.length-1].y-g[0].y+1)],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},L={id:t.scene.uniqueObjectId,p:{x:_[0].x*t.TILE_SIZE+10,y:_[0].y*t.TILE_SIZE+t.TILE_SIZE},params:[t.TILE_SIZE*(_[_.length-1].x-_[0].x+1),t.EV_WALL_SIZE],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle},x={id:t.scene.uniqueObjectId,p:{x:S[0].x*t.TILE_SIZE+10,y:S[0].y*t.TILE_SIZE+t.EV_WALL_SIZE},params:[t.EV_WALL_SIZE,t.TILE_SIZE*(S[S.length-1].y-S[0].y+1)],theta:0,color:"#ffffff",shape:f.SimObjectShape.Rectangle,type:f.SimObjectType.Obstacle};k.push(T,w,L,x);var P=h.filter((function(e){return e.tileType.image.startsWith("ev3")}));!function(e,n){n.save(),n.translate(e.x*t.TILE_SIZE+t.TILE_SIZE/2,e.y*t.TILE_SIZE+t.TILE_SIZE/2);var r=0;switch(e.rot){case 0:break;case 90:r=Math.PI/2;break;case 180:r=Math.PI;break;case 270:r=270*Math.PI/180}n.rotate(r),n.beginPath(),n.moveTo(-t.TILE_SIZE/2,-t.TILE_SIZE/2),n.lineTo(t.TILE_SIZE/2,-t.TILE_SIZE/2),n.lineTo(t.TILE_SIZE/2,t.TILE_SIZE/2),n.closePath(),n.fillStyle="#000000",n.fill(),n.restore()}(P[Math.floor(Math.random()*P.length)],u)}if(m?b=t.getTilePose(m,e.tiles[m.next],{}):(o.rc="error",o.message="Unknown start tile"),p||(o.rc="error",o.message="Unknown evacuation zone entrance tile"),"ok"===o.rc){t.deleteAllColorArea(),t.deleteAllObstacle(),function(e,n){n.save(),n.translate(e.x*t.TILE_SIZE+t.TILE_SIZE/2,e.y*t.TILE_SIZE+t.TILE_SIZE/2);var r=0;switch(e.dir){case"top":break;case"right":r=Math.PI/2;break;case"bottom":r=Math.PI;break;case"left":r=270*Math.PI/180}n.rotate(r),n.fillStyle="#33B8CA",n.fillRect(-t.TILE_SIZE/2,-t.TILE_SIZE/2,t.TILE_SIZE,t.EV_WALL_SIZE),n.restore()}(p,u),function(e){e.strokeStyle="#dddddd",e.lineWidth=1;for(var n=1;n=0?(s(this).html("Stop
Scoring Run"),e.init(),s("#rcjStartStop").addClass("running"),!1):(s(this).html("Start
Scoring Run"),clearInterval(e.stopWatch),s("#rcjStartStop").removeClass("running"),s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),e.robot&&e.robot.interpreter.terminate(),e.programPaused=!0,!1)})),s("#rcjLoP").off().on("click",(function(t){e.robot.interpreter.terminate(),e.programPaused=!0,s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled");var o=r.default.getTilePose(e.lastCheckPoint,i.tiles[e.lastCheckPoint.next],e.prevCheckPointTile);return e.robot.pose=new n.Pose(o.x,o.y,o.theta),e.robot.initialPose=new n.Pose(o.x,o.y,o.theta),e.path=e.lastCheckPoint.index[0],e.lastPath=e.path,e.loPCounter+=1,e.loPSum+=1,e.nextCheckPoint&&e.loPCounter>=3&&s("#rcjNextCP").removeClass("disabled"),!1})),s("#rcjNextCP").off().on("click",(function(t){if(e.robot.interpreter.terminate(),e.programPaused=!0,s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),e.nextCheckPoint){var o=r.default.getTilePose(e.nextCheckPoint,i.tiles[e.nextCheckPoint.next],e.prevNextCheckPoint);e.robot.pose=new n.Pose(o.x,o.y,o.theta),e.robot.initialPose=new n.Pose(o.x,o.y,o.theta),e.path=e.nextCheckPoint.index[0],e.lastPath=e.path,e.loPCounter=0,e.section+=1,e.lastCheckPoint=e.nextCheckPoint,e.setNextCheckPoint()}})),s("#rcjName").text(i.name),s("#rcjTeam").text(t.interpreter.name),s("#rcjTime").text("00:00:0")}return t.prototype.init=function(){this.path=0,this.lastPath=0,this.line=!0,clearInterval(this.stopWatch),this.mins=0,this.secs=0,this.csecs=0,this.running=!0,this.stopWatch=setInterval(this.timer.bind(this),100);var t=this.configData.tiles[this.configData.startTile.x+","+this.configData.startTile.y+",0"];this.initialPose=r.default.getTilePose(t,this.configData.tiles[t.next],null),this.lastTile=t,this.lastCheckPoint=t,this.robot&&(this.robot.initialPose=this.initialPose,this.robot.resetPose()),this.loPCounter=0,this.loPSum=0,this.section=0,this.victimsLocated=0,this.linePoints=0,this.obstaclePoints=0,this.totalScore=0,this.inAvoidanceMode=!1,this.countedTileIndices=[0],this.lastCheckPointIndex=0,this.rescueMulti=1},t.prototype.timer=function(){this.running&&(this.csecs++,10===this.csecs&&(this.secs++,this.csecs=0),60===this.secs&&(this.mins++,this.secs=0),s("#rcjTime").text(("00"+this.mins).slice(-2)+":"+("00"+this.secs).slice(-2)+":"+this.csecs),s("#rcjPath").text(-1===this.path?"wrong":"correct"),s("#rcjLastPath").text(this.lastPath),s("#rcjSection").text(this.section),s("#rcjLoPpS").text(this.loPCounter),s("#rcjLoPCount").text(this.loPSum),s("#rcjLine").text(this.line?"yes":"no"),this.mins>=this.MAX_TIME&&s("#rcjStartStop").trigger("click"),s("#rcjRescueMulti").text(Math.round(100*this.rescueMulti)/100),s("#rcjLinePoints").text(this.linePoints),s("#rcjObstaclePoints").text(this.obstaclePoints),s("#rcjTotalScore").text(this.totalScore))},t.prototype.countObstaclePoints=function(t){t&&!this.countedTileIndices.includes(t.index[0])&&(t.tileType.gaps>0&&(this.obstaclePoints+=this.POINTS_GAP),t.tileType.intersections>0&&(this.obstaclePoints+=this.POINTS_INTERSECTION),this.countedTileIndices.push(t.index[0]))},t.prototype.callAutoLoP=function(){s("#rcjLoP").trigger("click")},t.prototype.update=function(t){if(this.running)if(t instanceof n.RobotBaseMobile){var i=t;this.robot!=i&&(this.robot=i,this.initialPose=this.robot.initialPose),this.programPaused&&(this.programPaused=!1,s("#rcjLoP").removeClass("disabled"),s("#rcjNextCP").addClass("disabled")),this.pose=i.pose;var r=Math.floor((this.pose.x-10)/90),a=Math.floor((this.pose.y-10)/90),c=this.configData.tiles[r+","+a+",0"],h=c&&c.index[0];if(h==this.lastPath||h==this.lastPath+1){if(this.path=h,this.lastPath=h,this.line=i.F.lightValue<70,this.line&&(this.wasOnLineOnce=!0),c&&c.checkPoint||0==h){if(this.lastCheckPoint!=c){var l=this.loPCounter0&&1===this.configData.tiles[this.lastTile.next].items.obstacles?(this.inAvoidanceMode=!0,this.path+=1,this.lastPath=this.path,this.avoidanceGoalIndex=this.lastTile.index[0]+2):this.lastTile.items.obstacles>0?(this.inAvoidanceMode=!0,this.avoidanceGoalIndex=this.lastTile.index[0]+1):(-1!=this.path&&h&&this.callAutoLoP(),this.path=-1)),this.line=!1;this.totalScore=(this.linePoints+this.obstaclePoints)*this.rescueMulti,this.totalScore=e.round(this.totalScore,2)}else if(t instanceof o.CircleSimulationObject){var d=t;d.inEvacuationZone&&"#33B8CA"===d.color&&(d.selected=!0,s("#simDeleteObject").trigger("click"),this.rescueMulti*=this.POINTS_VICTIM_MULTI,this.victimsLocated+=1),d.inEvacuationZone&&"#000000"===d.color&&(d.selected=!0,s("#simDeleteObject").trigger("click"),this.victimsLocated>1?this.rescueMulti*=this.POINTS_VICTIM_MULTI:this.rescueMulti*=this.POINTS_DEADONLY_VICTIM_MULTI,this.victimsLocated+=1),this.victimsLocated>=3&&s("#rcjStartStop").trigger("click")}},t.prototype.setNextCheckPoint=function(){for(var t=this.configData.tiles[this.lastCheckPoint.next];t&&this.configData.tiles[t.next]&&(this.prevNextCheckPoint=t,!(t=this.configData.tiles[t.next]).checkPoint););t&&t.checkPoint?this.nextCheckPoint=t:(this.nextCheckPoint=null,this.prevNextCheckPoint=null)},t.prototype.openClose=function(){var t=s("#simDiv").position();t.left=12,s("#rcjScoringWindow").toggleSimPopup(t)},t.prototype.destroy=function(){s("#rcjStartStop").html("Start
Scoring Run"),s("#rcjStartStop").removeClass("running"),s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),clearInterval(this.stopWatch),this.stopWatch=null,s("#rcjPath").text(""),s("#rcjLastPath").text(""),s("#rcjSection").text(""),s("#rcjLoPpS").text(""),s("#rcjLoPCount").text(""),s("#rcjLine").text(""),s("#rcjName").text(""),s("#rcjTeam").text(""),s("#rcjTime").text("00:00:0"),s("#rcjRescueMulti").text("")},t}();i.RcjScoringTool=c;var h=function(){function t(t){this.DEFAULT_TRAIL_WIDTH=10,this.DEFAULT_TRAIL_COLOR="#000000",this.customBackgroundLoaded=!1,this.ground=new o.Ground(0,0,0,0),this.imgBackgroundList=[],this.imgPath="/css/img/simBackgrounds/",this.playground={x:0,y:0,w:0,h:0},this._colorAreaList=[],this._obstacleList=[],this._rcjList=[],this._markerList=[],this._redrawColorAreas=!1,this._redrawObstacles=!1,this._redrawMarkers=!1,this._robots=[],this._uniqueObjectId=0,this._scoring=!1,this.sim=t,this.uCanvas=document.createElement("canvas"),this.uCtx=this.uCanvas.getContext("2d",{willReadFrequently:!0}),this.udCanvas=document.createElement("canvas"),this.udCtx=this.udCanvas.getContext("2d",{willReadFrequently:!0}),this.bCtx=s("#backgroundLayer")[0].getContext("2d"),this.dCtx=s("#drawLayer")[0].getContext("2d"),this.aCtx=s("#arucoMarkerLayer")[0].getContext("2d"),this.oCtx=s("#objectLayer")[0].getContext("2d"),this.rCtx=s("#robotLayer")[0].getContext("2d"),this.rcjCtx=s("#rcjLayer")[0].getContext("2d")}return Object.defineProperty(t.prototype,"scoring",{get:function(){return this._scoring},set:function(t){this._scoring=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uniqueObjectId",{get:function(){return++this._uniqueObjectId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"robots",{get:function(){return this._robots},set:function(t){this.clearList(this._robots),this._robots=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"obstacleList",{get:function(){return this._obstacleList},set:function(t){this.clearList(this._obstacleList),this._obstacleList=t,this.redrawObstacles=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rcjList",{get:function(){return this._rcjList},set:function(t){this.clearList(this._rcjList),this._rcjList=t,this.redrawObstacles=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorAreaList",{get:function(){return this._colorAreaList},set:function(t){this.clearList(this._colorAreaList),this._colorAreaList=t,this.redrawColorAreas=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"markerList",{get:function(){return this._markerList},set:function(t){this.clearList(this._markerList),this._markerList=t,this.redrawMarkers=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawObstacles",{get:function(){return this._redrawObstacles},set:function(t){this._redrawObstacles=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawColorAreas",{get:function(){return this._redrawColorAreas},set:function(t){this._redrawColorAreas=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawMarkers",{get:function(){return this._redrawMarkers},set:function(t){this._redrawMarkers=t},enumerable:!1,configurable:!0}),t.prototype.addColorArea=function(t){this.addSimulationObject(this.colorAreaList,t,o.SimObjectType.ColorArea),this.redrawColorAreas=!0},t.prototype.addImportColorAreaList=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.ColorArea,t.p,null,t.color],t.params,!1));e.push(s)})),this.colorAreaList=e},t.prototype.addImportObstacle=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.Obstacle,t.p,null,t.color],t.params,!1));e.push(s)})),this.obstacleList=e},t.prototype.addImportRcjLabel=function(t){var i=this,e=[];t.forEach((function(t){var s=new o.RcjSimulationLabel(i.uniqueObjectId,i,i.sim.selectionListener,o.SimObjectType.ColorArea,t.x,t.y,t.checkPoint?"checkPoint":t.start?"start":null,t.index[0]);e.push(s)})),this.rcjList=e},t.prototype.addImportMarkerList=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.Marker,t.p,null,t.color],t.params,!1));s.markerId=t.markerId,e.push(s)})),this.markerList=e},t.prototype.addObstacle=function(t){this.addSimulationObject(this.obstacleList,t,o.SimObjectType.Obstacle),this.redrawObstacles=!0},t.prototype.addSimulationObject=function(t,i,e,r){var a=s("#robotLayer");a.attr("tabindex",0),a.trigger("focus");var n=Math.random()*(this.ground.w-300)+100,c=Math.random()*(this.ground.h-200)+100,h=o.SimObjectFactory.getSimObject(this.uniqueObjectId,this,this.sim.selectionListener,i,e,{x:n,y:c},this.backgroundImg.width);i==o.SimObjectShape.Marker&&r&&(h.markerId=r),t.push(h),h.selected=!0},t.prototype.changeColorWithColorPicker=function(t){var i=this.obstacleList.concat(this.colorAreaList).filter((function(t){return t.selected}));1==i.length&&(i[0].color=t,i[0].type===o.SimObjectType.Obstacle?this.redrawObstacles=!0:this.redrawColorAreas=!0)},t.prototype.clearList=function(t){t.forEach((function(t){t.destroy()})),t.length=0},t.prototype.deleteSelectedObject=function(){var t=this;function i(i){for(var e=0;e.pace").show(),this.robots=[],a.RobotFactory.createRobots(r,n,c,this.sim.selectionListener,this.robotType).then((function(t){if(d.robots=t.robots,d.robotClass=t.robotClass,d.setRobotPoses(h),d.initViews(),u){d.removeRcjScoringTool(),g.imgBackgroundList=[],g.currentBackground=0,g.obstacleList.length>0&&(g.obstacleList=[]),g.colorAreaList.length>0&&(g.colorAreaList=[]);var i=".svg";e.isIE()&&(i=".png"),g.loadBackgroundImages((function(){g.robots[0].mobile?(s(".simMobile").show(),g.images=g.loadImages(["roadWorks","pattern"],["roadWorks"+i,"wallPattern.png"],(function(){g.ground=new o.Ground(10,10,g.imgBackgroundList[g.currentBackground].width,g.imgBackgroundList[g.currentBackground].height),g.backgroundImg=g.imgBackgroundList[0];var t=new o.RectangleSimulationObject(0,g,g.sim.selectionListener,o.SimObjectType.Obstacle,{x:7*g.backgroundImg.width/9,y:g.backgroundImg.height-2*g.backgroundImg.width/9},g.backgroundImg.width);g.obstacleList.push(t),g.centerBackground(!0),g.initEvents(),g.sim.initColorPicker(a.RobotBase.colorRange),g.showFullyLoadedSim(l),g.sim.start()}))):(s(".simMobile").hide(),g.images={},g.ground=new o.Ground(10,10,g.imgBackgroundList[g.currentBackground].width,g.imgBackgroundList[g.currentBackground].height),g.backgroundImg=g.imgBackgroundList[0],g.centerBackground(!0),g.initEvents(),g.showFullyLoadedSim(l),g.sim.start())}))}d.showFullyLoadedSim(l),d.sim.start()}))):(this.robots.forEach((function(t,i){g.rcjScoringTool&&t.addObserver(g.rcjScoringTool),t.replaceState(r[i]),t.reset()})),this.showFullyLoadedSim(l)),this.robots.forEach((function(t,i){t.time=0}))},t.prototype.showFullyLoadedSim=function(t){this.obstacleList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),this.markerList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),this.colorAreaList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),s("#canvasDiv").fadeIn("slow"),s("#simDiv>.pace").fadeOut("fast"),"function"==typeof t&&t()},t.prototype.initViews=function(){var t=s("#systemValuesView"),i=s("#robotIndex");t.html("");var e="",o=this.robots[0]instanceof n.RobotBaseMobile?this.robots[0].chassis.geom.color:"#ffffff";if(e+='",t.append('
'+e+"
"),i.off("change.sim"),this.robots.length>1){var r=this;i.on("change.sim",(function(){var t=Number(s(this).val());r.robots[t].selected=!0,r.sim.selectionListener.fire(null)}))}},t.prototype.initEvents=function(){var t=this,i=0;s(window).off("resize.sim").on("resize.sim",(function(e,s){i>3||"loaded"==s?(t.centerBackground(!1),i=0):i++})),s("#robotLayer").off("keydown.sim").on("keydown.sim",this.handleKeyEvent.bind(this))},t.prototype.loadBackgroundImages=function(t){var i,s;s=e.isIE()?".png":".svg";for(var o=(i=this.robots[0].mobile?this.robots[0].imgList.map((function(t){return t.endsWith("jpg")?t:"".concat(t).concat(s)})):[this.robotType+"Background"+s]).length,r=this,a=function(){if(0==--o&&(t(),e.isLocalStorageAvailable()&&r.robots[0].mobile)){var i=localStorage.getItem("customBackground");if(i){try{JSON.parse(i)}catch(t){localStorage.setItem("customBackground",JSON.stringify({image:i,timestamp:(new Date).getTime()})),i=localStorage.getItem("customBackground")}var s=JSON.parse(i);if((new Date).getTime()-s.timestamp>54432e5)localStorage.removeItem("customBackground");else{var a=s.image,n=new Image;n.src="data:image/png;base64,"+a,r.imgBackgroundList.push(n),r.customBackgroundLoaded=!0}}}},n=0;n0;){a[0].updateSensor(e.uCtx,r,a),a.shift()}})),this.draw(t,i)},t.prototype.toggleTrail=function(){this.robots.forEach((function(t){t.hasTrail=!t.hasTrail,t.pose.xOld=t.pose.x,t.pose.yOld=t.pose.y}))},t.prototype.resetPoseAndDrawings=function(){this.robots.forEach((function(t){return t.resetPose()})),this.dCtx.canvas.width=this.dCtx.canvas.width,this.udCtx.canvas.width=this.udCtx.canvas.width,this.rcjCtx.canvas.width=this.rcjCtx.canvas.width},t.prototype.addMarker=function(t){this.addSimulationObject(this.markerList,o.SimObjectShape.Marker,o.SimObjectType.Marker,t),this._redrawMarkers=!0},t.prototype.setRcjScoringTool=function(t,i){this.rcjScoringTool=new c(t,i),this.scoring=!0;var e=this;s("#simCompetition").show(),s("#simCompetition").off(),s("#simCompetition").onWrap("click",(function(){e.rcjScoringTool.openClose()})),this.obstacleList.forEach((function(t){t.addObserver&&"function"==typeof t.addObserver&&t.addObserver(e.rcjScoringTool)}))},t.prototype.removeRcjScoringTool=function(){this.rcjScoringTool&&this.rcjScoringTool.destroy(),this.rcjScoringTool=null,this.scoring=!1,s("#simCompetition").hide(),s("#simCompetition").off()},t}();i.SimulationScene=h})); +var __spreadArray=this&&this.__spreadArray||function(t,i,e){if(e||2===arguments.length)for(var s,o=0,r=i.length;o=0?(s(this).html("Stop
Scoring Run"),o.init(),o.resetObstaclesCallback(),s("#rcjStartStop").addClass("running"),!1):(s(this).html("Start
Scoring Run"),clearInterval(o.stopWatch),s("#rcjStartStop").removeClass("running"),s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),o.robot&&o.robot.interpreter.terminate(),o.programPaused=!0,!1)})),s("#rcjLoP").off().on("click",(function(t){o.robot.interpreter.terminate(),o.programPaused=!0,s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled");var e=r.default.getTilePose(o.lastCheckPoint,i.tiles[o.lastCheckPoint.next],o.prevCheckPointTile);return o.robot.pose=new n.Pose(e.x,e.y,e.theta),o.robot.initialPose=new n.Pose(e.x,e.y,e.theta),o.path=o.lastCheckPoint.index[0],o.lastPath=o.path,o.loPCounter+=1,o.loPSum+=1,o.nextCheckPoint&&o.loPCounter>=3&&s("#rcjNextCP").removeClass("disabled"),!1})),s("#rcjNextCP").off().on("click",(function(t){if(o.robot.interpreter.terminate(),o.programPaused=!0,s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),o.nextCheckPoint){var e=r.default.getTilePose(o.nextCheckPoint,i.tiles[o.nextCheckPoint.next],o.prevNextCheckPoint);o.robot.pose=new n.Pose(e.x,e.y,e.theta),o.robot.initialPose=new n.Pose(e.x,e.y,e.theta),o.path=o.nextCheckPoint.index[0],o.lastPath=o.path,o.loPCounter=0,o.section+=1,o.lastCheckPoint=o.nextCheckPoint,o.setNextCheckPoint()}})),s("#rcjName").text(i.name),s("#rcjTeam").text(t.interpreter.name),s("#rcjTime").text("00:00:0")}return t.prototype.init=function(){this.path=0,this.lastPath=0,this.line=!0,clearInterval(this.stopWatch),this.mins=0,this.secs=0,this.csecs=0,this.running=!0,this.stopWatch=setInterval(this.timer.bind(this),100);var t=this.configData.tiles[this.configData.startTile.x+","+this.configData.startTile.y+",0"];this.initialPose=r.default.getTilePose(t,this.configData.tiles[t.next],null),this.lastTile=t,this.lastCheckPoint=t,this.robot&&(this.robot.initialPose=this.initialPose,this.robot.resetPose()),this.loPCounter=0,this.loPSum=0,this.section=0,this.victimsLocated=0,this.linePoints=0,this.obstaclePoints=0,this.totalScore=0,this.inAvoidanceMode=!1,this.countedTileIndices=[0],this.lastCheckPointIndex=0,this.rescueMulti=1},t.prototype.timer=function(){this.running&&(this.csecs++,10===this.csecs&&(this.secs++,this.csecs=0),60===this.secs&&(this.mins++,this.secs=0),s("#rcjTime").text(("00"+this.mins).slice(-2)+":"+("00"+this.secs).slice(-2)+":"+this.csecs),s("#rcjPath").text(-1===this.path?"wrong":"correct"),s("#rcjLastPath").text(this.lastPath),s("#rcjSection").text(this.section),s("#rcjLoPpS").text(this.loPCounter),s("#rcjLoPCount").text(this.loPSum),s("#rcjLine").text(this.line?"yes":"no"),this.mins>=this.MAX_TIME&&s("#rcjStartStop").trigger("click"),s("#rcjRescueMulti").text(Math.round(100*this.rescueMulti)/100),s("#rcjLinePoints").text(this.linePoints),s("#rcjObstaclePoints").text(this.obstaclePoints),s("#rcjTotalScore").text(this.totalScore))},t.prototype.countObstaclePoints=function(t){t&&!this.countedTileIndices.includes(t.index[0])&&(t.tileType.gaps>0&&(this.obstaclePoints+=this.POINTS_GAP),t.tileType.intersections>0&&(this.obstaclePoints+=this.POINTS_INTERSECTION),this.countedTileIndices.push(t.index[0]))},t.prototype.callAutoLoP=function(){s("#rcjLoP").trigger("click")},t.prototype.update=function(t){if(this.running)if(t instanceof n.RobotBaseMobile){var i=t;this.robot!=i&&(this.robot=i,this.initialPose=this.robot.initialPose),this.programPaused&&(this.programPaused=!1,s("#rcjLoP").removeClass("disabled"),s("#rcjNextCP").addClass("disabled")),this.pose=i.pose;var r=Math.floor((this.pose.x-10)/90),a=Math.floor((this.pose.y-10)/90),c=this.configData.tiles[r+","+a+",0"],h=c&&c.index[0];if(h==this.lastPath||h==this.lastPath+1){if(this.path=h,this.lastPath=h,this.line=i.F.lightValue<70,this.line&&(this.wasOnLineOnce=!0),c&&c.checkPoint||0==h){if(this.lastCheckPoint!=c){var l=this.loPCounter0&&1===this.configData.tiles[this.lastTile.next].items.obstacles?(this.inAvoidanceMode=!0,this.path+=1,this.lastPath=this.path,this.avoidanceGoalIndex=this.lastTile.index[0]+2):this.lastTile.items.obstacles>0?(this.inAvoidanceMode=!0,this.avoidanceGoalIndex=this.lastTile.index[0]+1):(-1!=this.path&&h&&this.callAutoLoP(),this.path=-1)),this.line=!1;this.totalScore=(this.linePoints+this.obstaclePoints)*this.rescueMulti,this.totalScore=e.round(this.totalScore,2)}else if(t instanceof o.CircleSimulationObject){var d=t;d.inEvacuationZone&&"#33B8CA"===d.color&&(d.selected=!0,s("#simDeleteObject").trigger("click"),this.rescueMulti*=this.POINTS_VICTIM_MULTI,this.victimsLocated+=1),d.inEvacuationZone&&"#000000"===d.color&&(d.selected=!0,s("#simDeleteObject").trigger("click"),this.victimsLocated>1?this.rescueMulti*=this.POINTS_VICTIM_MULTI:this.rescueMulti*=this.POINTS_DEADONLY_VICTIM_MULTI,this.victimsLocated+=1),this.victimsLocated>=3&&s("#rcjStartStop").trigger("click")}},t.prototype.setNextCheckPoint=function(){for(var t=this.configData.tiles[this.lastCheckPoint.next];t&&this.configData.tiles[t.next]&&(this.prevNextCheckPoint=t,!(t=this.configData.tiles[t.next]).checkPoint););t&&t.checkPoint?this.nextCheckPoint=t:(this.nextCheckPoint=null,this.prevNextCheckPoint=null)},t.prototype.openClose=function(){var t=s("#simDiv").position();t.left=12,s("#rcjScoringWindow").toggleSimPopup(t)},t.prototype.destroy=function(){s("#rcjStartStop").html("Start
Scoring Run"),s("#rcjStartStop").removeClass("running"),s("#rcjLoP").addClass("disabled"),s("#rcjNextCP").addClass("disabled"),clearInterval(this.stopWatch),this.stopWatch=null,s("#rcjPath").text(""),s("#rcjLastPath").text(""),s("#rcjSection").text(""),s("#rcjLoPpS").text(""),s("#rcjLoPCount").text(""),s("#rcjLine").text(""),s("#rcjName").text(""),s("#rcjTeam").text(""),s("#rcjTime").text("00:00:0"),s("#rcjRescueMulti").text("")},t}();i.RcjScoringTool=c;var h=function(){function t(t){this.DEFAULT_TRAIL_WIDTH=10,this.DEFAULT_TRAIL_COLOR="#000000",this.customBackgroundLoaded=!1,this.ground=new o.Ground(0,0,0,0),this.imgBackgroundList=[],this.imgPath="/css/img/simBackgrounds/",this.playground={x:0,y:0,w:0,h:0},this._colorAreaList=[],this._obstacleList=[],this._rcjList=[],this._markerList=[],this._redrawColorAreas=!1,this._redrawObstacles=!1,this._redrawMarkers=!1,this._robots=[],this._uniqueObjectId=0,this._scoring=!1,this.sim=t,this.uCanvas=document.createElement("canvas"),this.uCtx=this.uCanvas.getContext("2d",{willReadFrequently:!0}),this.udCanvas=document.createElement("canvas"),this.udCtx=this.udCanvas.getContext("2d",{willReadFrequently:!0}),this.bCtx=s("#backgroundLayer")[0].getContext("2d"),this.dCtx=s("#drawLayer")[0].getContext("2d"),this.aCtx=s("#arucoMarkerLayer")[0].getContext("2d"),this.oCtx=s("#objectLayer")[0].getContext("2d"),this.rCtx=s("#robotLayer")[0].getContext("2d"),this.rcjCtx=s("#rcjLayer")[0].getContext("2d")}return Object.defineProperty(t.prototype,"scoring",{get:function(){return this._scoring},set:function(t){this._scoring=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uniqueObjectId",{get:function(){return++this._uniqueObjectId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"robots",{get:function(){return this._robots},set:function(t){this.clearList(this._robots),this._robots=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"obstacleList",{get:function(){return this._obstacleList},set:function(t){this.clearList(this._obstacleList),this._obstacleList=t,this.redrawObstacles=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rcjList",{get:function(){return this._rcjList},set:function(t){this.clearList(this._rcjList),this._rcjList=t,this.redrawObstacles=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorAreaList",{get:function(){return this._colorAreaList},set:function(t){this.clearList(this._colorAreaList),this._colorAreaList=t,this.redrawColorAreas=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"markerList",{get:function(){return this._markerList},set:function(t){this.clearList(this._markerList),this._markerList=t,this.redrawMarkers=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawObstacles",{get:function(){return this._redrawObstacles},set:function(t){this._redrawObstacles=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawColorAreas",{get:function(){return this._redrawColorAreas},set:function(t){this._redrawColorAreas=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redrawMarkers",{get:function(){return this._redrawMarkers},set:function(t){this._redrawMarkers=t},enumerable:!1,configurable:!0}),t.prototype.addColorArea=function(t){this.addSimulationObject(this.colorAreaList,t,o.SimObjectType.ColorArea),this.redrawColorAreas=!0},t.prototype.addImportColorAreaList=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.ColorArea,t.p,null,t.color],t.params,!1));e.push(s)})),this.colorAreaList=e},t.prototype.addImportObstacle=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.Obstacle,t.p,null,t.color],t.params,!1));e.push(s)})),this.obstacleList=e},t.prototype.addSomeObstacles=function(t){var i=this,e=this;t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.Obstacle,t.p,null,t.color],t.params,!1));e.obstacleList.push(s)}))},t.prototype.addImportRcjLabel=function(t){var i=this,e=[];t.forEach((function(t){var s=new o.RcjSimulationLabel(i.uniqueObjectId,i,i.sim.selectionListener,o.SimObjectType.ColorArea,t.x,t.y,t.checkPoint?"checkPoint":t.start?"start":null,t.index[0]);e.push(s)})),this.rcjList=e},t.prototype.addImportMarkerList=function(t){var i=this,e=[];t.forEach((function(t){var s=o.SimObjectFactory.getSimObject.apply(o.SimObjectFactory,__spreadArray([t.id,i,i.sim.selectionListener,t.shape,o.SimObjectType.Marker,t.p,null,t.color],t.params,!1));s.markerId=t.markerId,e.push(s)})),this.markerList=e},t.prototype.addObstacle=function(t){this.addSimulationObject(this.obstacleList,t,o.SimObjectType.Obstacle),this.redrawObstacles=!0},t.prototype.addSimulationObject=function(t,i,e,r){var a=s("#robotLayer");a.attr("tabindex",0),a.trigger("focus");var n=Math.random()*(this.ground.w-300)+100,c=Math.random()*(this.ground.h-200)+100,h=o.SimObjectFactory.getSimObject(this.uniqueObjectId,this,this.sim.selectionListener,i,e,{x:n,y:c},this.backgroundImg.width);i==o.SimObjectShape.Marker&&r&&(h.markerId=r),t.push(h),h.selected=!0},t.prototype.changeColorWithColorPicker=function(t){var i=this.obstacleList.concat(this.colorAreaList).filter((function(t){return t.selected}));1==i.length&&(i[0].color=t,i[0].type===o.SimObjectType.Obstacle?this.redrawObstacles=!0:this.redrawColorAreas=!0)},t.prototype.clearList=function(t){t.forEach((function(t){t.destroy()})),t.length=0},t.prototype.deleteSelectedObject=function(){var t=this;function i(i){for(var e=0;e.pace").show(),this.robots=[],a.RobotFactory.createRobots(r,n,c,this.sim.selectionListener,this.robotType).then((function(t){if(d.robots=t.robots,d.robotClass=t.robotClass,d.setRobotPoses(h),d.initViews(),u){d.removeRcjScoringTool(),g.imgBackgroundList=[],g.currentBackground=0,g.obstacleList.length>0&&(g.obstacleList=[]),g.colorAreaList.length>0&&(g.colorAreaList=[]);var i=".svg";e.isIE()&&(i=".png"),g.loadBackgroundImages((function(){g.robots[0].mobile?(s(".simMobile").show(),g.images=g.loadImages(["roadWorks","pattern"],["roadWorks"+i,"wallPattern.png"],(function(){g.ground=new o.Ground(10,10,g.imgBackgroundList[g.currentBackground].width,g.imgBackgroundList[g.currentBackground].height),g.backgroundImg=g.imgBackgroundList[0];var t=new o.RectangleSimulationObject(0,g,g.sim.selectionListener,o.SimObjectType.Obstacle,{x:7*g.backgroundImg.width/9,y:g.backgroundImg.height-2*g.backgroundImg.width/9},g.backgroundImg.width);g.obstacleList.push(t),g.centerBackground(!0),g.initEvents(),g.sim.initColorPicker(a.RobotBase.colorRange),g.showFullyLoadedSim(l),g.sim.start()}))):(s(".simMobile").hide(),g.images={},g.ground=new o.Ground(10,10,g.imgBackgroundList[g.currentBackground].width,g.imgBackgroundList[g.currentBackground].height),g.backgroundImg=g.imgBackgroundList[0],g.centerBackground(!0),g.initEvents(),g.showFullyLoadedSim(l),g.sim.start())}))}d.showFullyLoadedSim(l),d.sim.start()}))):(this.robots.forEach((function(t,i){g.rcjScoringTool&&t.addObserver(g.rcjScoringTool),t.replaceState(r[i]),t.reset()})),this.showFullyLoadedSim(l)),this.robots.forEach((function(t,i){t.time=0}))},t.prototype.showFullyLoadedSim=function(t){this.obstacleList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),this.markerList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),this.colorAreaList.forEach((function(t){t.removeMouseEvents(),t.addMouseEvents()})),s("#canvasDiv").fadeIn("slow"),s("#simDiv>.pace").fadeOut("fast"),"function"==typeof t&&t()},t.prototype.initViews=function(){var t=s("#systemValuesView"),i=s("#robotIndex");t.html("");var e="",o=this.robots[0]instanceof n.RobotBaseMobile?this.robots[0].chassis.geom.color:"#ffffff";if(e+='",t.append('
'+e+"
"),i.off("change.sim"),this.robots.length>1){var r=this;i.on("change.sim",(function(){var t=Number(s(this).val());r.robots[t].selected=!0,r.sim.selectionListener.fire(null)}))}},t.prototype.initEvents=function(){var t=this,i=0;s(window).off("resize.sim").on("resize.sim",(function(e,s){i>3||"loaded"==s?(t.centerBackground(!1),i=0):i++})),s("#robotLayer").off("keydown.sim").on("keydown.sim",this.handleKeyEvent.bind(this))},t.prototype.loadBackgroundImages=function(t){var i,s;s=e.isIE()?".png":".svg";for(var o=(i=this.robots[0].mobile?this.robots[0].imgList.map((function(t){return t.endsWith("jpg")?t:"".concat(t).concat(s)})):[this.robotType+"Background"+s]).length,r=this,a=function(){if(0==--o&&(t(),e.isLocalStorageAvailable()&&r.robots[0].mobile)){var i=localStorage.getItem("customBackground");if(i){try{JSON.parse(i)}catch(t){localStorage.setItem("customBackground",JSON.stringify({image:i,timestamp:(new Date).getTime()})),i=localStorage.getItem("customBackground")}var s=JSON.parse(i);if((new Date).getTime()-s.timestamp>54432e5)localStorage.removeItem("customBackground");else{var a=s.image,n=new Image;n.src="data:image/png;base64,"+a,r.imgBackgroundList.push(n),r.customBackgroundLoaded=!0}}}},n=0;n0;){a[0].updateSensor(e.uCtx,r,a),a.shift()}})),this.draw(t,i)},t.prototype.toggleTrail=function(){this.robots.forEach((function(t){t.hasTrail=!t.hasTrail,t.pose.xOld=t.pose.x,t.pose.yOld=t.pose.y}))},t.prototype.resetPoseAndDrawings=function(){this.robots.forEach((function(t){return t.resetPose()})),this.dCtx.canvas.width=this.dCtx.canvas.width,this.udCtx.canvas.width=this.udCtx.canvas.width,this.rcjCtx.canvas.width=this.rcjCtx.canvas.width},t.prototype.addMarker=function(t){this.addSimulationObject(this.markerList,o.SimObjectShape.Marker,o.SimObjectType.Marker,t),this._redrawMarkers=!0},t.prototype.setRcjScoringTool=function(t,i,e){this.rcjScoringTool=new c(t,i,e),this.scoring=!0;var o=this;s("#simCompetition").show(),s("#simCompetition").off(),s("#simCompetition").onWrap("click",(function(){o.rcjScoringTool.openClose()})),this.obstacleList.forEach((function(t){t.addObserver&&"function"==typeof t.addObserver&&t.addObserver(o.rcjScoringTool)}))},t.prototype.removeRcjScoringTool=function(){this.rcjScoringTool&&this.rcjScoringTool.destroy(),this.rcjScoringTool=null,this.scoring=!1,s("#simCompetition").hide(),s("#simCompetition").off()},t}();i.SimulationScene=h})); //# sourceMappingURL=simulation.scene.js.map //# sourceMappingURL=simulation.scene.js.map diff --git a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.objects.ts b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.objects.ts index 9cbbee0a1c..de5f8d9b78 100644 --- a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.objects.ts +++ b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.objects.ts @@ -656,6 +656,7 @@ export class CircleSimulationObject extends BaseSimulationObject implements IMov corners: Corner[] = []; private collisions: Point[] = []; private lastMoveBumped: boolean = false; + private lastMoveBumpedOld: boolean = false; private lastMove: Point; private observers: IObserver[] = []; inEvacuationZone: boolean = false; @@ -870,6 +871,10 @@ export class CircleSimulationObject extends BaseSimulationObject implements IMov this.x += dx; this.y += dy; this.updateCorners(); + if (this.movable) { + this.lastMoveBumpedOld = false; + this.lastMoveBumped = false; + } //TODO redraw } } @@ -912,8 +917,7 @@ export class CircleSimulationObject extends BaseSimulationObject implements IMov return false; } this.collisions.push(dist); - if (this.lastMoveBumped) { - //this.lastMoveBumped = false; + if (this.lastMoveBumpedOld) { return false; } return true; @@ -923,6 +927,8 @@ export class CircleSimulationObject extends BaseSimulationObject implements IMov if (!this.movable) { return; } + this.lastMoveBumpedOld = this.lastMoveBumped; + this.lastMoveBumped = false; let locationColor = uCtx.getImageData(this.x, this.y, 1, 1).data; this.inEvacuationZone = locationColor.toString() === [0, 0, 0, 255].toString(); @@ -981,7 +987,6 @@ export class CircleSimulationObject extends BaseSimulationObject implements IMov this.moveTo({ x: this.x + diffP.x, y: this.y + diffP.y }); } } else { - this.lastMoveBumped = false; this.moveTo({ x: this.x + diffP.x, y: this.y + diffP.y }); } } diff --git a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.roberta.ts b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.roberta.ts index 6e8685e32e..924bdaf1a6 100644 --- a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.roberta.ts +++ b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.roberta.ts @@ -17,7 +17,7 @@ import * as HUEBEE from 'huebee'; // @ts-ignore import * as Blockly from 'blockly'; import * as NN_CTRL from 'nn.controller'; -import { SimulationScene } from 'simulation.scene'; +import { IObservableSimulationObject, SimulationScene } from 'simulation.scene'; import { SelectionListener } from 'robot.base'; import { BaseSimulationObject, @@ -30,6 +30,7 @@ import { } from 'simulation.objects'; import { Pose } from 'robot.base.mobile'; import { Simulation } from 'progSim.controller'; +import * as SIMATH from 'simulation.math'; export class SimulationRoberta implements Simulation { private static _instance: SimulationRoberta; @@ -1011,15 +1012,25 @@ export class SimulationRoberta implements Simulation { let victims = configData.victims; let rcjVictimsList = []; let zone: Rectangle = { - x: Math.min(evacuationZone[0], evacuationZone[2]) * sim.TILE_SIZE, - y: Math.min(evacuationZone[1], evacuationZone[3]) * sim.TILE_SIZE, - w: (Math.max(evacuationZone[0], evacuationZone[2]) - Math.min(evacuationZone[0], evacuationZone[2]) + 1) * sim.TILE_SIZE, - h: (Math.max(evacuationZone[1], evacuationZone[3]) - Math.min(evacuationZone[1], evacuationZone[3]) + 1) * sim.TILE_SIZE, + x: Math.min(evacuationZone[0], evacuationZone[2]) * sim.TILE_SIZE - sim.TILE_SIZE / 2, + y: Math.min(evacuationZone[1], evacuationZone[3]) * sim.TILE_SIZE - sim.TILE_SIZE / 2, + w: (Math.max(evacuationZone[0], evacuationZone[2]) - Math.min(evacuationZone[0], evacuationZone[2]) + 1) * sim.TILE_SIZE + sim.TILE_SIZE, + h: (Math.max(evacuationZone[1], evacuationZone[3]) - Math.min(evacuationZone[1], evacuationZone[3]) + 1) * sim.TILE_SIZE + sim.TILE_SIZE, }; const createVictim = (color) => { + let p = { x: zone.x + Math.random() * zone.w, y: zone.y + Math.random() * zone.h }; + let i = 0; + while (i < rcjVictimsList.length) { + if (SIMATH.getDistance(p, rcjVictimsList[i].p) < 200) { + p = { x: zone.x + Math.random() * zone.w, y: zone.y + Math.random() * zone.h }; + i = 0; + } else { + i++; + } + } let victim = { id: sim.scene.uniqueObjectId, - p: { x: zone.x + Math.random() * zone.w, y: zone.y + Math.random() * zone.h }, + p: p, params: [7, 1], // 7 is the radius, 1 is movable = true theta: 0, color: color, @@ -1047,6 +1058,24 @@ export class SimulationRoberta implements Simulation { image.height = canvas.height; return image; }; + let evacuationVictimsZone = []; + const resetVictims = () => { + let obstaclesToDelete: BaseSimulationObject[] = sim.scene.obstacleList.filter((obstacle) => { + return obstacle.movable; + }); + obstaclesToDelete.forEach((obstacle) => { + obstacle.selected = true; + (obstacle as any as IObservableSimulationObject).removeObserver(sim.scene.rcjScoringTool); + sim.scene.deleteSelectedObject(); + }); + let newVictims = getRcjVictims(evacuationVictimsZone); + sim.scene.addSomeObstacles(newVictims); + sim.scene.obstacleList.forEach((obstacle) => { + if (obstacle['addObserver'] && typeof obstacle['addObserver'] === 'function') { + (obstacle as CircleSimulationObject).addObserver(sim.scene.rcjScoringTool); + } + }); + }; preloadAll(imgArray).then( function (images) { let ctx = canvas.getContext('2d'); @@ -1057,14 +1086,13 @@ export class SimulationRoberta implements Simulation { let evacuationBottom = []; let evacuationLeft = []; let importObstacles = []; - let evacuationVctimsZone = []; imgArray.forEach((img, index) => { if (img['tileType']['image'].startsWith('ev')) { let ev = img['tileType']['image'].replace('.png', ''); switch (ev) { case 'ev1': - evacuationVctimsZone.push(img['x']); - evacuationVctimsZone.push(img['y']); + evacuationVictimsZone.push(img['x']); + evacuationVictimsZone.push(img['y']); // evacuation zone tile without walls break; case 'ev2': // one wall @@ -1236,12 +1264,12 @@ export class SimulationRoberta implements Simulation { let image = createBackgroundImage(); sim.scene.imgBackgroundList.push(image); sim.setBackground(sim.scene.imgBackgroundList.length - 1); - sim.scene.addImportObstacle(importObstacles.concat(getRcjVictims(evacuationVctimsZone))); + sim.scene.addImportObstacle(importObstacles.concat(getRcjVictims(evacuationVictimsZone))); sim.scene.addImportRcjLabel(rcjLabel); sim.scene.drawRcjLabel(); sim.importPoses = [[startPose, startPose]]; sim.scene.setRobotPoses(sim.importPoses); - sim.scene.setRcjScoringTool(sim.scene.robots[0], configData); + sim.scene.setRcjScoringTool(sim.scene.robots[0], configData, resetVictims); $('#simCompetition').show(); resolve(result); } else { diff --git a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.scene.ts b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.scene.ts index b64450be0a..1feae19f11 100644 --- a/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.scene.ts +++ b/OpenRobertaWeb/src/app/simulation/simulationLogic/simulation.scene.ts @@ -76,10 +76,12 @@ export class RcjScoringTool implements IObserver { private rescueMulti: number; private lastCheckPointIndex: number; private wasOnLineOnce: boolean = false; + private resetObstaclesCallback: Function; - constructor(robot: RobotBase, configData: any) { + constructor(robot: RobotBase, configData: any, resetObstaclesCallback: Function) { this.configData = configData; this.robot = robot as RobotBaseMobile; + this.resetObstaclesCallback = resetObstaclesCallback; this.init(); let rcj = this; $('#rcjStartStop') @@ -88,6 +90,7 @@ export class RcjScoringTool implements IObserver { if ($(this).text().indexOf('Start') >= 0) { $(this).html('Stop
Scoring Run'); rcj.init(); + rcj.resetObstaclesCallback(); $('#rcjStartStop').addClass('running'); return false; } else { @@ -427,7 +430,7 @@ export class SimulationScene { private readonly aCtx: CanvasRenderingContext2D; private readonly udCanvas: HTMLCanvasElement; readonly uCanvas: HTMLCanvasElement; - private rcjScoringTool: RcjScoringTool; + rcjScoringTool: RcjScoringTool; private _scoring: boolean = false; constructor(sim: SimulationRoberta) { @@ -564,6 +567,24 @@ export class SimulationScene { this.obstacleList = newObstacleList; } + addSomeObstacles(importObstacleList: any[]) { + let that = this; + importObstacleList.forEach((obj) => { + let newObject = SimObjectFactory.getSimObject( + obj.id, + this, + this.sim.selectionListener, + obj.shape, + SimObjectType.Obstacle, + obj.p, + null, + obj.color, + ...obj.params + ); + that.obstacleList.push(newObject); + }); + } + addImportRcjLabel(importRcjLabelList: any[]) { let newRcjList = []; importRcjLabelList.forEach((obj) => { @@ -1225,8 +1246,8 @@ export class SimulationScene { this._redrawMarkers = true; } - setRcjScoringTool(robot: RobotBase, configData) { - this.rcjScoringTool = new RcjScoringTool(robot, configData); + setRcjScoringTool(robot: RobotBase, configData, resetObstacles: Function) { + this.rcjScoringTool = new RcjScoringTool(robot, configData, resetObstacles); this.scoring = true; let scene = this; $('#simCompetition').show(); diff --git a/RobotCyberpi/src/main/java/de/fhg/iais/roberta/visitor/Mbot2PythonVisitor.java b/RobotCyberpi/src/main/java/de/fhg/iais/roberta/visitor/Mbot2PythonVisitor.java index 95de4c41a1..d887380688 100644 --- a/RobotCyberpi/src/main/java/de/fhg/iais/roberta/visitor/Mbot2PythonVisitor.java +++ b/RobotCyberpi/src/main/java/de/fhg/iais/roberta/visitor/Mbot2PythonVisitor.java @@ -99,16 +99,33 @@ protected void visitorGenerateImports() { if ( this.getBean(UsedHardwareBean.class).isSensorUsed(CyberpiConstants.MBUILDSENSOR) ) { this.src.add(", mbuild"); } - nlIndent(); - this.src.add("import time"); - nlIndent(); - this.src.add("import math, random"); - nlIndent(); + this.src.addLine("import time"); + this.src.addLine("import math, random"); + } + + private boolean hasDiffDrive(){ + return this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIFFERENTIALDRIVE); + } + + private boolean hasTimerVariables(){ + return !this.getBean(UsedHardwareBean.class) + .getUsedSensors() + .stream() + .filter(usedSensor -> usedSensor.getType().equals(SC.TIMER)) + .collect(Collectors.groupingBy(UsedSensor::getPort)).isEmpty(); + } + + private boolean hasColors(){ + return this.getBean(UsedHardwareBean.class).getUsedSensors() + .stream() + .filter(usedSensor -> usedSensor.getType().equals(CyberpiConstants.QUADRGB) + && usedSensor.getMode().equals(SC.COLOUR) || usedSensor.getMode().equals(SC.LED)) + .count() != 0; } @Override protected void visitorGenerateGlobalVariables() { - if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIFFERENTIALDRIVE) ) { + if (hasDiffDrive()) { appendRobotVariables(); } generateTimerVariables(); @@ -118,18 +135,15 @@ protected void visitorGenerateGlobalVariables() { private void appendRobotVariables() { ConfigurationComponent diffDrive = getDiffDrive(); if ( diffDrive != null ) { - nlIndent(); + this.src.ensureBlankLines(1); double circumference = Double.parseDouble(diffDrive.getComponentProperties().get(CyberpiConstants.DIFF_WHEEL_DIAMETER)) * Math.PI; double trackWidth = Double.parseDouble(diffDrive.getComponentProperties().get(CyberpiConstants.DIFF_TRACK_WIDTH)); - this.src.add("_trackWidth = "); + this.src.addLine("_trackWidth = "); this.src.add(trackWidth); - nlIndent(); - this.src.add("_circumference = "); + this.src.addLine("_circumference = "); this.src.add(circumference); - nlIndent(); - this.src.add("_diffPortsSwapped = "); + this.src.addLine("_diffPortsSwapped = "); this.src.add(this.rightMotorPort.equals("EM1") ? "True" : "False"); - nlIndent(); } } @@ -148,28 +162,24 @@ protected void collectVariablesForFunctionGlobals() { } private void generateTimerVariables() { - this.getBean(UsedHardwareBean.class) - .getUsedSensors() - .stream() - .filter(usedSensor -> usedSensor.getType().equals(SC.TIMER)) - .collect(Collectors.groupingBy(UsedSensor::getPort)) - .keySet() - .forEach(port -> { - this.src.add("_timer", port, " = cyberpi.timer.get()"); - nlIndent(); - }); + if(hasTimerVariables()){ + this.src.ensureBlankLines(1); + this.getBean(UsedHardwareBean.class) + .getUsedSensors() + .stream() + .filter(usedSensor -> usedSensor.getType().equals(SC.TIMER)) + .collect(Collectors.groupingBy(UsedSensor::getPort)) + .keySet() + .forEach(port -> { + this.src.addLine("_timer", port, " = cyberpi.timer.get()"); + }); + } } private void addColors() { - int colorBlocks = (int) this.getBean(UsedHardwareBean.class).getUsedSensors() - .stream() - .filter(usedSensor -> usedSensor.getType().equals(CyberpiConstants.QUADRGB) - && usedSensor.getMode().equals(SC.COLOUR) || usedSensor.getMode().equals(SC.LED)) - .count(); - - if ( colorBlocks != 0 ) { - nlIndent(); - this.src.add("_colors = {\n", + if ( hasColors() ) { + this.src.ensureBlankLines(1); + this.src.addLine("_colors = {\n", " \"red\": (204,0,0),\n", " \"yellow\": (255,255,0),\n", " \"green\": (51,204,0),\n", @@ -179,20 +189,18 @@ private void addColors() { " \"white\": (255,255,255),\n", " \"black\": (0,0,0)\n", " }"); - nlIndent(); } } - @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); - nlIndent(); - this.src.add("def run():"); + + this.src.ensureBlankLines(1); + this.src.addLine("def run():"); incrIndentation(); if ( !this.usedGlobalVarInFunctions.isEmpty() ) { - nlIndent(); - this.src.add("global ", String.join(", ", this.usedGlobalVarInFunctions)); + this.src.addLine("global ", String.join(", ", this.usedGlobalVarInFunctions)); } return null; @@ -204,40 +212,30 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("cyberpi.display.show_label(\"Exeption on Mbot 2\", 16, int(8 * 0 + 5), int(17 * 0))"); - nlIndent(); - this.src.add("cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1))"); - nlIndent(); - this.src.add("raise"); + this.src.addLine("cyberpi.display.show_label(\"Exeption on Mbot 2\", 16, int(8 * 0 + 5), int(17 * 0))"); + this.src.addLine("cyberpi.display.show_label(e, 16, int(8 * 0 + 5), int(17 * 1))"); + this.src.addLine("raise"); decrIndentation(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.ENCODER) ) { - nlIndent(); - this.src.add("finally:"); + this.src.addLine("finally:"); incrIndentation(); - nlIndent(); - this.src.add("mbot2.motor_stop(\"all\")"); - nlIndent(); - this.src.add("mbot2.EM_stop(\"all\")"); + this.src.addLine("mbot2.motor_stop(\"all\")"); + this.src.addLine("mbot2.EM_stop(\"all\")"); decrIndentation(); } decrIndentation(); - nlIndent(); - this.src.add("main()"); + this.src.ensureBlankLines(1); + this.src.addLine("main()"); } @Override diff --git a/RobotEV3/src/main/java/de/fhg/iais/roberta/visitor/codegen/Ev3PythonVisitor.java b/RobotEV3/src/main/java/de/fhg/iais/roberta/visitor/codegen/Ev3PythonVisitor.java index f4d6978067..e33e6f8950 100644 --- a/RobotEV3/src/main/java/de/fhg/iais/roberta/visitor/codegen/Ev3PythonVisitor.java +++ b/RobotEV3/src/main/java/de/fhg/iais/roberta/visitor/codegen/Ev3PythonVisitor.java @@ -573,12 +573,12 @@ public Void visitSoundSensor(SoundSensor soundSensor) { @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); - nlIndent(); - this.src.add("def run():"); + this.src.ensureBlankLines(1); + this.src.addLine( "def run():"); + incrIndentation(); if ( !this.usedGlobalVarInFunctions.isEmpty() ) { - nlIndent(); - this.src.add("global ", String.join(", ", this.usedGlobalVarInFunctions)); + this.src.addLine("global ", String.join(", ", this.usedGlobalVarInFunctions)); } else { addPassIfProgramIsEmpty(); } @@ -652,38 +652,29 @@ public Void visitMathRandomIntFunct(MathRandomIntFunct mathRandomIntFunct) { @Override protected void visitorGenerateImports() { - this.src.add("#!/usr/bin/python"); - nlIndent(); - nlIndent(); - this.src.add("from __future__ import absolute_import"); - nlIndent(); - this.src.add("from roberta.ev3 import Hal"); - nlIndent(); - this.src.add("from ev3dev import ev3 as ev3dev"); - nlIndent(); - this.src.add("import math"); - nlIndent(); - this.src.add("import os"); - nlIndent(); - this.src.add("import time"); - nlIndent(); - nlIndent(); + this.src.addLine("#!/usr/bin/python"); + this.src.ensureBlankLines(1); + this.src.addLine("from __future__ import absolute_import"); + this.src.addLine("from roberta.ev3 import Hal"); + this.src.addLine("from ev3dev import ev3 as ev3dev"); + this.src.addLine("import math"); + this.src.addLine("import os"); + this.src.addLine("import time"); } @Override protected void visitorGenerateGlobalVariables() { - this.src.add("class BreakOutOfALoop(Exception): pass"); - nlIndent(); - this.src.add("class ContinueLoop(Exception): pass"); - nlIndent(); - nlIndent(); - this.src.add(generateUsedImages()); - this.src.add(generateRegenerateConfiguration()); - nlIndent(); - this.src.add("hal = Hal(_brickConfiguration)"); + this.src.ensureBlankLines(1); + this.src.addLine("class BreakOutOfALoop(Exception): pass"); + this.src.addLine("class ContinueLoop(Exception): pass"); + + this.src.addLine(generateUsedImages()); + this.src.ensureBlankLines(1); + this.src.addLine(generateRegenerateConfiguration()); + this.src.addLine("hal = Hal(_brickConfiguration)"); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.VOICE) ) { - nlIndent(); + this.src.ensureNextLine(); this.src.add("hal.setLanguage(\""); this.src.add(TTSLanguageMapper.getLanguageString(this.language)); this.src.add("\")"); @@ -696,36 +687,24 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("hal.drawText('Fehler im EV3', 0, 0)"); - nlIndent(); - this.src.add("hal.drawText(e.__class__.__name__, 0, 1)"); - nlIndent(); + this.src.addLine("hal.drawText('Fehler im EV3', 0, 0)"); + this.src.addLine("hal.drawText(e.__class__.__name__, 0, 1)"); // FIXME: we can only print about 30 chars - this.src.add("hal.drawText(str(e), 0, 2)"); - nlIndent(); - this.src.add("hal.drawText('Press any key', 0, 4)"); - nlIndent(); - this.src.add("while not hal.isKeyPressed('any'): hal.waitFor(500)"); - nlIndent(); - this.src.add("raise"); + this.src.addLine("hal.drawText(str(e), 0, 2)"); + this.src.addLine("hal.drawText('Press any key', 0, 4)"); + this.src.addLine("while not hal.isKeyPressed('any'): hal.waitFor(500)"); + this.src.addLine("raise"); decrIndentation(); decrIndentation(); - nlIndent(); - super.generateProgramSuffix(withWrapping); } diff --git a/RobotEdison/src/main/java/de/fhg/iais/roberta/visitor/codegen/EdisonPythonVisitor.java b/RobotEdison/src/main/java/de/fhg/iais/roberta/visitor/codegen/EdisonPythonVisitor.java index 1f207258ad..ca972fe92d 100644 --- a/RobotEdison/src/main/java/de/fhg/iais/roberta/visitor/codegen/EdisonPythonVisitor.java +++ b/RobotEdison/src/main/java/de/fhg/iais/roberta/visitor/codegen/EdisonPythonVisitor.java @@ -75,27 +75,20 @@ public EdisonPythonVisitor(List> programPhrases, ClassToInstanceMap @Override protected void visitorGenerateImports() { - this.src.add("import Ed"); - nlIndent(); + this.src.addLine("import Ed"); } @Override protected void visitorGenerateGlobalVariables() { - this.src.add("Ed.EdisonVersion = Ed.V2"); - nlIndent(); - this.src.add("Ed.DistanceUnits = Ed.CM"); - nlIndent(); - this.src.add("Ed.Tempo = Ed.TEMPO_SLOW"); - nlIndent(); - this.src.add("obstacleDetectionOn = False"); - nlIndent(); - this.src.add("Ed.LineTrackerLed(Ed.ON)"); - nlIndent(); - this.src.add("Ed.ReadClapSensor()"); - nlIndent(); //zur Sicherheit -- um den Sensor zurückzusetzen - this.src.add("Ed.ReadLineState()"); - nlIndent(); - this.src.add("Ed.TimeWait(250, Ed.TIME_MILLISECONDS)"); //möglicherweise überflüssig + this.src.ensureBlankLines(1); + this.src.addLine("Ed.EdisonVersion = Ed.V2"); + this.src.addLine("Ed.DistanceUnits = Ed.CM"); + this.src.addLine("Ed.Tempo = Ed.TEMPO_SLOW"); + this.src.addLine("obstacleDetectionOn = False"); + this.src.addLine("Ed.LineTrackerLed(Ed.ON)"); + this.src.addLine("Ed.ReadClapSensor()"); + this.src.addLine("Ed.ReadLineState()"); + this.src.addLine("Ed.TimeWait(250, Ed.TIME_MILLISECONDS)"); //möglicherweise überflüssig } /** @@ -110,8 +103,6 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); //new line for helper methods - nlIndent(); } @Override @@ -300,6 +291,7 @@ public Void visitNumConst(NumConst numConst) { @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); + src.ensureBlankLines(1); return null; } diff --git a/RobotFischertechnik/src/main/java/de/fhg/iais/roberta/visitor/Txt4PythonVisitor.java b/RobotFischertechnik/src/main/java/de/fhg/iais/roberta/visitor/Txt4PythonVisitor.java index cbed615b75..ec8ba3b94f 100644 --- a/RobotFischertechnik/src/main/java/de/fhg/iais/roberta/visitor/Txt4PythonVisitor.java +++ b/RobotFischertechnik/src/main/java/de/fhg/iais/roberta/visitor/Txt4PythonVisitor.java @@ -117,22 +117,23 @@ public Void visitMainTask(MainTask mainTask) { if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.CAMERA) ) { cameraInitialized(usedHardwareBean); } - nlIndent(); + visitorGenerateUserVariablesAndMethods(mainTask); - this.src.add("def run():"); + + this.src.ensureBlankLines(1); + this.src.addLine( "def run():"); incrIndentation(); if ( !this.usedGlobalVarInFunctions.isEmpty() ) { - nlIndent(); - this.src.add("global ", String.join(", ", this.usedGlobalVarInFunctions)); + this.src.addLine("global ", String.join(", ", this.usedGlobalVarInFunctions)); } else { addPassIfProgramIsEmpty(); } if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.CAMERA) ) { - nlIndent(); - this.src.add("camera_initialized()"); + this.src.addLine("camera_initialized()"); } + if ( usedHardwareBean.isSensorUsed(SC.ULTRASONIC) ) { - nlIndent(); + this.src.ensureNextLine(); this.src.add("while not("); for ( int i = 0; i < ultrasonicSensors.size(); i++ ) { String name = ultrasonicSensors.get(i); @@ -143,46 +144,38 @@ public Void visitMainTask(MainTask mainTask) { } this.src.add("):"); incrIndentation(); - nlIndent(); - this.src.add("pass"); + + this.src.addLine("pass"); decrIndentation(); - nlIndent(); + this.src.ensureBlankLines(1); } if ( usedHardwareBean.isActorUsed(FischertechnikConstants.DISPLAYLED) ) { - nlIndent(); + this.src.addLine("for color, value in led_colors.items():"); incrIndentation(); - this.src.add("for color, value in led_colors.items():").nlI(); + this.src.addLine("if color != \"red\":"); incrIndentation(); - this.src.add("if color != \"red\":").nlI(); - this.src.add("display.set_attr(color + \"Led.visible\", str(False).lower())").nlI(); + this.src.addLine("display.set_attr(color + \"Led.visible\", str(False).lower())"); decrIndentation(); decrIndentation(); } return null; } - private void getUltrasonicSensors() { - - } - private void cameraInitialized(UsedHardwareBean usedHardwareBean) { - nlIndent(); - this.src.add("def camera_initialized():"); + this.src.ensureBlankLines(1); + this.src.addLine("def camera_initialized():"); incrIndentation(); - nlIndent(); - this.src.add("while True:"); + this.src.addLine("while True:"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); Map> detectors = getDetectorsMap(); if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.BALL) ) { List balldetectors = detectors.get("CAMERA_BALLDETECTOR"); for ( ConfigurationComponent detector : balldetectors ) { { - this.src.add("ball_detector_" + detector.userDefinedPortName + ".detected()").nlI(); + this.src.addLine("ball_detector_" + detector.userDefinedPortName + ".detected()"); } } } @@ -190,7 +183,7 @@ private void cameraInitialized(UsedHardwareBean usedHardwareBean) { List linedetectors = detectors.get("CAMERA_LINE"); for ( ConfigurationComponent detector : linedetectors ) { { - this.src.add("line_detector_" + detector.userDefinedPortName + ".detected()").nlI(); + this.src.addLine("line_detector_" + detector.userDefinedPortName + ".detected()"); } } } @@ -198,7 +191,7 @@ private void cameraInitialized(UsedHardwareBean usedHardwareBean) { List colordetectors = detectors.get("CAMERA_COLORDETECTOR"); for ( ConfigurationComponent detector : colordetectors ) { { - this.src.add("color_detector_" + detector.userDefinedPortName + ".detected()").nlI(); + this.src.addLine("color_detector_" + detector.userDefinedPortName + ".detected()"); } } } @@ -206,22 +199,19 @@ private void cameraInitialized(UsedHardwareBean usedHardwareBean) { List motiondetectors = detectors.get("CAMERA_MOTIONDETECTOR"); for ( ConfigurationComponent detector : motiondetectors ) { { - this.src.add("motion_detector_" + detector.userDefinedPortName + ".detected()").nlI(); + this.src.addLine("motion_detector_" + detector.userDefinedPortName + ".detected()"); } } } - this.src.add("break"); + this.src.addLine("break"); decrIndentation(); - nlIndent(); - this.src.add("except Exception:"); + this.src.addLine("except Exception:"); incrIndentation(); - nlIndent(); - this.src.add("pass"); + this.src.addLine("pass"); decrIndentation(); decrIndentation(); decrIndentation(); - nlIndent(); - + this.src.ensureBlankLines(1); } public Void visitMotorOnAction(MotorOnAction motorOnAction) { @@ -900,66 +890,65 @@ public Void visitRgbColor(RgbColor rgbColor) { @Override protected void visitorGenerateImports() { UsedHardwareBean usedHardwareBean = this.getBean(UsedHardwareBean.class); - this.src.add("import fischertechnik.factories as txt_factory").nlI(); + this.src.addLine("import fischertechnik.factories as txt_factory"); //only motor if ( usedHardwareBean.isActorUsed(SC.MOTOR) || usedHardwareBean.isActorUsed(FischertechnikConstants.ENCODERMOTOR) ) { - this.src.add("from fischertechnik.controller.Motor import Motor").nlI(); + this.src.addLine("from fischertechnik.controller.Motor import Motor"); } if ( usedHardwareBean.isActorUsed(C.RANDOM) || usedHardwareBean.isActorUsed(C.RANDOM_DOUBLE) ) { - this.src.add("import random").nlI(); + this.src.addLine("import random"); } if ( usedHardwareBean.isActorUsed(SC.DISPLAY) ) { - this.src.add("from lib.display import display").nlI(); + this.src.addLine("from lib.display import display"); } if ( usedHardwareBean.isSensorUsed(SC.COLOUR) ) { - this.src.add("from fischertechnik.models.Color import Color").nlI(); + this.src.addLine("from fischertechnik.models.Color import Color"); } if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.COLOURCOMPARE) ) { - this.src.add("import colorsys").nlI(); + this.src.addLine("import colorsys"); } - - this.src.add("import math").nlI(); - this.src.add("import time").nlI().nlI(); + this.src.addLine("import math"); + this.src.addLine("import time"); } @Override protected void visitorGenerateGlobalVariables() { UsedHardwareBean usedHardwareBean = this.getBean(UsedHardwareBean.class); - this.src.add("txt_factory.init()").nlI(); - this.src.add("txt_factory.init_input_factory()").nlI(); + this.src.ensureBlankLines(1); + this.src.addLine("txt_factory.init()"); + this.src.addLine("txt_factory.init_input_factory()"); if ( usedHardwareBean.isActorUsed(SC.LED) ) { - this.src.add("txt_factory.init_output_factory()").nlI(); + this.src.addLine("txt_factory.init_output_factory()"); } if ( usedHardwareBean.isActorUsed(SC.MOTOR) || usedHardwareBean.isActorUsed(FischertechnikConstants.ENCODERMOTOR) ) { - this.src.add("txt_factory.init_motor_factory()").nlI(); + this.src.addLine("txt_factory.init_motor_factory()"); } if ( usedHardwareBean.isSensorUsed(SC.ENCODER) ) { - this.src.add("txt_factory.init_counter_factory()").nlI(); + this.src.addLine("txt_factory.init_counter_factory()"); } if ( usedHardwareBean.isActorUsed(SC.SERVOMOTOR) ) { - this.src.add("txt_factory.init_servomotor_factory()").nlI(); + this.src.addLine("txt_factory.init_servomotor_factory()"); } if ( usedHardwareBean.isSensorUsed("I2C") ) { - this.src.add("txt_factory.init_i2c_factory()").nlI(); + this.src.addLine("txt_factory.init_i2c_factory()"); } - this.src.add("TXT_M = txt_factory.controller_factory.create_graphical_controller()").nlI(); + this.src.addLine("TXT_M = txt_factory.controller_factory.create_graphical_controller()"); - if ( !usedHardwareBean.getUsedActors().isEmpty() && !usedHardwareBean.getUsedSensors().isEmpty() ) { - nlIndent(); - } + this.src.ensureBlankLines(1); initActors(usedHardwareBean); initSensors(usedHardwareBean); initCamera(usedHardwareBean); - this.src.add("txt_factory.initialized()").nlI(); + this.src.addLine("txt_factory.initialized()"); enableSensors(); - this.src.add("time.sleep(0.1)").nlI(); + this.src.addLine("time.sleep(0.1)"); generateVariables(usedHardwareBean); generateTimerVariables(); } private void generateTimerVariables() { + this.src.ensureBlankLines(1); this.getBean(UsedHardwareBean.class) .getUsedSensors() .stream() @@ -968,8 +957,7 @@ private void generateTimerVariables() { .keySet() .forEach(port -> { this.usedGlobalVarInFunctions.add("_timer" + port); - nlIndent(); - this.src.add("_timer", port, " = time.time()"); + this.src.addLine("_timer", port, " = time.time()"); }); } @@ -977,20 +965,20 @@ private void initActors(UsedHardwareBean usedHardwareBean) { for ( ConfigurationComponent component : this.configurationAst.getConfigurationComponents().values() ) { if ( component.componentType.equals(SC.MOTOR) && usedHardwareBean.isActorUsed(SC.MOTOR) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_M", port, "_motor = txt_factory.motor_factory.create_motor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_M", port, "_motor = txt_factory.motor_factory.create_motor(TXT_M, ", port, ")"); } if ( component.componentType.equals(FischertechnikConstants.ENCODERMOTOR) ) { String port = component.getOptProperty("PORT").substring(1); if ( usedHardwareBean.isActorUsed(FischertechnikConstants.ENCODERMOTOR) ) { - this.src.add("TXT_M_M", port, "_motor = txt_factory.motor_factory.create_encodermotor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_M", port, "_motor = txt_factory.motor_factory.create_encodermotor(TXT_M, ", port, ")"); } if ( usedHardwareBean.isSensorUsed(SC.ENCODER) ) { try { ConfigurationComponent encoder = component.getSubComponents().get(SC.ENCODER).get(0); String counterPort = encoder.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_C", counterPort, "_motor_step_counter = txt_factory.counter_factory.create_encodermotor_counter(TXT_M, ", counterPort, ")").nlI(); + this.src.addLine("TXT_M_C", counterPort, "_motor_step_counter = txt_factory.counter_factory.create_encodermotor_counter(TXT_M, ", counterPort, ")"); if ( usedHardwareBean.isActorUsed(FischertechnikConstants.ENCODERMOTOR) ) { - this.src.add("TXT_M_C", counterPort, "_motor_step_counter.set_motor(TXT_M_M", port, "_motor)").nlI(); + this.src.addLine("TXT_M_C", counterPort, "_motor_step_counter.set_motor(TXT_M_M", port, "_motor)"); } } catch ( UnsupportedOperationException ignored ) { @@ -999,11 +987,11 @@ private void initActors(UsedHardwareBean usedHardwareBean) { } if ( component.componentType.equals(SC.SERVOMOTOR) && usedHardwareBean.isActorUsed(SC.SERVOMOTOR) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_S", port, "_servomotor = txt_factory.servomotor_factory.create_servomotor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_S", port, "_servomotor = txt_factory.servomotor_factory.create_servomotor(TXT_M, ", port, ")"); } if ( component.componentType.equals(SC.LED) && usedHardwareBean.isActorUsed(SC.LED) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_O", port, "_led = txt_factory.output_factory.create_led(TXT_M, " + port + ")").nlI(); + this.src.addLine("TXT_M_O", port, "_led = txt_factory.output_factory.create_led(TXT_M, " + port + ")"); } } } @@ -1012,44 +1000,44 @@ private void initSensors(UsedHardwareBean usedHardwareBean) { for ( ConfigurationComponent component : this.configurationAst.getConfigurationComponents().values() ) { if ( component.componentType.equals(SC.KEY) && usedHardwareBean.isSensorUsed(SC.KEY) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_I", port, "_mini_switch = txt_factory.input_factory.create_mini_switch(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_I", port, "_mini_switch = txt_factory.input_factory.create_mini_switch(TXT_M, ", port, ")"); } else if ( component.componentType.equals(SC.ULTRASONIC) && usedHardwareBean.isSensorUsed(SC.ULTRASONIC) ) { String port = component.getOptProperty("PORT").substring(1); String ultraSonicName = "TXT_M_I" + port + "_ultrasonic_distance_meter"; ultrasonicSensors.add(ultraSonicName); - this.src.add(ultraSonicName, " = txt_factory.input_factory.create_ultrasonic_distance_meter(TXT_M, ", port, ")").nlI(); + this.src.addLine(ultraSonicName, " = txt_factory.input_factory.create_ultrasonic_distance_meter(TXT_M, ", port, ")"); } else if ( component.componentType.equals(SC.INFRARED) && usedHardwareBean.isSensorUsed(SC.INFRARED) ) { String portLeft = component.getOptProperty("PORTL").substring(1); String portRight = component.getOptProperty("PORTR").substring(1); - this.src.add("TXT_M_I", portLeft, "_trail_follower = txt_factory.input_factory.create_trail_follower(TXT_M, ", portLeft, ")").nlI(); - this.src.add("TXT_M_I", portRight, "_trail_follower = txt_factory.input_factory.create_trail_follower(TXT_M, ", portRight, ")").nlI(); + this.src.addLine("TXT_M_I", portLeft, "_trail_follower = txt_factory.input_factory.create_trail_follower(TXT_M, ", portLeft, ")"); + this.src.addLine("TXT_M_I", portRight, "_trail_follower = txt_factory.input_factory.create_trail_follower(TXT_M, ", portRight, ")"); } else if ( component.componentType.equals(SC.LIGHT) && usedHardwareBean.isSensorUsed(SC.LIGHT) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_I", port, "_color_sensor = txt_factory.input_factory.create_color_sensor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_I", port, "_color_sensor = txt_factory.input_factory.create_color_sensor(TXT_M, ", port, ")"); } else if ( component.componentType.equals(SC.TEMPERATURE) && usedHardwareBean.isSensorUsed(SC.TEMPERATURE) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_I", port, "_ntc_resistor = txt_factory.input_factory.create_ntc_resistor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_I", port, "_ntc_resistor = txt_factory.input_factory.create_ntc_resistor(TXT_M, ", port, ")"); } else if ( component.componentType.equals(FischertechnikConstants.PHOTOTRANSISTOR) && usedHardwareBean.isSensorUsed(FischertechnikConstants.PHOTOTRANSISTOR) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_I", port, "_photo_transistor = txt_factory.input_factory.create_photo_transistor(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_I", port, "_photo_transistor = txt_factory.input_factory.create_photo_transistor(TXT_M, ", port, ")"); } else if ( component.componentType.equals("I2C") && usedHardwareBean.isSensorUsed("I2C") ) { if ( usedHardwareBean.isSensorUsed("IMU") ) { int index = getSensorNumber("TXT_IMU"); this.IMU = "TXT_M_I2C_" + index + "_combined_sensor_6pin"; - this.src.add(IMU, " = txt_factory.i2c_factory.create_combined_sensor_6pin(TXT_M, ", index, ")").nlI(); + this.src.addLine(IMU, " = txt_factory.i2c_factory.create_combined_sensor_6pin(TXT_M, ", index, ")"); } if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.GESTURE) ) { int index = getSensorNumber(FischertechnikConstants.GESTURE); this.gesture = "TXT_M_I2C_" + index + "_gesture_sensor"; - this.src.add(gesture, " = txt_factory.i2c_factory.create_gesture_sensor(TXT_M, ", index, ")").nlI(); + this.src.addLine(gesture, " = txt_factory.i2c_factory.create_gesture_sensor(TXT_M, ", index, ")"); } if ( usedHardwareBean.isSensorUsed(SC.ENVIRONMENTAL) ) { int index = getSensorNumber(SC.ENVIRONMENTAL); - this.src.add("TXT_M_I2C_", index, "_environment_sensor = txt_factory.i2c_factory.create_environment_sensor(TXT_M, ", index, ")").nlI(); + this.src.addLine("TXT_M_I2C_", index, "_environment_sensor = txt_factory.i2c_factory.create_environment_sensor(TXT_M, ", index, ")"); } } else if ( component.componentType.equals(SC.ENCODER) && usedHardwareBean.isSensorUsed(SC.ENCODER) ) { String port = component.getOptProperty("PORT").substring(1); - this.src.add("TXT_M_C", port, "_motor_step_counter = txt_factory.counter_factory.create_encodermotor_counter(TXT_M, ", port, ")").nlI(); + this.src.addLine("TXT_M_C", port, "_motor_step_counter = txt_factory.counter_factory.create_encodermotor_counter(TXT_M, ", port, ")"); } } } @@ -1059,21 +1047,22 @@ private boolean gestureModeIsUsed(String mode) { .anyMatch(usedSensor -> usedSensor.getType().equals(FischertechnikConstants.GESTURE) && usedSensor.getMode().equals(mode)); } + private void enableSensors() { if ( !this.IMU.isEmpty() ) { - this.src.add(IMU, ".init_accelerometer(2, 1.5625)").nlI(); - this.src.add(IMU, ".init_magnetometer(25)").nlI(); - this.src.add(IMU, ".init_gyrometer(250, 12.5)").nlI(); + this.src.addLine(IMU, ".init_accelerometer(2, 1.5625)"); + this.src.addLine(IMU, ".init_magnetometer(25)"); + this.src.addLine(IMU, ".init_gyrometer(250, 12.5)"); } if ( !this.gesture.isEmpty() ) { if ( gestureModeIsUsed(FischertechnikConstants.GESTURE) ) { - this.src.add(gesture, ".enable_gesture()").nlI(); + this.src.addLine(gesture, ".enable_gesture()"); } if ( gestureModeIsUsed(SC.AMBIENTLIGHT) || gestureModeIsUsed(SC.COLOUR) || gestureModeIsUsed(SC.RGB) ) { - this.src.add(gesture, ".enable_light()").nlI(); + this.src.addLine(gesture, ".enable_light()"); } if ( gestureModeIsUsed("PROXIMITY") ) { - this.src.add(gesture, ".enable_proximity()").nlI(); + this.src.addLine(gesture, ".enable_proximity()"); } } } @@ -1084,15 +1073,14 @@ private void initCamera(UsedHardwareBean usedHardwareBean) { String usbPort = camera.getOptProperty("PORT").substring(3); String[] resolution = camera.getOptProperty("RESOLUTION").split("x"); String cameraVariable = "TXT_M_USB1_" + usbPort + "_camera"; - this.src.add("txt_factory.init_usb_factory()").nlI(); - this.src.add("txt_factory.init_camera_factory()").nlI(); - this.src.add(cameraVariable + " = txt_factory.usb_factory.create_camera(TXT_M, " + usbPort + ")").nlI(); - this.src.add(cameraVariable + ".set_rotate(False)").nlI(); - this.src.add(cameraVariable + ".set_height(" + resolution[1] + ")").nlI(); - this.src.add(cameraVariable + ".set_width(" + resolution[0] + ")").nlI(); - this.src.add(cameraVariable + ".set_fps(15)").nlI(); - this.src.add(cameraVariable + ".start()").nlI(); - nlIndent(); + this.src.addLine("txt_factory.init_usb_factory()"); + this.src.addLine("txt_factory.init_camera_factory()"); + this.src.addLine(cameraVariable + " = txt_factory.usb_factory.create_camera(TXT_M, " + usbPort + ")"); + this.src.addLine(cameraVariable + ".set_rotate(False)"); + this.src.addLine(cameraVariable + ".set_height(" + resolution[1] + ")"); + this.src.addLine(cameraVariable + ".set_width(" + resolution[0] + ")"); + this.src.addLine(cameraVariable + ".set_fps(15)"); + this.src.addLine(cameraVariable + ".start()"); initDetectors(usedHardwareBean, camera); } } @@ -1107,12 +1095,13 @@ private void initDetectors(UsedHardwareBean usedHardwareBean, ConfigurationCompo for ( ConfigurationComponent detector : motiondetectors ) { detectorRegion = getDetectorregion(detector); - this.src.add("motion_detector_", detector.userDefinedPortName, + this.src.addLine("motion_detector_", detector.userDefinedPortName, " = txt_factory.camera_factory.create_motion_detector(", detectorRegion.get("startX"), ", ", detectorRegion.get("startY"), ", ", detectorRegion.get("width"), ", ", detectorRegion.get("height"), ", ", - detector.getOptProperty("TOLERANCE"), ")").nlI(); - this.src.add(cameraVariable, ".add_detector(motion_detector_", detector.userDefinedPortName, - ")").nlI(); + detector.getOptProperty("TOLERANCE"), ")"); + + this.src.addLine(cameraVariable, ".add_detector(motion_detector_", detector.userDefinedPortName, + ")"); } } if ( usedHardwareBean.isSensorUsed(SC.COLOUR) ) { @@ -1120,11 +1109,12 @@ private void initDetectors(UsedHardwareBean usedHardwareBean, ConfigurationCompo for ( ConfigurationComponent detector : colordetectors ) { detectorRegion = getDetectorregion(detector); - this.src.add("color_detector_", detector.userDefinedPortName, + this.src.addLine("color_detector_", detector.userDefinedPortName, " = txt_factory.camera_factory.create_color_detector(", detectorRegion.get("startX"), ", ", detectorRegion.get("startY"), ", ", detectorRegion.get("width"), ", ", detectorRegion.get("height"), - ", 1)").nlI(); - this.src.add(cameraVariable, ".add_detector(color_detector_", detector.userDefinedPortName, ")").nlI(); + ", 1)"); + + this.src.addLine(cameraVariable, ".add_detector(color_detector_", detector.userDefinedPortName, ")"); } } if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.LINE) ) { @@ -1132,13 +1122,14 @@ private void initDetectors(UsedHardwareBean usedHardwareBean, ConfigurationCompo for ( ConfigurationComponent detector : linedetectors ) { detectorRegion = getDetectorregion(detector); - this.src.add("line_detector_", detector.userDefinedPortName, + this.src.addLine("line_detector_", detector.userDefinedPortName, " = txt_factory.camera_factory.create_line_detector(", detectorRegion.get("startX"), ", ", detectorRegion.get("startY"), ", ", detectorRegion.get("width"), ", ", detectorRegion.get("height"), ", ", detector.getOptProperty("MINIMUM"), ", ", detector.getOptProperty("MAXIMUM"), ", -100, 100, ", - detector.getOptProperty("NUMBERLINES"), ")").nlI(); - this.src.add(cameraVariable, ".add_detector(line_detector_", detector.userDefinedPortName, ")").nlI(); + detector.getOptProperty("NUMBERLINES"), ")"); + + this.src.addLine(cameraVariable, ".add_detector(line_detector_", detector.userDefinedPortName, ")"); } } if ( usedHardwareBean.isSensorUsed(FischertechnikConstants.BALL) ) { @@ -1146,14 +1137,15 @@ private void initDetectors(UsedHardwareBean usedHardwareBean, ConfigurationCompo for ( ConfigurationComponent detector : balldetectors ) { detectorRegion = getDetectorregion(detector); - this.src.add("ball_detector_", detector.userDefinedPortName, + this.src.addLine("ball_detector_", detector.userDefinedPortName, " = txt_factory.camera_factory.create_ball_detector(", detectorRegion.get("startX"), ", ", detectorRegion.get("startY"), ", ", detectorRegion.get("width"), ", ", detectorRegion.get("height"), ", ", detector.getOptProperty("MINIMUM"), ",", detector.getOptProperty("MAXIMUM"), ", -100, 100, ", hexToRgb(detector.getOptProperty("COLOUR")), ", ", - detector.getOptProperty("TOLERANCE"), ")").nlI(); - this.src.add(cameraVariable, ".add_detector(ball_detector_", detector.userDefinedPortName, ")").nlI(); + detector.getOptProperty("TOLERANCE"), ")"); + + this.src.addLine(cameraVariable, ".add_detector(ball_detector_", detector.userDefinedPortName, ")"); } } } @@ -1206,34 +1198,34 @@ private void generateVariables(UsedHardwareBean usedHardwareBean) { if ( usedHardwareBean.isActorUsed(FischertechnikConstants.OMNIDRIVE) ) { ConfigurationComponent omniDrive = getOmniDrive(); if ( omniDrive != null ) { - this.src.add("#init omnidrive").nlI(); - this.src.add("front_left_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_FL") + "_motor").nlI(); - this.src.add("front_right_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_FR") + "_motor").nlI(); - this.src.add("rear_left_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_RL") + "_motor").nlI(); - this.src.add("rear_right_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_RR") + "_motor").nlI(); - this.src.add("WHEEL_DIAMETER = ", omniDrive.getOptProperty("BRICK_WHEEL_DIAMETER")).nlI(); - this.src.add("TRACK_WIDTH = ", omniDrive.getOptProperty("BRICK_TRACK_WIDTH")).nlI(); - this.src.add("WHEEL_BASE = ", omniDrive.getOptProperty("WHEEL_BASE")).nlI(); + this.src.addLine("#init omnidrive"); + this.src.addLine("front_left_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_FL") + "_motor"); + this.src.addLine("front_right_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_FR") + "_motor"); + this.src.addLine("rear_left_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_RL") + "_motor"); + this.src.addLine("rear_right_motor = ", "TXT_M_" + omniDrive.getOptProperty("MOTOR_RR") + "_motor"); + this.src.addLine("WHEEL_DIAMETER = ", omniDrive.getOptProperty("BRICK_WHEEL_DIAMETER")); + this.src.addLine("TRACK_WIDTH = ", omniDrive.getOptProperty("BRICK_TRACK_WIDTH")); + this.src.addLine("WHEEL_BASE = ", omniDrive.getOptProperty("WHEEL_BASE")); this.drive = FischertechnikConstants.OMNIDRIVE; } } else if ( usedHardwareBean.isActorUsed(SC.DIFFERENTIALDRIVE) ) { ConfigurationComponent diffDrive = getDifferentialDrive(); if ( diffDrive != null ) { drive = SC.DIFFERENTIAL_DRIVE; - this.src.add("#init differentialDrive").nlI(); - this.src.add("left_motor = ", "TXT_M_" + diffDrive.getOptProperty("MOTOR_L") + "_motor").nlI(); - this.src.add("right_motor = ", "TXT_M_" + diffDrive.getOptProperty("MOTOR_R") + "_motor").nlI(); - this.src.add("WHEEL_DIAMETER = ", diffDrive.getOptProperty("BRICK_WHEEL_DIAMETER")).nlI(); - this.src.add("TRACK_WIDTH = ", diffDrive.getOptProperty("BRICK_TRACK_WIDTH")).nlI(); + this.src.addLine("#init differentialDrive"); + this.src.addLine("left_motor = ", "TXT_M_" + diffDrive.getOptProperty("MOTOR_L") + "_motor"); + this.src.addLine("right_motor = ", "TXT_M_" + diffDrive.getOptProperty("MOTOR_R") + "_motor"); + this.src.addLine("WHEEL_DIAMETER = ", diffDrive.getOptProperty("BRICK_WHEEL_DIAMETER")); + this.src.addLine("TRACK_WIDTH = ", diffDrive.getOptProperty("BRICK_TRACK_WIDTH")); } } if ( usedHardwareBean.isSensorUsed(SC.ENCODER) ) { - this.src.add("STEPS_PER_ROTATION = 128").nlI(); + this.src.addLine("STEPS_PER_ROTATION = 128"); } if ( usedHardwareBean.isActorUsed(FischertechnikConstants.DISPLAYLED) ) { - this.src.add("current_led = \"redLed\"").nlI(); + this.src.addLine("current_led = \"redLed\""); - this.src.add("led_colors = {\n" + + this.src.addLine("led_colors = {\n" + " \"red\": 0xcc0000,\n" + " \"yellow\": 0xffff00,\n" + " \"green\": 0x33cc00,\n" + @@ -1242,7 +1234,7 @@ private void generateVariables(UsedHardwareBean usedHardwareBean) { " \"purple\": 0xcc33cc,\n" + " \"white\": 0xffffff,\n" + " \"black\": 0x000000\n" + - "}").nlI(); + "}"); } } @@ -1252,27 +1244,21 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("print(e)"); + this.src.addLine("print(e)"); decrIndentation(); decrIndentation(); - nlIndent(); - nlIndent(); - this.src.add("main()"); + this.src.ensureBlankLines(1); + this.src.addLine("main()"); } private String getPortFromConfig(String name) { diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeV3PythonVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeV3PythonVisitor.java index 6e4050426b..cc8b934262 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeV3PythonVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/CalliopeV3PythonVisitor.java @@ -115,15 +115,12 @@ protected void generateProgramPrefix(boolean withWrapping) { Map a = robotConfiguration.getAllConfigurationComponentByType(SC.SERVOMOTOR); a.forEach((s, configurationComponent) -> { String port = configurationComponent.getComponentProperties().get("PIN1"); - this.src.add(this.firmware, ".", PIN_MAP.get(port), ".set_analog_period(20)"); - nlIndent(); + this.src.addLine(this.firmware, ".", PIN_MAP.get(port), ".set_analog_period(20)"); }); } if ( this.getBean(UsedHardwareBean.class).isActorUsed("MOTIONKIT") ) { - this.src.add(this.firmware, ".", PIN_MAP.get("C16"), ".set_analog_period(20)"); - nlIndent(); - this.src.add(this.firmware, ".", PIN_MAP.get("C17"), ".set_analog_period(20)"); - nlIndent(); + this.src.addLine(this.firmware, ".", PIN_MAP.get("C16"), ".set_analog_period(20)"); + this.src.addLine(this.firmware, ".", PIN_MAP.get("C17"), ".set_analog_period(20)"); } } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/JoyCarPythonVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/JoyCarPythonVisitor.java index f93c95acaa..9e1442d70d 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/JoyCarPythonVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/JoyCarPythonVisitor.java @@ -57,62 +57,48 @@ public JoyCarPythonVisitor( @Override protected void visitorGenerateImports() { this.src.add("import microbit"); - nlIndent(); - this.src.add("import random"); - nlIndent(); - this.src.add("import math"); - nlIndent(); + this.src.addLine("import random"); + this.src.addLine("import math"); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RGBLED) ) { - this.src.add("import neopixel"); - nlIndent(); + this.src.addLine("import neopixel"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RADIO) ) { - this.src.add("import radio"); - nlIndent(); + this.src.addLine("import radio"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.MUSIC) ) { - this.src.add("import music"); - nlIndent(); + this.src.addLine("import music"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(SC.ULTRASONIC) ) { - this.src.add("import machine"); - nlIndent(); + this.src.addLine("import machine"); } - nlIndent(); } @Override protected void visitorGenerateGlobalVariables() { - this.src.add("class BreakOutOfALoop(Exception): pass"); - nlIndent(); - this.src.add("class ContinueLoop(Exception): pass"); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine("class BreakOutOfALoop(Exception): pass"); + this.src.addLine("class ContinueLoop(Exception): pass"); + + this.src.ensureBlankLines(1); if ( (this.getBean(UsedHardwareBean.class).isActorUsed("I2C")) ) { - nlIndent(); - this.src.add("microbit.i2c.init(freq=400000, sda=microbit.pin20, scl=microbit.pin19)"); - nlIndent(); + this.src.addLine("microbit.i2c.init(freq=400000, sda=microbit.pin20, scl=microbit.pin19)"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIFFERENTIALDRIVE) || (this.getBean(UsedHardwareBean.class).isActorUsed(SC.MOTOR)) ) { - this.src.add("microbit.i2c.write(0x70, b'\\x00\\x01')"); - nlIndent(); - this.src.add("microbit.i2c.write(0x70, b'\\xE8\\xAA')"); - nlIndent(); + this.src.addLine("microbit.i2c.write(0x70, b'\\x00\\x01')"); + this.src.addLine("microbit.i2c.write(0x70, b'\\xE8\\xAA')"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.SERVOMOTOR) ) { - this.src.add("microbit.pin1.set_analog_period(20)"); - nlIndent(); - this.src.add("microbit.pin13.set_analog_period(20)"); - nlIndent(); + this.src.addLine("microbit.pin1.set_analog_period(20)"); + this.src.addLine("microbit.pin13.set_analog_period(20)"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RGBLED) ) { - this.src.add("np = neopixel.NeoPixel(microbit.pin0, 8)"); - nlIndent(); + this.src.addLine("np = neopixel.NeoPixel(microbit.pin0, 8)"); } - nlIndent(); - this.src.add("timer1 = microbit.running_time()"); + + this.src.ensureBlankLines(1); + this.src.addLine("timer1 = microbit.running_time()"); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RADIO) ) { - nlIndent(); - this.src.add("radio.on()"); + this.src.addLine("radio.on()"); } } @@ -134,12 +120,10 @@ public Void visitDriveAction(DriveAction driveAction) { driveAction.param.getSpeed().accept(this); this.src.add(")"); if ( hasDuration ) { - nlIndent(); - this.src.add("microbit.sleep("); + this.src.addLine("microbit.sleep("); driveAction.param.getDuration().getValue().accept(this); this.src.add(")"); - nlIndent(); - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); } return null; } @@ -205,12 +189,10 @@ public Void visitTurnAction(TurnAction turnAction) { this.src.add(")"); if ( hasDuration ) { - nlIndent(); - this.src.add("microbit.sleep("); + this.src.addLine("microbit.sleep("); turnAction.param.getDuration().getValue().accept(this); this.src.add(")"); - nlIndent(); - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); } return null; } @@ -228,12 +210,10 @@ public Void visitCurveAction(CurveAction curveAction) { this.src.add(")"); if ( hasDuration ) { - nlIndent(); - this.src.add("microbit.sleep("); + this.src.addLine("microbit.sleep("); curveAction.paramRight.getDuration().getValue().accept(this); this.src.add(")"); - nlIndent(); - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); } return null; } @@ -399,43 +379,33 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("raise"); + this.src.addLine("raise"); decrIndentation(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIFFERENTIALDRIVE) || this.getBean(UsedHardwareBean.class).isActorUsed(SC.MOTOR) ) { - nlIndent(); - this.src.add("finally:"); + this.src.addLine("finally:"); incrIndentation(); - nlIndent(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIFFERENTIALDRIVE) ) { - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.DIFFDRIVE), "(0, 0)"); } else if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.MOTOR) ) { - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.SETSPEED), "(\"MOT_L\", ", "0)"); - nlIndent(); - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.SETSPEED), "(\"MOT_R\", ", "0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.SETSPEED), "(\"MOT_L\", ", "0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(JoycarMethods.SETSPEED), "(\"MOT_R\", ", "0)"); } decrIndentation(); } decrIndentation(); - nlIndent(); - nlIndent(); - this.src.add("if __name__ == \"__main__\":"); + this.src.ensureBlankLines(1); + this.src.addLine("if __name__ == \"__main__\":"); incrIndentation(); - nlIndent(); - this.src.add("main()"); + this.src.addLine("main()"); decrIndentation(); } diff --git a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedPythonVisitor.java b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedPythonVisitor.java index 1517c782f0..121e057be6 100644 --- a/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedPythonVisitor.java +++ b/RobotMbed/src/main/java/de/fhg/iais/roberta/visitor/codegen/MbedPythonVisitor.java @@ -251,12 +251,11 @@ protected void collectVariablesForFunctionGlobals() { @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); - nlIndent(); - this.src.add("def run():"); + this.src.ensureBlankLines(1); + this.src.addLine("def run():"); incrIndentation(); - nlIndent(); if ( !this.usedGlobalVarInFunctions.isEmpty() ) { - this.src.add("global ", String.join(", ", this.usedGlobalVarInFunctions)); + this.src.addLine("global ", String.join(", ", this.usedGlobalVarInFunctions)); } // TODO add as soon as robot runtime is updated // if ( this.robotConfiguration.isComponentTypePresent(SC.DIGITAL_PIN) ) { @@ -285,33 +284,24 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("raise"); + this.src.addLine("raise"); decrIndentation(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.CALLIBOT) ) { - nlIndent(); - this.src.add("finally:"); + this.src.addLine("finally:"); incrIndentation(); - nlIndent(); - this.src.add("callibot.stop()"); - nlIndent(); + this.src.addLine("callibot.stop()"); decrIndentation(); } decrIndentation(); - nlIndent(); super.generateProgramSuffix(withWrapping); } @@ -346,8 +336,7 @@ public Void visitPinTouchSensor(PinTouchSensor pinTouchSensor) { @Override public Void visitRadioSendAction(RadioSendAction radioSendAction) { this.src.add("radio.config(power=", radioSendAction.power, ")"); - nlIndent(); - this.src.add("radio.send(str("); + this.src.addLine("radio.send(str("); radioSendAction.message.accept(this); this.src.add("))"); return null; @@ -406,95 +395,73 @@ public Void visitDisplayGetPixelAction(DisplayGetPixelAction displayGetPixelActi @Override protected void visitorGenerateImports() { this.src.add("import " + this.firmware); - nlIndent(); - this.src.add("import random"); - nlIndent(); - this.src.add("import math"); - nlIndent(); + this.src.addLine("import random"); + this.src.addLine("import math"); + if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RADIO) ) { - this.src.add("import radio"); - nlIndent(); + this.src.addLine("import radio"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.MUSIC) ) { - this.src.add("import music"); - nlIndent(); + this.src.addLine("import music"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.PIN_VALUE) ) { - this.src.add("import machine"); - nlIndent(); + this.src.addLine("import machine"); } if ( this.firmware == "calliopemini" ) { if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RGBLED) ) { - this.src.add("import neopixel"); - nlIndent(); + this.src.addLine("import neopixel"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.ULTRASONIC) ) { - this.src.add("from machine import time_pulse_us"); - nlIndent(); + this.src.addLine("from machine import time_pulse_us"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.FOUR_DIGIT_DISPLAY) ) { - this.src.add("from tm1637 import TM1637"); - nlIndent(); + this.src.addLine("from tm1637 import TM1637"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.CALLIBOT) ) { - this.src.add("from callibot2 import Callibot2"); - nlIndent(); + this.src.addLine("from callibot2 import Callibot2"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(SC.COLOR) ) { - this.src.add("from tcs3472 import tcs3472"); - nlIndent(); + this.src.addLine("from tcs3472 import tcs3472"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(SC.HUMIDITY) ) { - this.src.add("from sht31 import SHT31"); + this.src.addLine("from sht31 import SHT31"); } } - nlIndent(); } @Override protected void visitorGenerateGlobalVariables() { - this.src.add("class BreakOutOfALoop(Exception): pass"); - nlIndent(); - this.src.add("class ContinueLoop(Exception): pass"); - nlIndent(); - nlIndent(); - this.src.add("timer1 = " + this.firmware + ".running_time()"); + this.src.ensureBlankLines(1); + this.src.addLine("class BreakOutOfALoop(Exception): pass"); + this.src.addLine("class ContinueLoop(Exception): pass"); + this.src.ensureBlankLines(1); + this.src.addLine("timer1 = " + this.firmware + ".running_time()"); if ( this.firmware == "calliopemini" ) { - nlIndent(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RGBLED) ) { - this.src.add("np = neopixel.NeoPixel(" + this.firmware + ".pin_RGB, 3)"); - nlIndent(); + this.src.addLine("np = neopixel.NeoPixel(" + this.firmware + ".pin_RGB, 3)"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.FOUR_DIGIT_DISPLAY) ) { - this.src.add("fdd = TM1637()"); - nlIndent(); + this.src.addLine("fdd = TM1637()"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DISPLAY_GRAYSCALE) ) { - this.src.add("brightness = 9"); - nlIndent(); + this.src.addLine("brightness = 9"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.CALLIBOT) ) { - this.src.add("callibot = Callibot2()"); - nlIndent(); + this.src.addLine("callibot = Callibot2()"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(SC.COLOR) ) { - this.src.add("color_sensor = tcs3472()"); - nlIndent(); - this.src.add("LIGHT_CONST = 40"); - nlIndent(); + this.src.addLine("color_sensor = tcs3472()"); + this.src.addLine("LIGHT_CONST = 40"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(SC.HUMIDITY) ) { - this.src.add("sht31 = SHT31()"); - nlIndent(); + this.src.addLine("sht31 = SHT31()"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RADIO) ) { - this.src.add("rssi = 0"); - nlIndent(); + this.src.addLine("rssi = 0"); } } if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.RADIO) ) { - nlIndent(); - this.src.add("radio.on()"); + this.src.addLine("radio.on()"); } } @@ -563,5 +530,4 @@ public Void visitSwitchLedMatrixAction(SwitchLedMatrixAction switchLedMatrixActi return null; } - } diff --git a/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonSimVisitor.java b/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonSimVisitor.java index 7698128d9e..b240732c0a 100644 --- a/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonSimVisitor.java +++ b/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonSimVisitor.java @@ -123,17 +123,15 @@ public Void visitWaitTimeStmt(WaitTimeStmt waitTimeStmt) { @Override public Void visitMainTask(MainTask mainTask) { - super.visitorGenerateUserVariablesAndMethods(mainTask); + visitorGenerateUserVariablesAndMethods(mainTask); StmtList variables = mainTask.variables; - nlIndent(); - this.src.add("def run():"); + this.src.ensureBlankLines(1); + this.src.addLine("def run():"); incrIndentation(); - nlIndent(); - this.src.add("robot.step(robot.timeStep)"); + this.src.addLine("robot.step(robot.timeStep)"); List variableList = variables.get(); if ( !variableList.isEmpty() ) { - nlIndent(); // insert global statement for all variables // TODO: there must be an easier way without the casts // TODO: we'd only list variables that we change, ideally we'd do this in @@ -141,7 +139,7 @@ public Void visitMainTask(MainTask mainTask) { // would need the list of mainTask variables (store in the class?) // TODO: I could store the names as a list in the instance and filter it against the parameters // in visitMethodVoid, visitMethodReturn - this.src.add("global "); + this.src.addLine("global "); boolean first = true; for ( Stmt s : variables.get() ) { ExprStmt es = (ExprStmt) s; @@ -410,24 +408,19 @@ public Void visitRepeatStmt(RepeatStmt repeatStmt) { @Override protected void visitorGenerateImports() { - this.src.add("#!/usr/bin/python"); - nlIndent(); - nlIndent(); + this.src.addLine("#!/usr/bin/python"); Set> usedMethods = new HashSet<>(); usedMethods.add(NaoSimMethods.MOTIONS); usedMethods.add(NaoSimMethods.TEMPLATE); String template = this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodDefinitions(usedMethods); - this.src.add(template); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine(template); if ( !this.getBean(UsedHardwareBean.class).getLoopsLabelContainer().isEmpty() ) { - nlIndent(); - this.src.add("class BreakOutOfALoop(Exception): pass"); - nlIndent(); - this.src.add("class ContinueLoop(Exception): pass"); - nlIndent(); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine("class BreakOutOfALoop(Exception): pass"); + this.src.addLine("class ContinueLoop(Exception): pass"); } } @@ -444,30 +437,21 @@ protected void generateProgramSuffix(boolean withWrapping) { if ( !withWrapping ) { return; } - nlIndent(); - this.src.add("wait(robot, 3000)"); // give the simulation time to render all - nlIndent(); - this.src.add("print(\"finished\")"); + this.src.addLine("wait(robot, 3000)"); // give the simulation time to render all + this.src.addLine("print(\"finished\")"); decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("raise"); + this.src.addLine("raise"); decrIndentation(); - nlIndent(); decrIndentation(); - nlIndent(); super.generateProgramSuffix(withWrapping); } diff --git a/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonVisitor.java b/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonVisitor.java index a257549e9f..6aef080a07 100644 --- a/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonVisitor.java +++ b/RobotNAO/src/main/java/de/fhg/iais/roberta/visitor/codegen/NaoPythonVisitor.java @@ -128,21 +128,19 @@ public Void visitWaitTimeStmt(WaitTimeStmt waitTimeStmt) { @Override public Void visitMainTask(MainTask mainTask) { - super.visitorGenerateUserVariablesAndMethods(mainTask); StmtList variables = mainTask.variables; - nlIndent(); - this.src.add("def run():"); + + visitorGenerateUserVariablesAndMethods(mainTask); + this.src.ensureBlankLines(1); + this.src.addLine("def run():"); incrIndentation(); if ( mainTask.debug.equals("TRUE") ) { - nlIndent(); - this.src.add("h.setAutonomousLife('ON')"); + this.src.addLine("h.setAutonomousLife('ON')"); } else { - nlIndent(); - this.src.add("h.setAutonomousLife('OFF')"); + this.src.addLine("h.setAutonomousLife('OFF')"); } List variableList = variables.get(); if ( !variableList.isEmpty() ) { - nlIndent(); // insert global statement for all variables // TODO: there must be an easier way without the casts // TODO: we'd only list variables that we change, ideally we'd do this in @@ -150,7 +148,7 @@ public Void visitMainTask(MainTask mainTask) { // would need the list of mainTask variables (store in the class?) // TODO: I could store the names as a list in the instance and filter it against the parameters // in visitMethodVoid, visitMethodReturn - this.src.add("global "); + this.src.addLine("global "); boolean first = true; for ( Stmt s : variables.get() ) { ExprStmt es = (ExprStmt) s; @@ -912,32 +910,23 @@ private String extractAxis2FromSlot(String[] slots) { @Override protected void visitorGenerateImports() { this.src.add("#!/usr/bin/python"); - nlIndent(); - nlIndent(); - this.src.add("import math"); - nlIndent(); - this.src.add("import time"); - nlIndent(); - this.src.add("import random"); - nlIndent(); - this.src.add("from roberta import Hal"); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine("import math"); + this.src.addLine("import time"); + this.src.addLine("import random"); + this.src.addLine("from roberta import Hal"); } @Override protected void visitorGenerateGlobalVariables() { - this.src.add("h = Hal()"); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine("h = Hal()"); generateSensors(); - nlIndent(); if ( !this.getBean(UsedHardwareBean.class).getLoopsLabelContainer().isEmpty() ) { - nlIndent(); - this.src.add("class BreakOutOfALoop(Exception): pass"); - nlIndent(); - this.src.add("class ContinueLoop(Exception): pass"); - nlIndent(); - nlIndent(); + this.src.ensureBlankLines(1); + this.src.addLine("class BreakOutOfALoop(Exception): pass"); + this.src.addLine("class ContinueLoop(Exception): pass"); } } @@ -947,31 +936,23 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("h.say(\"Error!\" + str(e))"); + this.src.addLine("h.say(\"Error!\" + str(e))"); decrIndentation(); - nlIndent(); - this.src.add("finally:"); + this.src.addLine("finally:"); incrIndentation(); - nlIndent(); removeSensors(); - this.src.add("h.myBroker.shutdown()"); + this.src.addLine("h.myBroker.shutdown()"); decrIndentation(); decrIndentation(); - nlIndent(); super.generateProgramSuffix(withWrapping); } @@ -992,28 +973,19 @@ private void generateSensors() { for ( UsedSensor usedSensor : this.getBean(UsedHardwareBean.class).getUsedSensors() ) { switch ( usedSensor.getType() ) { case SC.ULTRASONIC: - this.src.add("h.sonar.subscribe(\"OpenRobertaApp\")"); - nlIndent(); + this.src.addLine("h.sonar.subscribe(\"OpenRobertaApp\")"); break; case SC.DETECT_MARK: - this.src.add("h.mark.subscribe(\"RobertaLab\", 500, 0.0)"); - nlIndent(); + this.src.addLine("h.mark.subscribe(\"RobertaLab\", 500, 0.0)"); break; case SC.NAO_FACE: - nlIndent(); - this.src.add("from roberta import FaceRecognitionModule"); - nlIndent(); - this.src.add("faceRecognitionModule = FaceRecognitionModule(\"faceRecognitionModule\")"); - nlIndent(); + this.src.addLine("from roberta import FaceRecognitionModule"); + this.src.addLine("faceRecognitionModule = FaceRecognitionModule(\"faceRecognitionModule\")"); break; case SC.NAO_SPEECH: - nlIndent(); - this.src.add("from roberta import SpeechRecognitionModule"); - nlIndent(); - this.src.add("speechRecognitionModule = SpeechRecognitionModule(\"speechRecognitionModule\")"); - nlIndent(); - this.src.add("speechRecognitionModule.pauseASR()"); - nlIndent(); + this.src.addLine("from roberta import SpeechRecognitionModule"); + this.src.addLine("speechRecognitionModule = SpeechRecognitionModule(\"speechRecognitionModule\")"); + this.src.addLine("speechRecognitionModule.pauseASR()"); break; case SC.COLOR: case SC.INFRARED: @@ -1039,20 +1011,16 @@ private void removeSensors() { case BlocklyConstants.INFRARED: break; case BlocklyConstants.ULTRASONIC: - this.src.add("h.sonar.unsubscribe(\"OpenRobertaApp\")"); - nlIndent(); + this.src.addLine("h.sonar.unsubscribe(\"OpenRobertaApp\")"); break; case BlocklyConstants.DETECT_MARK: - this.src.add("h.mark.unsubscribe(\"RobertaLab\")"); - nlIndent(); + this.src.addLine("h.mark.unsubscribe(\"RobertaLab\")"); break; case BlocklyConstants.NAO_FACE: - this.src.add("faceRecognitionModule.unsubscribe()"); - nlIndent(); + this.src.addLine("faceRecognitionModule.unsubscribe()"); break; case BlocklyConstants.NAO_SPEECH: - this.src.add("speechRecognitionModule.unsubscribe()"); - nlIndent(); + this.src.addLine("speechRecognitionModule.unsubscribe()"); break; case BlocklyConstants.LIGHT: case BlocklyConstants.COMPASS: diff --git a/RobotRobotino/src/main/java/de/fhg/iais/roberta/visitor/RobotinoPythonVisitor.java b/RobotRobotino/src/main/java/de/fhg/iais/roberta/visitor/RobotinoPythonVisitor.java index 8e7969a60c..fe2da17c81 100644 --- a/RobotRobotino/src/main/java/de/fhg/iais/roberta/visitor/RobotinoPythonVisitor.java +++ b/RobotRobotino/src/main/java/de/fhg/iais/roberta/visitor/RobotinoPythonVisitor.java @@ -65,26 +65,20 @@ public RobotinoPythonVisitor( } private void generateVariables() { - this.src.add("sys.stdout = io.StringIO()\nsys.stderr = io.StringIO()"); - nlIndent(); - this.src.add("ROBOTINOIP = \"127.0.0.1:80\""); - nlIndent(); - this.src.add("PARAMS = {'sid':'robertaProgram'}"); - nlIndent(); - this.src.add("MAXSPEED = 0.5"); - nlIndent(); - this.src.add("MAXROTATION = 0.57"); + this.src.addLine("sys.stdout = io.StringIO()\nsys.stderr = io.StringIO()"); + this.src.addLine("ROBOTINOIP = \"127.0.0.1:80\""); + this.src.addLine("PARAMS = {'sid':'robertaProgram'}"); + this.src.addLine("MAXSPEED = 0.5"); + this.src.addLine("MAXROTATION = 0.57"); generateOptionalVariables(); } private void generateOptionalVariables() { if ( this.getBean(UsedHardwareBean.class).isActorUsed(SC.DIGITAL_PIN) ) { - nlIndent(); - this.src.add("_digitalPinValues = [0 for i in range(8)]"); + this.src.addLine("_digitalPinValues = [0 for i in range(8)]"); } if ( this.getBean(UsedHardwareBean.class).isActorUsed(RobotinoConstants.OMNIDRIVE) ) { - nlIndent(); - this.src.add("currentSpeed = [0, 0, 0]"); + this.src.addLine("currentSpeed = [0, 0, 0]"); } } @@ -112,72 +106,54 @@ public Void visitVarDeclaration(VarDeclaration var) { @Override protected void visitorGenerateImports() { - this.src.add("#!/usr/bin/env python3"); - nlIndent(); - this.src.add("import math, random, time, requests, threading, sys, io"); - nlIndent(); + this.src.addLine("#!/usr/bin/env python3"); + this.src.addLine("import math, random, time, requests, threading, sys, io"); } @Override protected void visitorGenerateGlobalVariables() { + this.src.ensureBlankLines(1); generateVariables(); - nlIndent(); + this.src.ensureBlankLines(1); generateTimerVariables(false); - nlIndent(); } @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); - nlIndent(); - this.src.add("def run(RV):"); + this.src.addNLine(1, "def run(RV):"); incrIndentation(); generateGlobalVariables(); - this.src.add("time.sleep(1)"); + this.src.addLine("time.sleep(1)"); if ( this.getBean(UsedHardwareBean.class).isSensorUsed(RobotinoConstants.ODOMETRY) ) { - nlIndent(); //odometrieReset - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(RobotinoMethods.RESETODOMETRY), "(RV, 0, 0, 0)"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(RobotinoMethods.RESETODOMETRY), "(RV, 0, 0, 0)"); } if ( this.getBean(UsedHardwareBean.class).isSensorUsed(RobotinoConstants.CAMERA) ) { //default threshold - nlIndent(); - this.src.add("RV.writeFloat(4, 100) "); - nlIndent(); - this.src.add("time.sleep(0.05)"); + this.src.addLine("RV.writeFloat(4, 100) "); + this.src.addLine("time.sleep(0.05)"); } generateTimerVariables(true); for ( VarDeclaration var : varDeclarations ) { nlIndent(); declareGlobalVariable(var); } - - nlIndent(); return null; } - private boolean hasUserdefinedMethods() { - return this.programPhrases - .stream().anyMatch(phrase -> phrase.getKind().getCategory() == Category.METHOD && !phrase.getKind().hasName("METHOD_CALL")); - } - private void generateMain() { - this.src.add("def main(RV):"); + this.src.addNLine(1, "def main(RV):"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run(RV)"); + this.src.addLine("run(RV)"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); - nlIndent(); - this.src.add("print(e)"); - nlIndent(); - this.src.add("raise"); + this.src.addLine("print(e)"); + this.src.addLine("raise"); decrIndentation(); nlIndent(); generateFinally(); @@ -186,10 +162,9 @@ private void generateMain() { } private void generateStart() { - this.src.add("def start(RV):"); + this.src.addNLine(1,"def start(RV):"); incrIndentation(); - nlIndent(); - this.src.add("motorDaemon2 = threading.Thread(target=main, daemon=True, args=(RV,), name='mainProgram')\n motorDaemon2.start()"); + this.src.addLine("motorDaemon2 = threading.Thread(target=main, daemon=True, args=(RV,), name='mainProgram')\n motorDaemon2.start()"); decrIndentation(); nlIndent(); } @@ -201,10 +176,8 @@ private void declareGlobalVariable(VarDeclaration var) { private void generateGlobalVariables() { //add usermade global variables if ( !this.usedGlobalVarInFunctions.isEmpty() ) { - nlIndent(); - this.src.add("global ", String.join(", ", this.usedGlobalVarInFunctions)); + this.src.addLine("global ", String.join(", ", this.usedGlobalVarInFunctions)); } - nlIndent(); } @Override @@ -213,40 +186,31 @@ protected void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); appendViewMethods(); decrIndentation(); - nlIndent(); } private void appendViewMethods() { - this.src.add("def step(RV):"); + this.src.addNLine(1,"def step(RV):"); incrIndentation(); if ( this.getBean(UsedHardwareBean.class).isActorUsed(RobotinoConstants.OMNIDRIVE) ) { - nlIndent(); - this.src.add(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(RobotinoMethods.POSTVEL), "()"); + this.src.addLine(this.getBean(CodeGeneratorSetupBean.class).getHelperMethodGenerator().getHelperMethodName(RobotinoMethods.POSTVEL), "()"); } else { - nlIndent(); - this.src.add("pass"); + this.src.addLine("pass"); } decrIndentation(); nlIndent(); nlIndent(); generateMain(); generateStart(); - nlIndent(); - this.src.add("def stop(RV):"); + this.src.addNLine(1,"def stop(RV):"); incrIndentation(); - nlIndent(); - this.src.add("pass"); + this.src.addLine("pass"); decrIndentation(); nlIndent(); - nlIndent(); - this.src.add("def cleanup(RV):"); + this.src.addNLine(1,"def cleanup(RV):"); incrIndentation(); - nlIndent(); - this.src.add("pass"); + this.src.addLine("pass"); decrIndentation(); nlIndent(); } @@ -287,7 +251,7 @@ public Void visitTimerSensor(TimerSensor timerSensor) { switch ( timerSensor.getMode() ) { case SC.DEFAULT: case SC.VALUE: - this.src.add("((time.time() - _timer", timerSensor.getUserDefinedPort(), ")/1000)"); + this.src.add("((time.time() - _timer", timerSensor.getUserDefinedPort(), ") / 1000)"); break; case SC.RESET: this.src.add("_timer", timerSensor.getUserDefinedPort(), " = time.time()"); @@ -313,11 +277,10 @@ private void generateTimerVariables(boolean decleration) { .keySet() .forEach(port -> { this.usedGlobalVarInFunctions.add("_timer" + port); - nlIndent(); if ( decleration ) { - this.src.add("_timer", port, " = time.time()"); + this.src.addLine("_timer", port, " = time.time()"); } else { - this.src.add("_timer", port, " = None"); + this.src.addLine("_timer", port, " = None"); } }); } @@ -337,7 +300,7 @@ public Void visitWaitStmt(WaitStmt waitStmt) { public Void visitWaitTimeStmt(WaitTimeStmt waitTimeStmt) { this.src.add("time.sleep("); waitTimeStmt.time.accept(this); - this.src.add("/1000)"); + this.src.add(" / 1000)"); return null; } diff --git a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/AbstractSpikePythonVisitor.java b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/AbstractSpikePythonVisitor.java index 33de0f555e..2da6a1b9f4 100644 --- a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/AbstractSpikePythonVisitor.java +++ b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/AbstractSpikePythonVisitor.java @@ -37,28 +37,23 @@ protected final void generateProgramSuffix(boolean withWrapping) { return; } decrIndentation(); // everything is still indented from main program - nlIndent(); - nlIndent(); - this.src.add("def main():"); + this.src.ensureBlankLines(1); + this.src.addLine("def main():"); incrIndentation(); - nlIndent(); - this.src.add("try:"); + this.src.addLine("try:"); incrIndentation(); - nlIndent(); - this.src.add("run()"); + this.src.addLine("run()"); decrIndentation(); - nlIndent(); - this.src.add("except Exception as e:"); + this.src.addLine("except Exception as e:"); incrIndentation(); nlIndent(); addExceptionSadFaceToCode(); decrIndentation(); //TODO finally close open ports decrIndentation(); - nlIndent(); - nlIndent(); - this.src.add("main()"); + this.src.ensureBlankLines(1); + this.src.addLine("main()"); } /** @@ -69,9 +64,9 @@ protected final void generateProgramSuffix(boolean withWrapping) { @Override public Void visitMainTask(MainTask mainTask) { visitorGenerateUserVariablesAndMethods(mainTask); + this.src.ensureBlankLines(1); + this.src.addLine("def run():"); - nlIndent(); - this.src.add("def run():"); incrIndentation(); if ( !this.usedGlobalVarInFunctions.isEmpty() ) { nlIndent(); diff --git a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spike/SpikePythonVisitor.java b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spike/SpikePythonVisitor.java index ae704c105a..150cd71313 100644 --- a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spike/SpikePythonVisitor.java +++ b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spike/SpikePythonVisitor.java @@ -585,74 +585,70 @@ public Void visitWaitTimeStmt(WaitTimeStmt waitTimeStmt) { @Override protected void visitorGenerateImports() { UsedHardwareBean usedHardwareBean = this.getBean(UsedHardwareBean.class); - this.src.add("import spike").nlI(); - this.src.add("import math").nlI(); + this.src.addLine("import spike"); + + this.src.addLine("import math"); + if ( usedHardwareBean.isActorUsed(C.RANDOM) || usedHardwareBean.isActorUsed(C.RANDOM_DOUBLE) ) { - this.src.add("import random").nlI(); + this.src.addLine("import random"); } - this.src.add("from spike.control import wait_for_seconds, wait_until"); + + this.src.addLine("from spike.control import wait_for_seconds, wait_until"); if ( usedHardwareBean.isSensorUsed(SC.TIMER) ) { this.src.add(", Timer"); } - nlIndent(); + if ( usedHardwareBean.isActorUsed("DISPLAY") ) { - this.src.add("import hub as _hub").nlI(); + this.src.addLine("import hub as _hub"); } } @Override protected void visitorGenerateGlobalVariables() { + this.src.ensureBlankLines(1); UsedHardwareBean usedHardwareBean = this.getBean(UsedHardwareBean.class); if ( usedHardwareBean.isActorUsed(SC.DIFFERENTIALDRIVE) ) { ConfigurationComponent diffDrive = this.configurationAst.optConfigurationComponentByType("DIFFERENTIALDRIVE"); String leftPort = diffDrive.getComponentProperties().get("MOTOR_L"); String rightPort = diffDrive.getComponentProperties().get("MOTOR_R"); - nlIndent(); - this.src.add("TRACKWIDTH = ").add(diffDrive.getComponentProperties().get("BRICK_TRACK_WIDTH")).nlI(); - this.src.add("diff_drive = spike.MotorPair('").add(leftPort).add("', '").add(rightPort).add("')").nlI(); - this.src.add("diff_drive.set_motor_rotation(").add(diffDrive.getComponentProperties().get("BRICK_WHEEL_DIAMETER")).add(" * math.pi, 'cm')"); + this.src.addLine("TRACKWIDTH = ").add(diffDrive.getComponentProperties().get("BRICK_TRACK_WIDTH")); + this.src.addLine("diff_drive = spike.MotorPair('").add(leftPort).add("', '").add(rightPort).add("')"); + this.src.addLine("diff_drive.set_motor_rotation(").add(diffDrive.getComponentProperties().get("BRICK_WHEEL_DIAMETER")).add(" * math.pi, 'cm')"); } if ( usedHardwareBean.isActorUsed(SC.MOTOR) ) { usedHardwareBean.getUsedActors().stream().filter(usedActor -> usedActor.getType().equals("MOTOR")).forEach(motor -> { - nlIndent(); - this.src.add("motor").add(motor.getPort()).add(" = spike.Motor('").add(motor.getPort()).add("')"); + this.src.addLine("motor").add(motor.getPort()).add(" = spike.Motor('").add(motor.getPort()).add("')"); }); } if ( usedHardwareBean.isSensorUsed(SC.TOUCH) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("TOUCH")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - this.src.add("touch_sensor_").add(sensor.getPort()).add(" = spike.ForceSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); + this.src.addLine("touch_sensor_").add(sensor.getPort()).add(" = spike.ForceSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); } }); } if ( usedHardwareBean.isSensorUsed(SC.ULTRASONIC) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("ULTRASONIC")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - this.src.add("ultrasonic_sensor_").add(sensor.getPort()).add(" = spike.DistanceSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); + this.src.addLine("ultrasonic_sensor_").add(sensor.getPort()).add(" = spike.DistanceSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); } }); } if ( usedHardwareBean.isSensorUsed(SC.COLOR) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("COLOR")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - this.src.add("color_sensor_").add(sensor.getPort()).add(" = spike.ColorSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); + this.src.addLine("color_sensor_").add(sensor.getPort()).add(" = spike.ColorSensor('").add(getPortFromConfig(sensor.getPort())).add("')"); } }); } if ( usedHardwareBean.isActorUsed("DISPLAY") ) { - nlIndent(); - this.src.add("display = _hub.display").nlI(); - this.src.add("Image = _hub.Image"); + this.src.addLine("display = _hub.display"); + this.src.addLine("Image = _hub.Image"); } if ( usedHardwareBean.isSensorUsed(SC.TIMER) ) { - nlIndent(); - this.src.add("timer = Timer()"); + this.src.addLine("timer = Timer()"); } - nlIndent(); - this.src.add("hub = spike.PrimeHub()"); + this.src.addLine("hub = spike.PrimeHub()"); } } \ No newline at end of file diff --git a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spikePybricks/SpikePybricksPythonVisitor.java b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spikePybricks/SpikePybricksPythonVisitor.java index 68da04509a..06c06fbbd0 100644 --- a/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spikePybricks/SpikePybricksPythonVisitor.java +++ b/RobotSpike/src/main/java/de/fhg/iais/roberta/visitor/spikePybricks/SpikePybricksPythonVisitor.java @@ -252,17 +252,17 @@ public Void visitColorSensor(ColorSensor colorSensor) { case "REDCHANNEL": src.add("int(hsv2rgb("); src.add("color_sensor_").add(sensorPort).add(".hsv()"); - src.add(")[0]/2.55)"); + src.add(")[0] / 2.55)"); break; case "GREENCHANNEL": src.add("int(hsv2rgb("); src.add("color_sensor_").add(sensorPort).add(".hsv()"); - src.add(")[1]/2.55)"); + src.add(")[1] / 2.55)"); break; case "BLUECHANNEL": src.add("int(hsv2rgb("); src.add("color_sensor_").add(sensorPort).add(".hsv()"); - src.add(")[2]/2.55)"); + src.add(")[2] / 2.55)"); break; default: throw new DbcException("Invalid color sensor mode: " + colorSensor.getMode()); @@ -399,7 +399,7 @@ public Void visitMotorDiffStopAction(MotorDiffStopAction motorDiffStopAction) { switch ( motorDiffStopAction.control ) { case "BRAKE": //making the motor drive at speed 0 is the same as breaking - src.add(".drive(0,0)"); + src.add(".drive(0, 0)"); break; case "COAST": //default option stop is coast @@ -654,10 +654,10 @@ public Void visitMathSingleFunct(MathSingleFunct mathSingleFunct) { case LOG10: src.add("math.log("); mathSingleFunct.param.get(0).accept(this); - src.add(")/math.log(10)"); + src.add(") / math.log(10)"); break; case POW10: - src.add("10 **"); + src.add("10 ** "); mathSingleFunct.param.get(0).accept(this); break; case ROUND: @@ -684,7 +684,7 @@ protected void generateProgramPrefix(boolean withWrapping) { @Override protected void visitorGenerateImports() { - src.add("from pybricks.hubs import PrimeHub").nlI(); + src.addLine("from pybricks.hubs import PrimeHub"); importPubDevices(); importParameters(); importTools(); @@ -694,9 +694,11 @@ protected void visitorGenerateImports() { @Override protected void visitorGenerateGlobalVariables() { + src.ensureBlankLines(1); changeColors(); + src.ensureBlankLines(1); instantiateComponents(); - src.add("hub = PrimeHub()").nlI(); + src.addLine("hub = PrimeHub()"); prepareComponents(); } @@ -730,8 +732,7 @@ private void importPubDevices() { //substring to remove first "," pubDevicesImportString = "from pybricks.pupdevices import" + pubDevicesImportString.substring(1); - src.add(pubDevicesImportString); - src.nlI(); + src.addLine(pubDevicesImportString); } private void importParameters() { @@ -764,8 +765,7 @@ private void importParameters() { //substring to remove first "," parameterImportString = "from pybricks.parameters import" + parameterImportString.substring(1); - src.add(parameterImportString); - src.nlI(); + src.addLine(parameterImportString); } private void importTools() { @@ -783,13 +783,13 @@ private void importTools() { //Matrix always has to be imported, we need this for the exception sad face toolsImportString = "from pybricks.tools import Matrix" + toolsImportString; - src.add(toolsImportString); - src.nlI(); + src.addLine(toolsImportString); } private void importRobotics() { - if ( usedHardwareBean.isActorUsed(SC.DIFFERENTIALDRIVE) ) - src.add("from pybricks.robotics import DriveBase").nlI(); + if ( usedHardwareBean.isActorUsed(SC.DIFFERENTIALDRIVE) ){ + src.addLine("from pybricks.robotics import DriveBase"); + } } /** @@ -797,36 +797,30 @@ private void importRobotics() { * python import math doesn't exist in pybricks context */ private void importMathFunctions() { - src.add("import umath as math").nlI(); - src.add("import urandom as random").nlI(); + src.addLine("import umath as math"); + src.addLine("import urandom as random"); } private void changeColors() { if ( usedHardwareBean.isImportUsed(SC.COlOR_IMPORT) ) { - nlIndent(); - src.add("Color.MAGENTA = Color(315,50,15)").nlI(); - src.add("Color.BLUE = Color(225,20,20)").nlI(); - src.add("Color.AZURE = Color(200,20,20)").nlI(); - src.add("Color.CYAN = Color(150,20,20)").nlI(); - src.add("Color.YELLOW = Color(55,35,35)").nlI(); - src.add("Color.RED = Color(350,35,35)").nlI(); - src.add("Color.BLACK = Color(0,10,10)").nlI(); - src.add("Color.WHITE = Color(0,0,70)").nlI(); - //Color.NONE + src.addLine("Color.MAGENTA = Color(315, 50, 15)"); + src.addLine("Color.BLUE = Color(225, 20, 20)"); + src.addLine("Color.AZURE = Color(200, 20, 20)"); + src.addLine("Color.CYAN = Color(150, 20, 20)"); + src.addLine("Color.YELLOW = Color(55, 35, 35)"); + src.addLine("Color.RED = Color(350, 35, 35)"); + src.addLine("Color.BLACK = Color(0, 10, 10)"); + src.addLine("Color.WHITE = Color(0, 0, 70)"); } } private void instantiateComponents() { - nlIndent(); - instantiateDifferentialDrive(); instantiateMotors(); instantiateTouchSensor(); instantiateUltrasonicSensor(); instantiateColorSensor(); instantiateTimer(); - - nlIndent(); } private void instantiateDifferentialDrive() { @@ -835,14 +829,14 @@ private void instantiateDifferentialDrive() { String leftPort = diffDrive.getComponentProperties().get("MOTOR_L"); //Port String rightPort = diffDrive.getComponentProperties().get("MOTOR_R"); // Port - src.add("left_motor = Motor(Port." + leftPort + ", Direction.COUNTERCLOCKWISE)").nlI(); - src.add("right_motor = Motor(Port." + rightPort + ")").nlI(); + src.addLine("left_motor = Motor(Port." + leftPort + ", Direction.COUNTERCLOCKWISE)"); + src.addLine("right_motor = Motor(Port." + rightPort + ")"); - src.add("TRACKWIDTH = ").add(diffDrive.getComponentProperties().get("BRICK_TRACK_WIDTH")).add(" * 10").nlI(); - src.add("WHEEL_DIAMETER = 56").nlI(); - src.add("drive_base = DriveBase(left_motor, right_motor, wheel_diameter=WHEEL_DIAMETER, axle_track=TRACKWIDTH)").nlI(); + src.addLine("TRACKWIDTH = ").add(diffDrive.getComponentProperties().get("BRICK_TRACK_WIDTH")).add(" * 10"); + src.addLine("WHEEL_DIAMETER = 56"); + src.addLine("drive_base = DriveBase(left_motor, right_motor, wheel_diameter=WHEEL_DIAMETER, axle_track=TRACKWIDTH)"); //accelerate to max speed within 0.1 seconds, this value is subject to change - src.add("drive_base.settings(straight_acceleration=810*10, turn_acceleration=810*10)").nlI(); + src.addLine("drive_base.settings(straight_acceleration=810 * 10, turn_acceleration=810 * 10)"); } } @@ -853,13 +847,13 @@ private void instantiateMotors() { usedHardwareBean.getLockedComponent().forEach( (component, port) -> { if ( (motor.getPort()).equals(port) ) { - src.add("motor").add(motor.getPort()).add(" = left_motor").nlI(); + src.addLine("motor").add(motor.getPort()).add(" = left_motor"); componentLocked.set(true); } } ); if ( !componentLocked.get() ) { - src.add("motor").add(motor.getPort()).add(" = Motor(Port.").add(motor.getPort()).add(")").nlI(); + src.addLine("motor").add(motor.getPort()).add(" = Motor(Port.").add(motor.getPort()).add(")"); } }); } @@ -869,8 +863,7 @@ private void instantiateTouchSensor() { if ( usedHardwareBean.isSensorUsed(SC.TOUCH) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("TOUCH")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - src.add("touch_sensor_").add(sensor.getPort()).add(" = ForceSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")"); + src.addLine("touch_sensor_").add(sensor.getPort()).add(" = ForceSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")"); } }); } @@ -880,8 +873,7 @@ private void instantiateUltrasonicSensor() { if ( usedHardwareBean.isSensorUsed(SC.ULTRASONIC) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("ULTRASONIC")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - src.add("ultrasonic_sensor_").add(sensor.getPort()).add(" = UltrasonicSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")"); + src.addLine("ultrasonic_sensor_").add(sensor.getPort()).add(" = UltrasonicSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")"); } }); } @@ -891,9 +883,8 @@ private void instantiateColorSensor() { if ( usedHardwareBean.isSensorUsed(SC.COLOR) ) { usedHardwareBean.getUsedSensors().stream().filter(usedActor -> usedActor.getType().equals("COLOR")).forEach(sensor -> { if ( configurationAst.optConfigurationComponent(sensor.getPort()) != null ) { - nlIndent(); - src.add("color_sensor_").add(sensor.getPort()).add(" = ColorSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")").nlI(); - src.add("color_sensor_").add(sensor.getPort()).add(".detectable_colors([Color.MAGENTA, Color.BLUE, Color.AZURE, Color.CYAN, Color.YELLOW, Color.RED, Color.BLACK, Color.WHITE, Color.NONE])"); + src.addLine("color_sensor_").add(sensor.getPort()).add(" = ColorSensor(Port.").add(getPortFromConfig(sensor.getPort())).add(")"); + src.addLine("color_sensor_").add(sensor.getPort()).add(".detectable_colors([Color.MAGENTA, Color.BLUE, Color.AZURE, Color.CYAN, Color.YELLOW, Color.RED, Color.BLACK, Color.WHITE, Color.NONE])"); } }); } @@ -901,18 +892,17 @@ private void instantiateColorSensor() { private void instantiateTimer() { if ( usedHardwareBean.isSensorUsed(SC.TIMER) ) { - nlIndent(); - src.add("stopWatch = StopWatch()"); + src.addLine("stopWatch = StopWatch()"); } } private void prepareComponents() { if ( usedHardwareBean.isSensorUsed(SC.GYRO) ) { - src.add("hub.imu.reset_heading(0)").nlI(); + src.addLine("hub.imu.reset_heading(0)"); } if ( usedHardwareBean.isActorUsed(SC.SPEAKER) ) { //TODO make volume be settings controlled - src.add("hub.speaker.volume(15)").nlI(); + src.addLine("hub.speaker.volume(15)"); } } } \ No newline at end of file