Differences

This shows you the differences between two versions of the page.

Link to this comparison view

alf:teme:tema_en_2 [2020/03/09 18:48]
alexandru.radovici
alf:teme:tema_en_2 [2022/03/24 17:13] (current)
diana.ghindaoanu [Statements]
Line 1: Line 1:
-====== Homework 2 - Robot Language ===== +====== Homework 2 - Design ​Language ===== 
  
  
Line 5: Line 5:
  
 <note important>​ <note important>​
-Deadline: **22th 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.points ​/ day** (maximum ​days)\\+Late upload: **1 point / day** (maximum ​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 =====
  
-The purpose of the homework is to write an interpreter for the //Robot// language. The language is used to move robot on flat planeThe robot can go forward, backwardsturn or jump.+The purpose of the homework is to write an interpreter for the //Design// language. The language is used to draw geometric figures and and points. 
 + 
 +Write an interpreter that receives ​file with statements as parameter and writes ​[[https://​developer.mozilla.org/​fr/​docs/​Web/​SVG/​Tutoriel|SVG]] file. If there was an errorit will output ERROR LINE followed by the line number: and the error text.
  
-Write an interpreter that receives ​file with commands as parameter and writes to the screen the position and rotation of the robot after each command.+The program ​receives ​two parameters:​ 
 +  * the file with statements 
 +  * the svg output file 
  
-  * If the command was successful, it will output OK x, y, r (exactly like this) +A usage example:
-  * If there was an error, it will output ERROR LINE followed by the line numberand the error text.+
  
 <code bash> <code bash>
-node main.js ​robot_commands.s+node main.js ​design.dsn canvas.svg
 </​code>​ </​code>​
  
-This will run the //robot_commands.s// file and write to the screen ​the position and rotation of the robot after every command or an error for the lines that have errors.+This will run the //design.dsn// file and write the drawing into the canvas.svg file.
  
 <note warning> <note warning>
Line 32: Line 44:
 ==== Example ==== ==== Example ====
  
-For this robot.file+For this design.dsn file
  
 <​code>​ <​code>​
-Move +Move 
-FORWARD ​200 +POSITION: 200, 200 
-COMMAND_WITH_ERROR  +COMMAND_WITH_ERROR ​  
-BACKWARD 10+LINE: 300, 350 location
 </​code>​ </​code>​
  
Line 44: Line 56:
  
 <​code>​ <​code>​
-OK 200, 0, 90 +ERROR LINE 2: Unknown ​statement STATEMENT_WITH_ERROR
-ERROR LINE 2: Unknown ​command COMMAND_WITH_ERROR +
-OK 190, 0, 90+
 </​code>​ </​code>​
  
-===== Rules =====+===== Initial values ​=====
  
-  ​- You may not use //RegEx// or any other library that would use regular expressions +  ​* The initial position is 0, 0. 
-  ​- Files must have "use strict"​ +  ​* The initial pen color is black. 
-  ​- You files need to pass jshint (with node: true, esnext: true) +  ​* The initial fill color is white
-  - Source code needs to be indented (-0.1p) +  ​* The pen width is 1.
-  ​- You need to write a file named Readme and explain how you wrote the homework (-0.1p)+
  
 ===== Copying ===== ===== Copying =====
Line 63: 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/​upb-fils/alf|repository]]. 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 69: 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/​upb-fils/alf|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//. 
 +  ​
  
-===== Robot Language ===== 
  
-=== Robot Position ​===+===== Design Language =====
  
-The robot has position and a rotation. The position is expressed by a (xy) pair expressed as integer numbersThe rotation of the robot is expressed in degrees and varies between 0 and 360.+The language is actually moving ​pen. The pen's initial ​position is 00When drawing, ​the pen will move to the new position.
  
-The status of the robot is expressed as (x, y, r), meaning: +==== Variables ====
-* x, y the position +
-* r the rotation in degrees+
  
-=== Starting Point ===+All statements accept as parameters numbers or variables. Variables have the following format:
  
-The robot starts from (0, 0, 90) meaning the position (0, 0) and the rotation 90 degrees.+<​code>​ 
 +%variable 
 +</​code>​
  
 +Before it can be used, a variable needs to be assigned a value (using the //set// statement).
  
-==== Commands ​format ==== +==== Statements ​format ==== 
-Commands ​are stored inside a file. Each command ​is on a separate line.+Statements ​are stored inside a file. Each statement ​is on a separate line.
  
-The format for a robot command ​is the following:+The format for a statement ​is the following:
  
-    ​COMMAND ​parameter1,parameter2,etc+    ​STATEMENT : parameter1 parameter2 etc
  
-Commands ​may have any number of spaces before ​it'​s ​name, between parameters and any number of spaces after the last parameter. Here are some examples of valid commands:+Statements ​may have any number of spaces before ​their name, between parameters and any number of spaces after the last parameter. Here are some examples of valid statements:
  
-    ​COMMAND ​p1   p2 p3 +    ​STATEMENT: ​p1    p2  p3 
-      ​COMMAND ​p1p2  p3     +      ​STATEMENT : p1 p2   ​p3 ​    
-    ​COMMAND ​    p1,p2,p3+    ​STATEMENT:p1 p2 p3
  
-==== Commands ====+All statements and parameters are case insensitive.
  
-=== FORWARD ​===+==== Statements ====
  
-Moves the robot forward with number of //pixels//+=== POSITION === 
 + 
 +Moves the pen to position, without drawing anything.
  
 == Syntax == == Syntax ==
  
-  FORWARD pixels+The parameters are x and y. 
 + 
 +<​code>​ 
 +POSITION: 150 150 
 +POSITION: %here %there 
 +& %here and %there are variables that are previously assigned 
 +</​code>​ 
 + 
 +== Errors == 
 + 
 +Wrong number of parameters 
 + 
 +  ERROR LINE (line_number):​POSITION has 2 parameters, you wrote (number_of_written_parameters) 
 + 
 +Wrong parameter type 
 +  ERROR LINE (line_number):​ POSITION parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) 
 + 
 + 
 +=== LINE === 
 + 
 +Draws a line from the current position to a specified position or length and angle.  
 +This will be the new position of the pen. 
 + 
 +== Syntax == 
 + 
 +<​code>​ 
 +LINE: x y position 
 +LINE: l a polar 
 +</​code>​
  
 == Parameters == == Parameters ==
-It takes exactly ​one parameter+It takes exactly ​three parameters
  
-* //pixels// - an integer number representing ​the number ​of pixels to go forward ​+  ​* //type// - is either //​position//​ either //polar// 
 +  * //x// - if //type// is //​position//, ​the x 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 
 +  * //a// - if //type// is //polar//, the angle (from the trigonometric circle) in degrees
  
 == Errors == == Errors ==
Line 118: Line 162:
 Wrong number of parameters Wrong number of parameters
  
-  ERROR LINE (line_number):​FORWARD ​has parameters, you wrote (number_of_written_parameters)+  ERROR LINE (line_number):​LINE has parameters, you wrote (number_of_written_parameters)
  
-Wrong parameter type for pixels+Wrong parameter type for type
  
-  ERROR LINE (line_number): ​FORWARD ​parameter ​requires ​a number, you wrote (actual_written_parameter_value)+  ERROR LINE (line_number): ​LINE parameter ​requires ​one of (position, polar), you wrote (actual_written_parameter_value)
  
 +Wrong parameter type
 +  ERROR LINE (line_number):​ LINE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value)
  
