From 55d37f73e3c99656e9c77e19a227227643ff444e Mon Sep 17 00:00:00 2001 From: Alexander Lyabah Date: Mon, 30 Dec 2019 17:56:36 +0200 Subject: [PATCH] First Version --- autofill.sh | 2 +- editor/animation/init.js | 4 +-- editor/initial_code/js_node | 18 ++++++----- editor/initial_code/python_3 | 14 ++++----- info/media/example.png | Bin 2024 -> 3600 bytes info/media/example.svg | 51 +++++++++++++++++++++++++++++++ info/task_description.html | 30 +++++------------- info/task_short_description.html | 2 +- verification/referee.py | 4 +-- verification/tests.py | 32 ++++++++++--------- 10 files changed, 98 insertions(+), 59 deletions(-) create mode 100644 info/media/example.svg diff --git a/autofill.sh b/autofill.sh index 90ce1d7..67c4309 100755 --- a/autofill.sh +++ b/autofill.sh @@ -1 +1 @@ -checkio --domain py autofillrepo --py-function sum_two --js-function sumTwo . +checkio --domain py autofillrepo --py-function replace_first --js-function replaceFirst . diff --git a/editor/animation/init.js b/editor/animation/init.js index a24cfc6..c6301a4 100644 --- a/editor/animation/init.js +++ b/editor/animation/init.js @@ -8,8 +8,8 @@ requirejs(['ext_editor_io', 'jquery_190'], var io = new extIO({ multipleArguments: true, functions: { - python: 'sum_two', - js: 'sumTwo' + python: 'replace_first', + js: 'replaceFirst' } }); io.start(); diff --git a/editor/initial_code/js_node b/editor/initial_code/js_node index f6e2dc2..1910f29 100644 --- a/editor/initial_code/js_node +++ b/editor/initial_code/js_node @@ -1,19 +1,21 @@ "use strict"; -function sumTwo(a, b) { - // sums two passed arguments - +function replaceFirst(a) { // your code here - return 0; + return undefined; } var assert = require('assert'); + if (!global.is_checking) { console.log('Example:'); - console.log(sumTwo(3, 2)); + console.log(replaceFirst([1, 2, 3, 4])); + + // These "asserts" are used for self-checking + assert.deepEqual(replaceFirst([1, 2, 3, 4]), [2, 3, 4, 1]); + assert.deepEqual(replaceFirst([1]), [1]); + assert.deepEqual(replaceFirst([]), []); - // These "asserts" are used for self-checking and not for an auto-testing - assert.equal(sumTwo(3, 2), 5); - assert.equal(sumTwo(5, 7), 12); console.log("Coding complete? Click 'Check' to earn cool rewards!"); } + \ No newline at end of file diff --git a/editor/initial_code/python_3 b/editor/initial_code/python_3 index 5e64eec..36dd656 100644 --- a/editor/initial_code/python_3 +++ b/editor/initial_code/python_3 @@ -1,16 +1,14 @@ -def sum_two(a, b): - """ - sums two passed arguments - """ +def replace_first(a): # your code here return None if __name__ == '__main__': print("Example:") - print(sum_two(3, 2)) - + print(replace_first([1, 2, 3, 4])) + # These "asserts" are used for self-checking and not for an auto-testing - assert sum_two(3, 2) == 5, "First" - assert sum_two(5, 7) == 12, "Second" + assert replace_first([1, 2, 3, 4]) == [2, 3, 4, 1] + assert replace_first([1]) == [1] + assert replace_first([]) == [] print("Coding complete? Click 'Check' to earn cool rewards!") diff --git a/info/media/example.png b/info/media/example.png index dda436b3951af3049b35493b26b00a918dcac939..04da2ed59c8a3e0fb75467da8c89a59602c15f96 100644 GIT binary patch delta 3503 zcmV;g4N&sv50D%oiBL{Q4GJ0x0000DNk~Le0004y0001(2nGNE0Lq)c6_Ft)Sq-vD zL_t(|+U(uUb=x``hjC=i-A8wujXBG^ic*2-+d%9JELC8u0?QTHsz7oDksBB*6+~Ih za_CLgN(D1`BX9!4fJ8}@L=eyK93S5+f5fCn{PBVys1%W*A(5~Wk+2VcfF!+Z+8^}S z-#5Ab^jz`V&;R|ehdFN}fEelaZlpimR{37t)-|rZ{s(U%0Du4i01zMmfM)w6lD~7R zKOQ}=FL(rdT={5gxx=*MtF+vYpR znzRkk2gpkk8Zy(cT*xths{fv8iyF+1{?ykWpY=!Xe9aDPc@M^V+l!V3#)Y-*nP>Y8 zv+YlM+h>Ue>csP7R6Hr= z<3|6SG^T^tgT%bA_iku-WF}zy`ezE$aHbR_lR$&qp>;?b0kXb-*L7_gj!p}=Pr~3! zg~roI8k2AOcMM`}NcG=7G4JiRWPg3pKR?ymK1kp^xQV4VA0Q(Ik4OGDuXa4P2#^-^ z$S+KAbX&ZgvTe_M24lxGq?fUU$R6QglWI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+ + + + + + + + + + + + + + + + + + + + diff --git a/info/task_description.html b/info/task_description.html index 238e44e..611cf79 100644 --- a/info/task_description.html +++ b/info/task_description.html @@ -1,20 +1,19 @@

- Sum two passed ints + In a given array first element should become the last one. Empty array or array with only one element should stay the same

example

-

- Input: Two arguments. Both are ints. + Input: {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.

- Output: Int. + Output: {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.

@@ -25,28 +24,13 @@

{% if interpreter.slug == "js-node" %} -
sumTwo(2, 3) == 5
-sumTwo(5, 7) == 12
+
replaceFirst([1, 2, 3, 4]) == [2, 3, 4, 1]
+replaceFirst([1]) == [1]
 
{% else %} -
sum_two(2, 3) == 5
-sum_two(5, 7) == 12
+
replace_first([1, 2, 3, 4]) == [2, 3, 4, 1]
+replace_first([1]) == [1]
 
{% endif %} - - - -

- - How it’s used: - (math is used everywhere) -

- - - -

- Precondition: - both given ints should be between -1000 and 1000 -

diff --git a/info/task_short_description.html b/info/task_short_description.html index f5d8b9d..267a2e3 100644 --- a/info/task_short_description.html +++ b/info/task_short_description.html @@ -1 +1 @@ -Add short description \ No newline at end of file +The first element should become the last one \ No newline at end of file diff --git a/verification/referee.py b/verification/referee.py index d3ffb1c..2923a4f 100644 --- a/verification/referee.py +++ b/verification/referee.py @@ -38,8 +38,8 @@ CheckiOReferee( tests=TESTS, function_name={ - "python": "sum_two", - "js": "sumTwo" + "python": "replace_first", + "js": "replaceFirst" }, cover_code={ 'python-3': cover_codes.unwrap_args, diff --git a/verification/tests.py b/verification/tests.py index ac70df9..bc88db8 100644 --- a/verification/tests.py +++ b/verification/tests.py @@ -11,26 +11,30 @@ TESTS = { "Basics": [ { - "input": [3, 2], - "answer": 5, - "explanation": "3+2=?" + "input": [[1,2,3,4]], + "answer": [2,3,4,1], }, { - "input": [5, 7], - "answer": 12, - "explanation": "5+7=?" - } + "input": [[1]], + "answer": [1], + }, + { + "input": [[]], + "answer": [], + }, ], "Extra": [ { - "input": [6, 3], - "answer": 9, - "explanation": "6+3=?" + "input": [[10, 10]], + "answer": [10, 10], }, { - "input": [6, 7], - "answer": 13, - "explanation": "6+7=?" - } + "input": [[1,2,2,2]], + "answer": [2,2,2,1], + }, + { + "input": [[100]], + "answer": [100], + }, ] }