From 44444cee3c1ac9509119ba4fbfe9665bba2c5b7c Mon Sep 17 00:00:00 2001 From: Vishnya Date: Wed, 15 May 2019 23:29:29 +0300 Subject: [PATCH 01/14] added README.md --- README.md | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index c6f66a5..a617241 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,7 @@ -## Welcome to GitHub Pages - -You can use the [editor on GitHub](https://github.com/lv-411-nodejs/codeWarsTasks/edit/master/README.md) to maintain and preview the content for your website in Markdown files. - -Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. - -### Markdown - -Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for - -```markdown -Syntax highlighted code block - -# Header 1 -## Header 2 -### Header 3 - -- Bulleted -- List - -1. Numbered -2. List - -**Bold** and _Italic_ and `Code` text - -[Link](url) and ![Image](src) -``` - -For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). - -### Jekyll Themes - -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/lv-411-nodejs/codeWarsTasks/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. - -### Support or Contact - -Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. +| Name & Surname | kyu | Link | +| ------------- | ------------- | ------------- | +| Ostap Dutkevych | 8 |https://www.codewars.com/kata/holiday-viii-duty-free | +| | 8 | https://www.codewars.com/kata/simple-validation-of-a-username-with-regex | +| | 7 | https://www.codewars.com/kata/easy-line | +| | 6 | https://www.codewars.com/kata/floating-point-approximation-ii | +| | 5 | https://www.codewars.com/kata/first-variation-on-caesar-cipher | From 690e4d7d11ef1a4f350dd74fd72ab0e2ee155e17 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Wed, 15 May 2019 23:33:32 +0300 Subject: [PATCH 02/14] added functions into a folder tasks --- tasks/5_kyu.js | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ tasks/6_kyu.js | 16 ++++++++++++++++ tasks/7_kyu.js | 7 +++++++ tasks/8_kyu.js | 13 +++++++++++++ 4 files changed, 87 insertions(+) diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index e69de29..e303de2 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -0,0 +1,51 @@ +var u = "I should have known that you would have a perfect answer for me!!!"; +var v = ["J vltasl rlhr ", "zdfog odxr ypw", " atasl rlhr p ", "gwkzzyq zntyhv", " lvz wp!!!"]; + +function movingShift(s, shift) { + + var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); + var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); + + arr = s.split('').map(function(v,i,a){ + + if (shift >= 26){ shift = shift - 26;} + var key = abcLowerCase.indexOf(v.toLowerCase()) + shift; + if (key >= 26){ key = key - 26;} + + if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} + if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} + + shift = shift + 1; + return v; + + + }).join(''); + + var splitArr = []; + + for (var i = 0 ; i < 5 ; i++){ + splitArr.push(arr.slice(i * Math.ceil(s.length / 5), (i+1) * Math.ceil(s.length / 5))); + } + return splitArr; +} + +function demovingShift(arr, shift) { + var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); + var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); + return arr.join('').split('').map(function(v,i,a){ + + if (shift >= 26){ shift = shift - 26;} + + var key = abcLowerCase.indexOf(v.toLowerCase()) - shift; + if (key < 0){ key = key + 26;} + + + if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} + if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} + + shift = shift + 1; + return v; + + + }).join(''); +} \ No newline at end of file diff --git a/tasks/6_kyu.js b/tasks/6_kyu.js index e69de29..5f18c4d 100644 --- a/tasks/6_kyu.js +++ b/tasks/6_kyu.js @@ -0,0 +1,16 @@ +function interp(f, l, u, n) { + + let d = (u - l) / n; + for(let i = 0;i <= (l < u);i++) { + if (n > 0) { + let arr = []; + arr.push(Math.floor(l * 100) / 100); + arr.push(Math.floor((l + d)*100)/ 100); + arr.push(Math.floor(((l + d) + (l + d))*100) / 100); + arr.push(Math.floor((u - d)*100) / 100); + return arr; + } + + } + +} \ No newline at end of file diff --git a/tasks/7_kyu.js b/tasks/7_kyu.js index e69de29..2a288f9 100644 --- a/tasks/7_kyu.js +++ b/tasks/7_kyu.js @@ -0,0 +1,7 @@ +function easyLine(n) { + let sum = 1; + for (let i = 1; i <= n; i++){ + sum = sum * (n + i) / i; + } + return Math.round(Math.log(sum)); +} \ No newline at end of file diff --git a/tasks/8_kyu.js b/tasks/8_kyu.js index e69de29..56ff88c 100644 --- a/tasks/8_kyu.js +++ b/tasks/8_kyu.js @@ -0,0 +1,13 @@ + +// -------------- 1 ---------------- + +function dutyFree(normPrice, discount, hol){ + let saving = normPrice * discount / 100; + return Math.floor(hol / saving); +} + +// -------------- 2 ---------------- + +function validateUsr(username) { + return /^[0-9a-z_]{4,16}$/.test(username) +} \ No newline at end of file From cc2382f812c4b6668fa2fa4a6ae6d18c0b342ac7 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Wed, 15 May 2019 23:57:44 +0300 Subject: [PATCH 03/14] added empty line at the end of the functions --- tasks/5_kyu.js | 3 ++- tasks/6_kyu.js | 3 ++- tasks/7_kyu.js | 3 ++- tasks/8_kyu.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index e303de2..df92ac6 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -48,4 +48,5 @@ function demovingShift(arr, shift) { }).join(''); -} \ No newline at end of file +} + diff --git a/tasks/6_kyu.js b/tasks/6_kyu.js index 5f18c4d..16be9cb 100644 --- a/tasks/6_kyu.js +++ b/tasks/6_kyu.js @@ -13,4 +13,5 @@ function interp(f, l, u, n) { } -} \ No newline at end of file +} + diff --git a/tasks/7_kyu.js b/tasks/7_kyu.js index 2a288f9..4e0d581 100644 --- a/tasks/7_kyu.js +++ b/tasks/7_kyu.js @@ -4,4 +4,5 @@ function easyLine(n) { sum = sum * (n + i) / i; } return Math.round(Math.log(sum)); -} \ No newline at end of file +} + diff --git a/tasks/8_kyu.js b/tasks/8_kyu.js index 56ff88c..752382d 100644 --- a/tasks/8_kyu.js +++ b/tasks/8_kyu.js @@ -10,4 +10,5 @@ function dutyFree(normPrice, discount, hol){ function validateUsr(username) { return /^[0-9a-z_]{4,16}$/.test(username) -} \ No newline at end of file +} + From 355629bfb339ac498bc91d86ab9253ba0152c1aa Mon Sep 17 00:00:00 2001 From: Vishnya Date: Thu, 16 May 2019 17:59:20 +0300 Subject: [PATCH 04/14] change call func --- tasks/.idea/misc.xml | 6 +++ tasks/.idea/modules.xml | 8 ++++ tasks/.idea/tasks.iml | 8 ++++ tasks/.idea/vcs.xml | 6 +++ tasks/.idea/workspace.xml | 93 +++++++++++++++++++++++++++++++++++++++ tasks/5_kyu.js | 2 + tasks/6_kyu.js | 2 + tasks/7_kyu.js | 1 + tasks/8_kyu.js | 2 + 9 files changed, 128 insertions(+) create mode 100644 tasks/.idea/misc.xml create mode 100644 tasks/.idea/modules.xml create mode 100644 tasks/.idea/tasks.iml create mode 100644 tasks/.idea/vcs.xml create mode 100644 tasks/.idea/workspace.xml diff --git a/tasks/.idea/misc.xml b/tasks/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/tasks/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/tasks/.idea/modules.xml b/tasks/.idea/modules.xml new file mode 100644 index 0000000..14a22b9 --- /dev/null +++ b/tasks/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tasks/.idea/tasks.iml b/tasks/.idea/tasks.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/tasks/.idea/tasks.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tasks/.idea/vcs.xml b/tasks/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/tasks/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tasks/.idea/workspace.xml b/tasks/.idea/workspace.xml new file mode 100644 index 0000000..316b5d6 --- /dev/null +++ b/tasks/.idea/workspace.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1558017472157 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index df92ac6..a8b37de 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -50,3 +50,5 @@ function demovingShift(arr, shift) { }).join(''); } +demovingShift(v, 1); +movingShift(u, 1); \ No newline at end of file diff --git a/tasks/6_kyu.js b/tasks/6_kyu.js index 16be9cb..56212da 100644 --- a/tasks/6_kyu.js +++ b/tasks/6_kyu.js @@ -15,3 +15,5 @@ function interp(f, l, u, n) { } + +interp(x => x, 0, 9.0, 4); \ No newline at end of file diff --git a/tasks/7_kyu.js b/tasks/7_kyu.js index 4e0d581..3ba03f5 100644 --- a/tasks/7_kyu.js +++ b/tasks/7_kyu.js @@ -6,3 +6,4 @@ function easyLine(n) { return Math.round(Math.log(sum)); } +easyLine(7); \ No newline at end of file diff --git a/tasks/8_kyu.js b/tasks/8_kyu.js index 752382d..e358be2 100644 --- a/tasks/8_kyu.js +++ b/tasks/8_kyu.js @@ -5,6 +5,7 @@ function dutyFree(normPrice, discount, hol){ let saving = normPrice * discount / 100; return Math.floor(hol / saving); } +dutyFree(12, 50, 1000); // -------------- 2 ---------------- @@ -12,3 +13,4 @@ function validateUsr(username) { return /^[0-9a-z_]{4,16}$/.test(username) } +validateUsr('asddsa'); \ No newline at end of file From 03eddc49eb33a2e3e4afdfa711ad7c0e12d20687 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:10:28 +0300 Subject: [PATCH 05/14] change main.js --- main.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index c4c03e6..d34395d 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,18 @@ require("amd-loader"); -var msg = require('./tasks/template'); -msg.print("run!"); +// var msg = require('./tasks/template'); +// msg.print("run!"); + +var kuy_5 = require("./tasks/5_kyu"); +console.log(kuy_5.movingShift(1)); +console.log(kuy_5.demovingShift(1)); + +var kuy_6 = require("./tasks/6_kyu"); +console.log(kuy_6.interp(x => x, 0, 9.0, 4)); + +var kuy_7 = require("./tasks/7_kyu"); +console.log(kuy_7.easyLine(7)); + +var kuy_8 = require("./tasks/8_kyu"); +console.log(kuy_8.dutyFree(12, 50, 1000)); + +console.log(kuy_8.validateUsr('asdad')); \ No newline at end of file From ed77879c8fc59cdf9c089643ee65fc19d92cb202 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:11:53 +0300 Subject: [PATCH 06/14] added define for fucntion --- tasks/5_kyu.js | 77 +++++++++++++++++++++++++++----------------------- tasks/6_kyu.js | 31 +++++++++++--------- tasks/7_kyu.js | 19 ++++++++----- tasks/8_kyu.js | 23 +++++++-------- 4 files changed, 83 insertions(+), 67 deletions(-) diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index a8b37de..e07e749 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -1,54 +1,61 @@ -var u = "I should have known that you would have a perfect answer for me!!!"; -var v = ["J vltasl rlhr ", "zdfog odxr ypw", " atasl rlhr p ", "gwkzzyq zntyhv", " lvz wp!!!"]; -function movingShift(s, shift) { - var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); - var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); - arr = s.split('').map(function(v,i,a){ +var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); +var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); - if (shift >= 26){ shift = shift - 26;} - var key = abcLowerCase.indexOf(v.toLowerCase()) + shift; - if (key >= 26){ key = key - 26;} +define(function () { + return { + movingShift: function (shift) { + let s = "I should have known that you would have a perfect answer for me!!!"; - if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} - if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} + let abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); + let abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); - shift = shift + 1; - return v; + let arr = s.split('').map(function(v,i,a){ + if (shift >= 26){ shift = shift - 26;} + let key = abcLowerCase.indexOf(v.toLowerCase()) + shift; + if (key >= 26){ key = key - 26;} - }).join(''); + if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} + if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} - var splitArr = []; + shift = shift + 1; + return v; - for (var i = 0 ; i < 5 ; i++){ - splitArr.push(arr.slice(i * Math.ceil(s.length / 5), (i+1) * Math.ceil(s.length / 5))); - } - return splitArr; -} -function demovingShift(arr, shift) { - var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); - var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); - return arr.join('').split('').map(function(v,i,a){ + }).join(''); + + let splitArr = []; + + for (let i = 0 ; i < 5 ; i++){ + splitArr.push(arr.slice(i * Math.ceil(s.length / 5), (i+1) * Math.ceil(s.length / 5))); + } + return splitArr; + }, + + demovingShift: function (shift) { + let arr = ["J vltasl rlhr ", "zdfog odxr ypw", " atasl rlhr p ", "gwkzzyq zntyhv", " lvz wp!!!"]; + return arr.join('').split('').map(function(v,i,a){ - if (shift >= 26){ shift = shift - 26;} + if (shift >= 26){ shift = shift - 26;} - var key = abcLowerCase.indexOf(v.toLowerCase()) - shift; - if (key < 0){ key = key + 26;} + let key = abcLowerCase.indexOf(v.toLowerCase()) - shift; + if (key < 0){ key = key + 26;} - if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} - if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} + if (abcLowerCase.indexOf(v) >= 0){ v = abcLowerCase[key];} + if (abcUpperCase.indexOf(v) >= 0){ v = abcUpperCase[key];} - shift = shift + 1; - return v; + shift = shift + 1; + return v; + + + }).join(''); + } + } +}); - }).join(''); -} -demovingShift(v, 1); -movingShift(u, 1); \ No newline at end of file diff --git a/tasks/6_kyu.js b/tasks/6_kyu.js index 56212da..a923ed0 100644 --- a/tasks/6_kyu.js +++ b/tasks/6_kyu.js @@ -1,19 +1,22 @@ -function interp(f, l, u, n) { +define(function () { + return { + interp: function (f, l, u, n) { - let d = (u - l) / n; - for(let i = 0;i <= (l < u);i++) { - if (n > 0) { - let arr = []; - arr.push(Math.floor(l * 100) / 100); - arr.push(Math.floor((l + d)*100)/ 100); - arr.push(Math.floor(((l + d) + (l + d))*100) / 100); - arr.push(Math.floor((u - d)*100) / 100); - return arr; - } + let d = (u - l) / n; + for(let i = 0;i <= (l < u);i++) { + if (n > 0) { + let arr = []; + arr.push(Math.floor(l * 100) / 100); + arr.push(Math.floor((l + d)*100)/ 100); + arr.push(Math.floor(((l + d) + (l + d))*100) / 100); + arr.push(Math.floor((u - d)*100) / 100); + return arr; + } - } + } -} + } + } +}) -interp(x => x, 0, 9.0, 4); \ No newline at end of file diff --git a/tasks/7_kyu.js b/tasks/7_kyu.js index 3ba03f5..c6e810c 100644 --- a/tasks/7_kyu.js +++ b/tasks/7_kyu.js @@ -1,9 +1,14 @@ -function easyLine(n) { - let sum = 1; - for (let i = 1; i <= n; i++){ - sum = sum * (n + i) / i; +define(function () { + return { + easyLine:function easyLine(n) { + let sum = 1; + for (let i = 1; i <= n; i++){ + sum = sum * (n + i) / i; + } + return Math.round(Math.log(sum)); + } + } - return Math.round(Math.log(sum)); -} -easyLine(7); \ No newline at end of file +}); + diff --git a/tasks/8_kyu.js b/tasks/8_kyu.js index e358be2..0f7990f 100644 --- a/tasks/8_kyu.js +++ b/tasks/8_kyu.js @@ -1,16 +1,17 @@ +define(function () { + return{ + dutyFree: function(normPrice, discount, hol){ + let saving = normPrice * discount / 100; + return Math.floor(hol / saving); + }, + validateUsr: function(username) { + return /^[0-9a-z_]{4,16}$/.test(username) + } + } -// -------------- 1 ---------------- -function dutyFree(normPrice, discount, hol){ - let saving = normPrice * discount / 100; - return Math.floor(hol / saving); -} -dutyFree(12, 50, 1000); +}); + -// -------------- 2 ---------------- -function validateUsr(username) { - return /^[0-9a-z_]{4,16}$/.test(username) -} -validateUsr('asddsa'); \ No newline at end of file From 9710c29c6da2742668120fb689119b81a3e9fb87 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:19:47 +0300 Subject: [PATCH 07/14] change .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9972163..1fbc290 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,5 @@ typings/ # next.js build output .next + +.idea \ No newline at end of file From dfe06e9737fc4c93bd65792cb37c86191451195a Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:20:49 +0300 Subject: [PATCH 08/14] change .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1fbc290..cba3229 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,4 @@ typings/ # next.js build output .next -.idea \ No newline at end of file +.idea/ \ No newline at end of file From 139712d090ed0a6cbfbd4df8b2a0aa45864d5a0e Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:24:08 +0300 Subject: [PATCH 09/14] change .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cba3229..1fbc290 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,4 @@ typings/ # next.js build output .next -.idea/ \ No newline at end of file +.idea \ No newline at end of file From c29780b963f2772cebbda503e8e7593049d320ce Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 11:49:38 +0300 Subject: [PATCH 10/14] added prop amd --- .eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index edadc67..580e0ec 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,8 @@ module.exports = { "env": { "browser": true, - "es6": true + "es6": true, + "amd":true }, "extends": "eslint:recommended", "globals": { From 76688eb3c4ad2e1a26a8d1dab795f1d66124dc9e Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 16:06:59 +0300 Subject: [PATCH 11/14] change 5_kuy.js --- tasks/5_kyu.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index e07e749..010aa1b 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -1,8 +1,8 @@ -var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); -var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); +// var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); +// var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); define(function () { return { @@ -12,7 +12,7 @@ define(function () { let abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); let abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); - let arr = s.split('').map(function(v,i,a){ + let arr = s.split('').map(function(v){ if (shift >= 26){ shift = shift - 26;} let key = abcLowerCase.indexOf(v.toLowerCase()) + shift; @@ -37,7 +37,7 @@ define(function () { demovingShift: function (shift) { let arr = ["J vltasl rlhr ", "zdfog odxr ypw", " atasl rlhr p ", "gwkzzyq zntyhv", " lvz wp!!!"]; - return arr.join('').split('').map(function(v,i,a){ + return arr.join('').split('').map(function(v){ if (shift >= 26){ shift = shift - 26;} From f0974a34efa5afacdca7db575de3b5d1dd2ab326 Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 16:09:33 +0300 Subject: [PATCH 12/14] change 5_kuy.js --- tasks/5_kyu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/5_kyu.js b/tasks/5_kyu.js index 010aa1b..54b92a0 100644 --- a/tasks/5_kyu.js +++ b/tasks/5_kyu.js @@ -1,8 +1,8 @@ -// var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); -// var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); +var abcLowerCase ='abcdefghijklmnopqrstuvwxyz'.split(''); +var abcUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); define(function () { return { From 2a368def4f4fbacee8634e3e6e4dbfd9e33894ec Mon Sep 17 00:00:00 2001 From: Vishnya Date: Fri, 17 May 2019 16:12:06 +0300 Subject: [PATCH 13/14] change template.js --- tasks/template.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/template.js b/tasks/template.js index 4d24ed8..683e4e8 100644 --- a/tasks/template.js +++ b/tasks/template.js @@ -1,7 +1,7 @@ -define(function () { - return { - print: function(msg) { - console.log(msg); - } - }; -}); \ No newline at end of file +// define(function () { +// return { +// print: function(msg) { +// console.log(msg); +// } +// }; +// }); \ No newline at end of file From ba5cad60c3f22dfd7f912c85784ab8640892b44c Mon Sep 17 00:00:00 2001 From: Vishnya Date: Wed, 29 May 2019 13:30:05 +0300 Subject: [PATCH 14/14] modified 6_kuy --- tasks/6_kyu.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tasks/6_kyu.js b/tasks/6_kyu.js index a923ed0..7e549b1 100644 --- a/tasks/6_kyu.js +++ b/tasks/6_kyu.js @@ -1,22 +1,16 @@ define(function () { return { interp: function (f, l, u, n) { - + let arr = []; let d = (u - l) / n; - for(let i = 0;i <= (l < u);i++) { - if (n > 0) { - let arr = []; - arr.push(Math.floor(l * 100) / 100); - arr.push(Math.floor((l + d)*100)/ 100); - arr.push(Math.floor(((l + d) + (l + d))*100) / 100); - arr.push(Math.floor((u - d)*100) / 100); - return arr; - } - + for(let i =0;i < n;i++){ + arr.push(Math.floor(f(l)* 100)/100); + l = d + l; + } - + return arr; } } -}) +});