algoritmo.ivph 17 KB

12345678910111213141516171819202122232425262728293031
  1. {
  2. "testcases" : [
  3. {
  4. "input": ["1"],
  5. "output": ["1"]
  6. },
  7. {
  8. "input": ["6"],
  9. "output": ["6"]
  10. },
  11. {
  12. "input": ["11"],
  13. "output": ["11"]
  14. },
  15. {
  16. "input": ["400"],
  17. "output": ["400"]
  18. },
  19. {
  20. "input": ["-45"],
  21. "output": ["-45"]
  22. }
  23. ] ,
  24. "settings_data_types":
  25. [{"name":"integer_data_type","value":"on"},{"name":"real_data_type","value":"on"},{"name":"text_data_type","value":"on"},{"name":"boolean_data_type","value":"on"},{"name":"void_data_type","value":"on"}],
  26. "settings_commands":
  27. [{"name":"commands_read","value":"on"},{"name":"commands_write","value":"on"},{"name":"commands_comment","value":"on"},{"name":"commands_attribution","value":"on"},{"name":"commands_functioncall","value":"on"},{"name":"commands_iftrue","value":"on"},{"name":"commands_repeatNtimes","value":"on"},{"name":"commands_while","value":"on"},{"name":"commands_dowhile","value":"on"},{"name":"commands_switch","value":"on"}],
  28. "settings_functions":
  29. [{"name":"functions_creation","value":"on"},{"name":"functions_move","value":"on"}] }
  30. ::algorithm::
  31. {"functions":[{"type":"function","name":"start","return_type":"void","return_dimensions":0,"parameters_list":[],"is_main":true,"is_hidden":false,"variables_list":[],"function_comment":{"type":"comment","comment_text":"Esta é a função principal..."},"commands":[{"type":"iftrue","expression":{"type":"exp_conditional","expression":{"type":"exp_logic","has_neg":false,"first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"5","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"equals_to"}},"commands_block":[{"type":"writer","content":[{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0}]}],"commands_else":null},{"type":"writer","content":[{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0}]},{"type":"whiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"10","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"greater_than"}},"commands_block":null},{"type":"whiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"10","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"greater_than"}},"commands_block":null},{"type":"iftrue","expression":{"type":"exp_conditional","expression":{"type":"exp_logic","has_neg":false,"first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"5","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"not_equals_to"}},"commands_block":null,"commands_else":null},{"type":"whiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_logic","has_neg":false,"first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"54","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"equals_to"}},"commands_block":[{"type":"switch","variable":{"type":"var_value","variable_and_value":4,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"cases":[{"type":"switchcase","variable_value_menu":{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0},"commands_block":[]}]}]},{"type":"whiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"-50","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"less_than"}},"commands_block":null},{"type":"repeatNtimes","var_attribution":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"var_incrementation":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"expression1":{"type":"var_value","variable_and_value":7,"content":"0","row":null,"column":null,"include_constant":true,"dimensions":0},"expression2":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"10","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"less_than"}},"expression3":{"type_exp":"exp_op_exp","itens":[{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"plus",{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0}]},"commands_block":null},{"type":"switch","variable":{"type":"var_value","variable_and_value":4,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"cases":[{"type":"switchcase","variable_value_menu":{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0},"commands_block":[]}]},{"type":"reader","variable_value_menu":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false}},{"type":"repeatNtimes","var_attribution":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"var_incrementation":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"expression1":{"type":"var_value","variable_and_value":7,"content":"0","row":null,"column":null,"include_constant":true,"dimensions":0},"expression2":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"10","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"less_than"}},"expression3":{"type_exp":"exp_op_exp","itens":[{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"plus",{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0}]},"commands_block":null},{"type":"switch","variable":{"type":"var_value","variable_and_value":4,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"cases":[{"type":"switchcase","variable_value_menu":{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0},"commands_block":[]}]},{"type":"writer","content":[{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true}]},{"type":"repeatNtimes","var_attribution":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"var_incrementation":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"expression1":{"type":"var_value","variable_and_value":7,"content":"0","row":null,"column":null,"include_constant":true,"dimensions":0},"expression2":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"10","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"less_than"}},"expression3":{"type_exp":"exp_op_exp","itens":[{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"plus",{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0}]},"commands_block":null},{"type":"whiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_logic","has_neg":false,"first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"578","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"equals_to"}},"commands_block":null},{"type":"dowhiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_logic","has_neg":false,"first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"87","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"equals_to"}},"commands_block":null}]},{"type":"function","name":"new_function_0","return_type":"void","return_dimensions":0,"parameters_list":[],"is_main":false,"is_hidden":false,"variables_list":[{"type":"integer","name":"new_variable_0","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0}],"function_comment":{"type":"comment","comment_text":"Initial comment of function..."},"commands":[{"type":"dowhiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"new_variable_0","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"540","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"greater_than"}},"commands_block":null},{"type":"dowhiletrue","expression":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":7,"content":{"type":"integer","name":"new_variable_0","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"470","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"greater_than"}},"commands_block":null}]},{"type":"function","name":"new_function_1","return_type":"void","return_dimensions":0,"parameters_list":[],"is_main":false,"is_hidden":false,"variables_list":[],"function_comment":{"type":"comment","comment_text":"Initial comment of function..."},"commands":[{"type":"switch","variable":{"type":"var_value","variable_and_value":4,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"cases":[{"type":"switchcase","variable_value_menu":{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0},"commands_block":[]}]},{"type":"repeatNtimes","var_attribution":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"var_incrementation":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"expression1":{"type":"var_value","variable_and_value":7,"content":"0","row":null,"column":null,"include_constant":true,"dimensions":0},"expression2":{"type":"exp_conditional","expression":{"type":"exp_arithmetic","first_operand":{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"second_operand":{"type":"var_value","variable_and_value":7,"content":"0","row":null,"column":null,"include_constant":true,"dimensions":0},"operator":"less_than"}},"expression3":{"type_exp":"exp_op_exp","itens":[{"type":"var_value","variable_and_value":1,"content":{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":false,"dimensions":0},"plus",{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0}]},"commands_block":null}]},{"type":"function","name":"new_function_2","return_type":"void","return_dimensions":0,"parameters_list":[],"is_main":false,"is_hidden":false,"variables_list":[{"type":"integer","name":"new_variable_1","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0}],"function_comment":{"type":"comment","comment_text":"Initial comment of function..."},"commands":[{"type":"switch","variable":{"type":"var_value","variable_and_value":4,"content":{"type":"integer","name":"new_variable_1","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0},"row":null,"column":null,"include_constant":true,"dimensions":0},"cases":[{"type":"switchcase","variable_value_menu":{"type":"var_value","variable_and_value":7,"content":"1","row":null,"column":null,"include_constant":true,"dimensions":0},"commands_block":[]}]}]}],"globals":[{"type":"integer","name":"a","value":1,"dimensions":0,"is_constant":false,"rows":0,"columns":0}]}