-=== BACKWARD === 
  
-Moves the robot backward ​number of pixels+=== CIRCLE === 
 + 
 +Draw circle 
 + 
 +This does not move the current position.
  
 == Syntax == == Syntax ==
  
-  ​BACKWARD pixels+  ​CIRCLE: x y r
  
 == Parameters == == Parameters ==
-It takes exactly ​one parameter+It takes exactly ​three parameter
  
-* //pixels// - an integer number representing ​the number of pixels to go backward ​ +  ​* //x// - the x coordinate for the center 
 +  * //y// - the y coordinate for the center 
 +  * //r// - the radius
  
 == Errors == == Errors ==
  
 Wrong number of parameters Wrong number of parameters
-  ERROR LINE (line_number): ​BACKWARD ​has parameters, you wrote (number_of_written_parameters)+  ERROR LINE (line_number): ​CIRCLE ​has parameters, you wrote (number_of_written_parameters)
  
-Wrong parameter type for pixels +Wrong parameter type 
-  ERROR LINE (line_number): ​BACKWARD ​parameter ​requires a number, 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) 
 +   
 +=== ELLIPSE ===
  
-=== TURN ===+Draw an ellipse
  
-Turns the robot left (counter clockwise) or right (clockwise) a number of degrees+This does not move the current position.
  
 == Syntax == == Syntax ==
  
