This shows you the differences between two versions of the page.
alf:teme:tema_en_2 [2019/03/05 23:25] teodor.deaconu [Example] |
alf:teme:tema_en_2 [2022/03/24 17:13] (current) diana.ghindaoanu [Statements] |
||
---|---|---|---|
Line 5: | Line 5: | ||
<note important> | <note important> | ||
- | Deadline: **17th of March, 23:55**\\ | + | Deadline: **4th of April, 23:55**\\ |
Points: **1 point** out of the final grade\\ | Points: **1 point** out of the final grade\\ | ||
- | Upload the homework: [[https://vmchecker.cs.pub.ro|vmchecker.cs.pub.ro]]\\ | + | Link: [[https://classroom.github.com/a/svxVErwV|Devoir 2]]\\ |
- | Late upload: **0.5 points / day** (maximum 4 days)\\ | + | Late upload: **1 point / day** (maximum 2 days)\\ |
</note> | </note> | ||
+ | |||
+ | ===== Purpose ===== | ||
+ | The purpose of this homework is to get you familiarized with the following concepts: | ||
+ | - basic TypeScript development | ||
+ | - use of data structures in TypeScript | ||
+ | - use of command line parameters | ||
+ | - reading data from files | ||
+ | - basic string splitting and processing | ||
+ | |||
===== What do you have to do ===== | ===== What do you have to do ===== | ||
Line 39: | Line 48: | ||
<code> | <code> | ||
& Move | & Move | ||
- | LOCATION: 200 200 | + | POSITION: 200, 200 |
COMMAND_WITH_ERROR | COMMAND_WITH_ERROR | ||
- | DRAW_LINE: 300 350 location | + | LINE: 300, 350 location |
</code> | </code> | ||
Line 47: | Line 56: | ||
<code> | <code> | ||
- | LINE 2 HAS ERROR: Command not existing COMMAND_WITH_ERROR | + | ERROR LINE 2: Unknown statement STATEMENT_WITH_ERROR |
</code> | </code> | ||
Line 56: | Line 65: | ||
* The initial fill color is white. | * The initial fill color is white. | ||
* The pen width is 1. | * The pen width is 1. | ||
- | |||
- | ===== Rules ===== | ||
- | |||
- | - Files must have "use strict" | ||
- | - You files need to pass jshint (with node: true, esnext: true) | ||
- | - Source code needs to be indented (-0.1p) | ||
- | - You need to write a file named Readme and explain how you wrote the homework (-0.1p) | ||
===== Copying ===== | ===== Copying ===== | ||
Line 70: | Line 72: | ||
===== Questions ===== | ===== Questions ===== | ||
- | If you have any questions related to the homework, please ask them by posting an issue on the github [[https://github.com/alexandruradovici/alf2018.git|repository]] with the title format //[design] <your question title>//. You will need a github account for that. | + | If you have any questions related to the homework, please ask them by posting an issue on the github [[https://github.com/UPB-FILS-ALF/questions|quiestions repository]] with the title format //[design] <your question title>//. You will need a github account for that. |
<note warning> | <note warning> | ||
Line 76: | Line 78: | ||
</note> | </note> | ||
- | If you want to receive an email when issues are posted or when there are new messages, got to the github [[https://github.com/alexandruradovici/alf2018|repository]] and click //Watch//. | + | If you want to receive an email when issues are posted or when there are new messages, got to the github [[https://github.com/UPB-FILS-ALF/questions|questions repository]] and click //Watch//. |
+ | |||
===== Design Language ===== | ===== Design Language ===== | ||
Line 82: | Line 86: | ||
The language is actually moving a pen. The pen's initial position is 0, 0. When drawing, the pen will move to the new position. | The language is actually moving a pen. The pen's initial position is 0, 0. When drawing, the pen will move to the new position. | ||
- | ==== Commentaries ==== | ||
- | |||
- | The commentaries are preceded by //&//. | ||
- | |||
- | <code> | ||
- | & There is a comment on this line | ||
- | STATEMENT: p1 p2 | ||
- | STATEMENT: p1 p2 | ||
- | </code> | ||
==== Variables ==== | ==== Variables ==== | ||
Line 96: | Line 91: | ||
<code> | <code> | ||
- | $variable | + | %variable |
</code> | </code> | ||
- | Before it can be used, a variable needs to be assigned a value (using the //init// statement). | + | Before it can be used, a variable needs to be assigned a value (using the //set// statement). |
==== Statements format ==== | ==== Statements format ==== | ||
Line 118: | Line 113: | ||
==== Statements ==== | ==== Statements ==== | ||
- | === LOCATION === | + | === POSITION === |
- | Moves the pen to a specific location, without drawing anything. | + | Moves the pen to a position, without drawing anything. |
== Syntax == | == Syntax == | ||
Line 127: | Line 122: | ||
<code> | <code> | ||
- | LOCATION: 150 150 | + | POSITION: 150 150 |
- | LOCATION: $here $there | + | POSITION: %here %there |
- | & $here and $there are variables that are previously assigned | + | & %here and %there are variables that are previously assigned |
</code> | </code> | ||
Line 136: | Line 131: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: LOCATION uses 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number):POSITION has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: LOCATION parameter (the number of the parameter) needs to be a variable or a number, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): POSITION parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === DRAW_LINE === | + | === LINE === |
Draws a line from the current position to a specified position or length and angle. | Draws a line from the current position to a specified position or length and angle. | ||
Line 150: | Line 145: | ||
<code> | <code> | ||
- | DRAW_LINE: x y location | + | LINE: x y position |
- | DRAW_LINE: l a polar | + | LINE: l a polar |
</code> | </code> | ||
Line 157: | Line 152: | ||
It takes exactly three parameters | It takes exactly three parameters | ||
+ | * //type// - is either //position// either //polar// | ||
* //x// - if //type// is //position//, the x coordinate of the new position | * //x// - if //type// is //position//, the x coordinate of the new position | ||
* //y// - if //type// is //position//, the y coordinate of the new position | * //y// - if //type// is //position//, the y coordinate of the new position | ||
* //l// - if //type// is //polar//, the length of the line | * //l// - if //type// is //polar//, the length of the line | ||
* //a// - if //type// is //polar//, the angle (from the trigonometric circle) in degrees | * //a// - if //type// is //polar//, the angle (from the trigonometric circle) in degrees | ||
- | * //type// - is either //location// either //polar// | ||
== Errors == | == Errors == | ||
Line 167: | Line 162: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: DRAW_LINE command needs 3 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number):LINE has 3 parameters, you wrote (number_of_written_parameters) |
- | Wrong parameter type for the type of the command | + | Wrong parameter type for type |
- | LINE (line_number) HAS ERROR: DRAW_LINE parameter 3 needs to be one of (location, polar), you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): LINE parameter 3 requires one of (position, polar), you wrote (actual_written_parameter_value) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: DRAW_LINE parameter (the number of the parameter) needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): LINE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === DRAW_CIRCLE === | + | === CIRCLE === |
Draw a circle | Draw a circle | ||
Line 185: | Line 180: | ||
== Syntax == | == Syntax == | ||
- | DRAW_CIRCLE: r x y | + | CIRCLE: x y r |
== Parameters == | == Parameters == | ||
It takes exactly three parameter | It takes exactly three parameter | ||
- | * //r// - the radius | ||
* //x// - the x coordinate for the center | * //x// - the x coordinate for the center | ||
* //y// - the y coordinate for the center | * //y// - the y coordinate for the center | ||
+ | * //r// - the radius | ||
== Errors == | == Errors == | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: DRAW_CIRCLE needs 3 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): CIRCLE has 3 parameters, you wrote (number_of_written_parameters) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: DRAW_CIRCLE parameter (the number of the parameter) needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): CIRCLE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
| | ||
- | === DRAW_ELLIPSE === | + | === ELLIPSE === |
Draw an ellipse | Draw an ellipse | ||
Line 210: | Line 205: | ||
== Syntax == | == Syntax == | ||
- | DRAW_ELLIPSE: r1 r2 x y | + | ELLIPSE: x y r1 r2 |
== Parameters == | == Parameters == | ||
It takes exactly four parameter | It takes exactly four parameter | ||
- | * //r1// - the horizontal radius | ||
- | * //r2// - the vertical radius | ||
* //x// - the x coordinate for the center | * //x// - the x coordinate for the center | ||
* //y// - the y coordinate for the center | * //y// - the y coordinate for the center | ||
+ | * //r1// - the horizontal radius | ||
+ | * //r2// - the vertical radius | ||
== Errors == | == Errors == | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: DRAW_ELLIPSE needs 3 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): ELLIPSE has 3 parameters, you wrote (number_of_written_parameters) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: DRAW_ELLIPSE parameter (the number of the parameter) needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): ELLIPSE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
| | ||
- | === DRAW_RECTANGLE === | + | === RECTANGLE === |
Draw a rectangle | Draw a rectangle | ||
Line 236: | Line 231: | ||
== Syntax == | == Syntax == | ||
- | DRAW_RECTANGLE: x1 y1 x2 y2 | + | RECTANGLE: x1 y1 x2 y2 |
== Parameters == | == Parameters == | ||
Line 249: | Line 244: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: DRAW_RECTANGLE needs 4 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): RECTANGLE has 4 parameters, you wrote (number_of_written_parameters) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: DRAW_RECTANGLE parameter (the number of the parameter) needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): RECTANGLE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
| | ||
- | === SET_COLOR === | + | === COLOR === |
Selects the drawing color. | Selects the drawing color. | ||
Line 265: | Line 260: | ||
== Syntax == | == Syntax == | ||
- | SET_COLOR: r g b pen | + | COLOR: pen r g b |
- | SET_COLOR: r g b fill | + | COLOR: fill r g b |
== Parameters == | == Parameters == | ||
It takes exactly four parameters | It takes exactly four parameters | ||
+ | * //type// - is either //pen// (the color of the line or broder) either //fill// (the color inside) | ||
* //r// - the red component of the color | * //r// - the red component of the color | ||
* //g// - the green component of the color | * //g// - the green component of the color | ||
* //b// - the blue component of the color | * //b// - the blue component of the color | ||
- | * //type// - is either //pen// (the color of the line or broder) either //fill// (the color inside) | ||
Values are between 0 and 255. | Values are between 0 and 255. | ||
Line 282: | Line 277: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: SET_COLOR needs 4 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number):COLOR has 4 parameters, you wrote (number_of_written_parameters) |
Wrong parameter type for type | Wrong parameter type for type | ||
- | LINE (line_number) HAS ERROR: SET_COLOR parameter 4 needs to be one of (pen, fill), you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): COLOR parameter 1 requires one of (pen, fill), you wrote (actual_written_parameter_value) |
Wrong parameter type | Wrong parameter type | ||
- | LINE (line_number) HAS ERROR: SET_COLOR parameter (the number of the parameter) needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): COLOR parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) |
Value of of range | Value of of range | ||
- | LINE (line_number) HAS ERROR: SET_COLOR parameter (the number of the parameter) needs to be a number or a variable between [0, 255], you wrote (actual_written_parameter_value, if it is a variable write the value of the variable) | + | ERROR LINE (line_number): COLOR parameter (the number of the parameter) requires a number or a variable between [0, 255], you wrote (actual_written_parameter_value, if it is a variable write the value of the variable) |
- | === FOR_LOOP === | + | === LOOP === |
Repeats some lines of statements until REPEAT | Repeats some lines of statements until REPEAT | ||
- | FOR_LOOP: times | + | LOOP: times |
- | FOR_LOOP statements are not imbricated (FOR_LOOP in FOR_LOOP) | + | LOOP statements are not imbricated (LOOP in LOOP) |
== Parameters == | == Parameters == | ||
Line 311: | Line 306: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: FOR_LOOP needs 1 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): LOOP has 1 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: FOR_LOOP parameter 1 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): LOOP parameter 1 requires a number or a variable, you wrote (actual_written_parameter_value) |
The file ends and there still is at least one LOOP without REPEAT | The file ends and there still is at least one LOOP without REPEAT | ||
- | You have number_of_repeats FOR_LOOP without REPEAT | + | ERROR LINE (line_number): LOOP with no REPEAT |
Line 337: | Line 332: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: WHILE needs 1 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): WHILE has 1 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: WHILE parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): WHILE parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
The file ends and there still is at least one WHILE without REPEAT | The file ends and there still is at least one WHILE without REPEAT | ||
- | You have number_of_repeats WHILE without REPEAT | + | ERROR LINE (line_number): WHILE with no REPEAT |
=== REPEAT === | === REPEAT === | ||
Line 357: | Line 352: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: REPEAT needs 0 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): REPEAT has 0 parameters, you wrote (number_of_written_parameters) |
- | REPEAT is used without a previous FOR_LOOP or WHILE | + | END is used without a previous LOOP |
- | LINE (line_number) HAS ERROR: REPEAT and no WHILE/FOR_LOOP | + | ERROR LINE (line_number): REPEAT and no LOOP |
| | ||
=== IF === | === IF === | ||
Line 378: | Line 373: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: IF needs 1 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): IF has 1 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: IF parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): IF parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
The file ends and there still is at least one IF without ELSE or END | The file ends and there still is at least one IF without ELSE or END | ||
Line 398: | Line 393: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: ELSE needs 0 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): ELSE has 0 parameters, you wrote (number_of_written_parameters) |
END is used without a previous IF | END is used without a previous IF | ||
- | LINE (line_number) HAS ERROR: ELSE and no IF | + | ERROR LINE (line_number): ELSE and no IF |
=== END === | === END === | ||
Line 414: | Line 409: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: END needs 0 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): END has 0 parameters, you wrote (number_of_written_parameters) |
END is used without a previous IF | END is used without a previous IF | ||
- | LINE (line_number) HAS ERROR: END and no IF | + | ERROR LINE (line_number): END and no IF |
- | === INIT === | + | === SET === |
- | Sets the value of a variable | + | Set the value of a variable |
- | INIT: variable value | + | SET: variable value |
== Parameters == | == Parameters == | ||
Line 434: | Line 429: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: INIT needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): SET has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: INIT parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): SET parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: INIT parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): SET parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === ADDITION === | + | === ADD === |
Add a value to the value of a variable | Add a value to the value of a variable | ||
- | ADDITION: variable value | + | ADD: variable value |
== Parameters == | == Parameters == | ||
Line 457: | Line 452: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: ADDITION needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): ADD has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: ADDITION parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): ADD parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: ADDITION parameter 2 needs a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): ADD parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === SUBTRACTION === | + | === SUB === |
Subtract a value from the value of a variable | Subtract a value from the value of a variable | ||
- | SUBTRACTION: variable value | + | SUB: variable value |
== Parameters == | == Parameters == | ||
Line 481: | Line 476: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: SUBTRACTION needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): SUB has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: SUBTRACTION parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): SUB parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: SUBTRACTION parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): SUB parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === MULTIPLY === | + | === MUL === |
Multiply a variable's value with a value. | Multiply a variable's value with a value. | ||
- | MULTIPLY: variable value | + | MUL: variable value |
== Parameters == | == Parameters == | ||
Line 505: | Line 500: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: MULTIPLY needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): MUL has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: MULTIPLY parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): MUL parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: MULTIPLY parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): MUL parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === DIVISION === | + | === DIV === |
Divide the value of a variable with a value | Divide the value of a variable with a value | ||
- | DIVISION: variable value | + | DIV: variable value |
== Parameters == | == Parameters == | ||
Line 529: | Line 524: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: DIVISION needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): DIV has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: DIVISION parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): DIV parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: DIVISION parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): DIV parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | + | ||
- | === IDIVISION === | + | === IDIV === |
Divide the value of a variable with a value (integer value) | Divide the value of a variable with a value (integer value) | ||
- | IDIVISION: variable value | + | IDIV: variable value |
== Parameters == | == Parameters == | ||
Line 552: | Line 547: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: IDIVISION needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): IDIV has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: IDIVISION parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): IDIV parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: IDIVISION parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): IDIV parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
- | === MODULO === | + | === MOD === |
The remainder of the division of a variable with a value | The remainder of the division of a variable with a value | ||
- | MODULO: variable value | + | MOD: variable value |
== Parameters == | == Parameters == | ||
Line 575: | Line 570: | ||
Wrong number of parameters | Wrong number of parameters | ||
- | LINE (line_number) HAS ERROR: MODULO needs 2 parameters, you wrote (number_of_written_parameters) | + | ERROR LINE (line_number): MOD has 2 parameters, you wrote (number_of_written_parameters) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: MODULO parameter 1 needs to be a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): MOD parameter 1 requires a variable, you wrote (actual_written_parameter_value) |
Wrong parameter for times | Wrong parameter for times | ||
- | LINE (line_number) HAS ERROR: MODULO parameter 2 needs to be a number or a variable, you wrote (actual_written_parameter_value) | + | ERROR LINE (line_number): MOD parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value) |
===== Bonus ===== | ===== Bonus ===== | ||
- | For an additional **0.20p**, implement the FOR_LOOP, WHILE and IF imbrication. | + | For an additional **0.20p**, implement the LOOP, WHILE and IF imbrication. |
<note> | <note> | ||
Line 592: | Line 587: | ||
</note> | </note> | ||
| | ||
- | ===== Testing ===== | ||
- | |||
- | The homework will be tested automatically using a set of public and private tests. | ||
- | |||
- | ==== Public Tests ==== | ||
- | |||
- | Coming soon... | ||
- | <hidden> | ||
- | You can download the public tests from the GitHub [[https://github.com/alexandruradovici/alf-robot-language-public|repository]]. | ||
- | |||
- | To run the tests, download the contents of the repository in the folder with the homework. Enter the //verify// folder and run ./run_all.sh. | ||
- | |||
- | <code bash> | ||
- | cd verify | ||
- | rm -rf node_modules | ||
- | ./run_all.sh | ||
- | </code> | ||
- | |||
- | You will need bash for that. You can use either Linux or [[https://msdn.microsoft.com/en-us/commandline/wsl/install_guide|Windows Linux Subsystem]]. | ||
- | |||
- | <note> | ||
- | To install nodejs in Linux or Windows Linux Subsystem, do the following: | ||
- | |||
- | <code bash> | ||
- | wget https://nodejs.org/dist/v6.10.0/node-v6.10.0-linux-x64.tar.xz | ||
- | tar xvfJ node-v6.10.0-linux-x64.tar.xz | ||
- | cd node-v6.10.0-linux-x64 | ||
- | sudo cp -R * /usr | ||
- | </code> | ||
- | | ||
- | </note> | ||
- | </hidden> | ||
- | ==== Private Tests ==== | ||
- | When uploading the homework, we might have some private tests that it needs to pass. vmchecker will run them. | ||
- | |||
- | <note> | ||
- | You may always upload the homework as many times you want until the deadline. This will run all the tests for you and display the result. | ||
- | </note> | ||
- | |||
- | ===== Upload the homework ===== | ||
- | The homework needs to be uploaded to [[https://vmchecker.cs.pub.ro|vmchecker]]. Login with your moodle user name, select the //Automates et Langages Formelles (FILS)// course and upload the [[#homework-archive|homework archive]]. | ||
- | |||
- | ==== Readme ==== | ||
- | The readme file has the following format: | ||
- | |||
- | <code> | ||
- | Your full name | ||
- | Group | ||
- | |||
- | An explanation how you wrote your homework, what did you use, what are the main ideas. | ||
- | </code> | ||
- | |||
- | |||
- | ==== Homework Archive ==== | ||
- | To upload your homework, please follow the following: | ||
- | |||
- | - Create a zip (not rar, ace, 7zip or anything else) archive containing: | ||
- | * your main file (main.js) | ||
- | * your javascript files (*.js) | ||
- | * yarn.lock (if you are using yarn) | ||
- | * the package.json file | ||
- | * the Readme file | ||
- | - sign in with [[https://vmchecker.cs.pub.ro|vmchecker]] | ||
- | - select the //Automates et Langages Formelles (FILS)// course | ||
- | - select //2. Design Language// | ||
- | - upload the archive | ||
- | |||
- | |||
- | <note> | ||
- | The archive needs to contain the files in its root, not in a folder. DO NOT archive a folder with those file, archive DIRECTLY those files. | ||
- | |||
- | DO NOT include //node_modules//. | ||
- | </note> | ||
- | |||
- | When the archive is uploaded, vmchecker will run: | ||
- | |||
- | <code bash> | ||
- | unzip archive.zip homework | ||
- | cd homework | ||
- | # if the file yarn.lock exists | ||
- | yarn | ||
- | # else | ||
- | npm install | ||
- | echo '{ "node":true, "esnext":true }' > .jshintrc | ||
- | jshint *.js | ||
- | </code> | ||
- | |||
- | |||