-  ​TURN left/right, degrees+  ​ELLIPSE: x y r1 r2
  
 == Parameters == == Parameters ==
-It takes exactly ​two parameters+It takes exactly ​four parameter
  
-* //left// or //right// - written exactly like this +  ​* //x// - the x coordinate for the center 
-* //degrees// - an integer number that represents ​the degrees to turn+  * //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
-  ERROR LINE (line_number): ​TURN has parameters, you wrote (number_of_written_parameters)+  ERROR LINE (line_number): ​ELLIPSE ​has parameters, you wrote (number_of_written_parameters)
  
-Wrong parameter ​for left/right +Wrong parameter ​type 
-  ERROR LINE (line_number): ​TURN parameter ​requires a left/right, 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) 
 +   
 +=== RECTANGLE ===
  
-Wrong parameter for degrees +Draw rectangle
-  ERROR LINE (line_number):​ TURN parameter 2 requires ​number, you wrote (actual_written_parameter_value)+
  
-=== JUMP ===+This does not move the current position.
  
-Put the robot on a specific position. It does not matter what orientation it has.+== Syntax ==
  
-  ​JUMP x, y+  ​RECTANGLE: x1 y1 x2 y2
  
 == Parameters == == Parameters ==
 +It takes exactly four parameter
  
-It takes exactly two parameters+  * //x1// - the x coordinate of the top left corner 
 +  * //y1// - the y coordinate of the top left corner 
 +  * //x2// - the x coordinate of the lower right corner 
 +  * //y2// - the y coordinate of the lower right corner
  
-* //x// - the x position ​of the robot +== Errors == 
-  * the value may be ~ (tildeor an integer number + 
-  ​* ~ means it keeps its previous x position +Wrong number of parameters 
-* //y// - the x position ​of the robot +  ERROR LINE (line_number):​ RECTANGLE has 4 parameters, you wrote (number_of_written_parameters) 
-  * the value may be ~ (tilde) or an integer number + 
-  * ~ means it keeps its previous y position+Wrong parameter type 
 +  ERROR LINE (line_number):​ RECTANGLE parameter (the number of the parameter) requires a number or a variable, you wrote (actual_written_parameter_value) 
 +   
 + 
 +=== COLOR === 
 + 
 +Selects the drawing color. 
 +This will be the new position of the pen. 
 + 
 +The initial pen color is black. 
 +The initial fill color is white. 
 + 
 +== Syntax == 
 + 
 +  COLOR: pen r g b 
 +  COLOR: fill r g b 
 + 
 +== 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 
 +  * //g// - the green component of the color 
 +  * //b// - the blue component of the color 
 + 
 +Values are between 0 and 255.
  
 == Errors == == Errors ==
  
 Wrong number of parameters Wrong number of parameters
-  ERROR LINE (line_number):​ JUMP has 2 parameters, you wrote (number_of_written_parameters) 
  
-Wrong parameter for x +  ​ERROR LINE (line_number):​COLOR has 4 parameters, you wrote (number_of_written_parameters)
-  ​ERROR LINE (line_number): ​JUMP parameter 1 requires a number, you wrote (actual_written_parameter_value)+
  
-Wrong parameter for y +Wrong parameter ​type for type 
-  ERROR LINE (line_number): ​JUMP parameter ​requires a number, 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 
 +  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 
 +  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) 
 + 
 + 
 +=== LOOP === 
 + 
 +Repeats some lines of statements until REPEAT 
 + 
 +  LOOP: times 
 + 
 +LOOP statements are not imbricated (LOOP in LOOP) 
 + 
 +== Parameters == 
 +It takes exactly one parameter 
 + 
 +* //times// - an integer number or a variable specifying the number of times to repeat the statements up to REPEAT 
 + 
 +== Errors == 
 + 
 +Wrong number of parameters 
 +  ERROR LINE (line_number):​ LOOP has 1 parameters, you wrote (number_of_written_parameters) 
 + 
 +Wrong parameter for times 
 +  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 
 + 
 +  ERROR LINE (line_number):​ LOOP with no REPEAT 
 + 
 + 
 +=== WHILE === 
 + 
 +Repeats some lines of statements until REPEAT 
 + 
 +  WHILE: variable 
 + 
 +WHILE statements are not imbricated (WHILE in WHILE) 
 + 
 +== Parameters == 
 +It takes exactly one parameter 
 + 
 +* //​variable//​ - a variable, if the variable is different from 0, repeat the statements up to REPEAT 
 + 
 +== Errors == 
 + 
 +Wrong number of parameters 
 +  ERROR LINE (line_number):​ WHILE has 1 parameters, you wrote (number_of_written_parameters) 
 + 
 +Wrong parameter for times 
 +  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 
 + 
 +  ERROR LINE (line_number):​ WHILE with no REPEAT
  
 === REPEAT === === REPEAT ===
  
-Repeats ​some lines of commands ​until END+Ends a loop or a while 
 + 
 +== Parameters == 
 + 
 +It takes no parameters 
 + 
 +== Errors == 
 + 
 +Wrong number of parameters 
 +  ERROR LINE (line_number):​ REPEAT has 0 parameters, you wrote (number_of_written_parameters) 
 + 
 +END is used without a previous LOOP 
 +  ERROR LINE (line_number):​ REPEAT and no LOOP 
 +   
 +=== IF === 
 + 
 +Execute ​some lines of statements ​until ELSE or END
  
-  ​REPEAT times+  ​IF: variable
  
-REPEAT commands ​are not imbricated (REPEAT ​in REPEAT)+IF statements ​are not imbricated (IF in IF)
  
 == Parameters == == Parameters ==
 It takes exactly one parameter It takes exactly one parameter
  
-* //times// - an integer number specifying ​the number of times to repeat ​the commands ​up to END+* //variable// - a variable, if the variable is different from 0, execute ​the statements ​up to ELSE or END (if there is no ELSE)
  
 == Errors == == Errors ==
  
 Wrong number of parameters Wrong number of parameters
-  ERROR LINE (line_number): ​REPEAT ​has 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
-  ERROR LINE (line_number): ​REPEAT ​parameter 1 requires a number, 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 REPEAT ​without END+The file ends and there still is at least one IF without ​ELSE or END
  
-  You have number_of_repeats ​REPEAT ​without END+  You have number_of_repeats ​IF without END 
 + 
 +=== ELSE === 
 + 
 +Else part of the if 
 + 
 +== Parameters == 
 + 
 +It takes no parameters 
 + 
 +== Errors == 
 + 
 +Wrong number of parameters 
 +  ERROR LINE (line_number):​ ELSE has 0 parameters, you wrote (number_of_written_parameters) 
 + 
 +END is used without a previous IF 
 +  ERROR LINE (line_number):​ ELSE and no IF
  
 === END === === END ===
  
-Ends a repeat loop+Ends an if
  
 == Parameters == == Parameters ==
Line 237: Line 411:
   ERROR LINE (line_number):​ END has 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 ​REPEAT +END is used without a previous ​IF 
-  ERROR LINE (line_number):​ END and no REPEAT+  ERROR LINE (line_number):​ END and no IF
  
-===== Bonus =====+=== SET ===
  
-For an additional **0.5p**, implement ​the REPEAT imbrication (REPEAT in REPEAT). ​+Set the value of a variable
  
-<​note>​ +  SET: variable value
-Bonus will be awarded only if all other tests pass. +
-</​note>​  +
-   +
-===== Testing =====+
  
-The homework will be tested automatically using  a set of public and private tests.+== Parameters == 
 +It takes exactly two parameter
  
-==== Public Tests ====+  * //​variable//​ - a variable 
 +  * //value// - the value, may be a number or another variable
  
-You can download the public tests from the GitHub [[https://​github.com/​upb-fils/​alf|repository]].+== Errors ==
  
-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.+Wrong number ​of parameters 
 +  ERROR LINE (line_number):​ SET has 2 parameters, you wrote (number_of_written_parameters)
  
-<code bash> +Wrong parameter for times 
-cd verify +  ERROR LINE (line_number):​ SET parameter 1 requires a variable, you wrote (actual_written_parameter_value)
-./​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]].+Wrong parameter ​for times 
 +  ERROR LINE (line_number)SET parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
  
-<​note>​ +=== ADD ===
-To install nodejs in Linux or Windows Linux Subsystem, do the following:+
  
-<code bash> +Add a value to the value of a variable
-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>​+
  
-==== Private Tests ==== +  ADD: variable value
-When uploading the homework, we might have some private tests that it needs to pass. vmchecker will run them.+
  
-<​note>​ +== Parameters == 
-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. +It takes exactly two parameter
-</​note>​+
  
-===== Upload the homework ===== +  * //variable// - a variable 
-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]].+  * //value// - the value to add, may be a number or another variable
  
-==== Readme ==== +== Errors ​==
-The readme file has the following format:+
  
-<​code>​ +Wrong number of parameters 
-Your full name +  ERROR LINE (line_number):​ ADD has 2 parameters, you wrote (number_of_written_parameters)
-Group+
  
-An explanation how you wrote your homework, what did you use, what are the main ideas. +Wrong parameter for times 
-</​code>​+  ERROR LINE (line_number):​ ADD parameter 1 requires a variable, ​you wrote (actual_written_parameter_value)
  
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ ADD parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
  
-==== Homework Archive ==== 
-To upload your homework, please follow the following: 
  
-  - Create a zip (not rar, ace, 7zip or anything else) archive containing:​ +=== SUB ===
-    * 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 //1. Langage Robot// +
-  - upload the archive+
  
 +Subtract a value from the value of a variable
  
-<​note>​ +  SUB: variable value
-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//​. +== Parameters == 
-</​note>​+It takes exactly two parameter
  
-When the archive is uploadedvmchecker will run:+  * //​variable//​ - a variable 
 +  * //value// - the value to subtractmay be a number or another variable
  
-<code bash> +== Errors ==
-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>​+
  
 +Wrong number of parameters
 +  ERROR LINE (line_number):​ SUB has 2 parameters, you wrote (number_of_written_parameters)
  
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ SUB parameter 1 requires a variable, you wrote (actual_written_parameter_value)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ SUB parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
 +
 +
 +=== MUL ===
 +
 +Multiply a variable'​s value with a value.
 +
 +  MUL: variable value
 +
 +== Parameters ==
 +It takes exactly two parameter
 +
 +  * //​variable//​ - a variable
 +  * //value// - the value to multiply the variable'​s value with, may be a number or another variable
 +
 +== Errors ==
 +
 +Wrong number of parameters
 +  ERROR LINE (line_number):​ MUL has 2 parameters, you wrote (number_of_written_parameters)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ MUL parameter 1 requires a variable, you wrote (actual_written_parameter_value)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ MUL parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
 +
 +
 +=== DIV ===
 +
 +Divide the value of a variable with a value
 +
 +  DIV: variable value
 +
 +== Parameters ==
 +It takes exactly two parameter
 +
 +  * //​variable//​ - a variable
 +  * //value// - the value to divide the variable'​s value with, may be a number or another variable
 +
 +== Errors ==
 +
 +Wrong number of parameters
 +  ERROR LINE (line_number):​ DIV has 2 parameters, you wrote (number_of_written_parameters)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ DIV parameter 1 requires a variable, you wrote (actual_written_parameter_value)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ DIV parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
 +
 +=== IDIV ===
 +
 +Divide the value of a variable with a value (integer value)
 +
 +  IDIV: variable value
 +
 +== Parameters ==
 +It takes exactly two parameter
 +
 +  * //​variable//​ - a variable
 +  * //value// - the value to divide the variable'​s value with, may be a number or another variable
 +
 +== Errors ==
 +
 +Wrong number of parameters
 +  ERROR LINE (line_number):​ IDIV has 2 parameters, you wrote (number_of_written_parameters)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ IDIV parameter 1 requires a variable, you wrote (actual_written_parameter_value)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ IDIV parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
 +
 +=== MOD ===
 +
 +The remainder of the division of a variable with a value
 +
 +  MOD: variable value
 +
 +== Parameters ==
 +It takes exactly two parameter
 +
 +  * //​variable//​ - a variable
 +  * //value// - the value to divide the variable'​s value with, may be a number or another variable
 +
 +== Errors ==
 +
 +Wrong number of parameters
 +  ERROR LINE (line_number):​ MOD has 2 parameters, you wrote (number_of_written_parameters)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ MOD parameter 1 requires a variable, you wrote (actual_written_parameter_value)
 +
 +Wrong parameter for times
 +  ERROR LINE (line_number):​ MOD parameter 2 requires a number or a variable, you wrote (actual_written_parameter_value)
 +
 +
 +===== Bonus =====
 +
 +For an additional **0.20p**, implement the LOOP, WHILE and IF imbrication. ​
 +
 +<​note>​
 +Bonus will be awarded only if all other tests pass.
 +</​note> ​
 +  ​
  
alf/teme/tema_en_2.1583772514.txt.gz · Last modified: 2020/03/09 18:48 by alexandru.radovici
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0