diff --git a/basket.js b/basket.js
new file mode 100644
index 0000000..dada1e2
--- /dev/null
+++ b/basket.js
@@ -0,0 +1,20 @@
+let basket = {
+ goodlist: [],
+
+ countTotalPrice() {
+ var priceSum = 0;
+ for (i in this.goodlist) {
+ let finalPrice = this.goodlist[i].price * this.goodlist[i].amount;
+ priceSum += finalPrice;
+ }
+ return priceSum;
+ },
+
+ countTotalNumber() {
+ let totalNum = 0;
+ for (i in this.goodlist) {
+ totalNum += this.goodlist[i].amount;
+ }
+ return totalNum;
+ }
+}
diff --git a/code.js b/code.js
new file mode 100644
index 0000000..ce90bb8
--- /dev/null
+++ b/code.js
@@ -0,0 +1,4 @@
+
+console.log(basket);
+console.log(basket.countTotalNumber());
+console.log(basket.countTotalPrice());
diff --git a/goods.js b/goods.js
new file mode 100644
index 0000000..94d709a
--- /dev/null
+++ b/goods.js
@@ -0,0 +1,66 @@
+let goods = [
+ {
+ name: 'лампа',
+ price: 1200,
+ amount: 4,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'диван',
+ price: 25000,
+ amount: 1,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'тумба',
+ price: 4500,
+ amount: 2,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'зеркало',
+ price: 5000,
+ amount: 4,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'шкаф',
+ price: 35000,
+ amount: 1,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'туалетный столик',
+ price: 7000,
+ amount: 2,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ },
+ {
+ name: 'пуфик',
+ price: 2000,
+ amount: 2,
+ putToBasket() {
+ basket.goodlist.push(this);
+ }
+ }
+]
+goods.forEach(function(item, i) {
+ if (i % 2 == 0) {
+ item.putToBasket();
+ } else {
+ item.putToBasket();
+ item.putToBasket();
+ }
+});
diff --git a/hw4-1.html b/hw4-1.html
new file mode 100644
index 0000000..e651947
--- /dev/null
+++ b/hw4-1.html
@@ -0,0 +1,25 @@
+
+
+
diff --git a/hw4-2_main.html b/hw4-2_main.html
new file mode 100644
index 0000000..0ac192e
--- /dev/null
+++ b/hw4-2_main.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
diff --git a/hw4-3_code.js b/hw4-3_code.js
new file mode 100644
index 0000000..3e8791d
--- /dev/null
+++ b/hw4-3_code.js
@@ -0,0 +1,28 @@
+let game = {
+
+ run() {
+ while(true) {
+ let direction = prompt('Введите направление: 2, 8, 4, 6');
+ if (direction === null) {
+ console.log('Игра окончена');
+ return;
+ }
+
+ let nextPoint = mover.getNextPoint(direction);
+ renderer.clear();
+ player.move(nextPoint);
+ renderer.render();
+
+ }
+ },
+
+ init() {
+ console.log('Для начала игры введите команду game.run()');
+ renderer.render();
+ },
+
+};
+
+
+
+game.init();
diff --git a/hw4-3_config.js b/hw4-3_config.js
new file mode 100644
index 0000000..c701297
--- /dev/null
+++ b/hw4-3_config.js
@@ -0,0 +1,5 @@
+
+let config = {
+ nRows: 10,
+ nColemns: 10
+};
diff --git a/hw4-3_index.html b/hw4-3_index.html
new file mode 100644
index 0000000..cb15eb7
--- /dev/null
+++ b/hw4-3_index.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
diff --git a/hw4-3_mover.js b/hw4-3_mover.js
new file mode 100644
index 0000000..eb25222
--- /dev/null
+++ b/hw4-3_mover.js
@@ -0,0 +1,76 @@
+let mover = {
+ getNextPoint(direction) {
+ let nextPoint = {
+ x: player.x,
+ y: player.y
+ }
+
+ switch (direction) {
+ case '2':
+ if (player.y == 0) {
+ nextPoint.y;
+ } else {
+ nextPoint.y--;
+ }
+ break;
+ case '6':
+ if (player.x == 9) {
+ nextPoint.x;
+ } else {
+ nextPoint.x++;
+ }
+ break;
+ case '8':
+ if (player.y == 9) {
+ nextPoint.y;
+ } else {
+ nextPoint.y++;
+ }
+ break;
+ case '4':
+ if (player.x == 0) {
+ nextPoint.x;
+ } else {
+ nextPoint.x--;
+ }
+ break;
+ case '3':
+ if (player.y == 0 || player.x == 9) {
+ nextPoint.x;
+ nextPoint.y;
+ } else {
+ nextPoint.x++;
+ nextPoint.y--;
+ }
+ break;
+ case '1':
+ if (player.x == 0 || player.y == 0) {
+ nextPoint.x;
+ nextPoint.y;
+ } else {
+ nextPoint.x--;
+ nextPoint.y--;
+ }
+ break;
+ case '7':
+ if (player.x == 0 || player.y == 9) {
+ nextPoint.x;
+ nextPoint.y;
+ } else {
+ nextPoint.x--;
+ nextPoint.y++;
+ }
+ break;
+ case '9':
+ if (player.x == 9 || player.y == 9) {
+ nextPoint.x;
+ nextPoint.y;
+ } else {
+ nextPoint.x++;
+ nextPoint.y++;
+ }
+ break;
+ }
+ return nextPoint;
+ }
+};
diff --git a/hw4-3_player.js b/hw4-3_player.js
new file mode 100644
index 0000000..a5e0410
--- /dev/null
+++ b/hw4-3_player.js
@@ -0,0 +1,10 @@
+let player = {
+ x: 0,
+ y: 0,
+
+ move(nextPoint) {
+ this.x = nextPoint.x;
+ this.y = nextPoint.y;
+ }
+};
+
diff --git a/hw4-3_renderer.js b/hw4-3_renderer.js
new file mode 100644
index 0000000..d67faf9
--- /dev/null
+++ b/hw4-3_renderer.js
@@ -0,0 +1,33 @@
+/**
+ * Объект отрисовки карты
+ */
+
+
+let renderer = {
+ map: '',
+ /**
+ * Метод отрисовки карты
+ */
+ render() {
+
+ for(let i = 0; i < config.nRows; i++) {
+ for(let j = 0; j < config.nColemns; j++) {
+ if (player.x == j && player.y == i) {
+ this.map += 'o';
+ } else {
+ this.map += 'x';
+ }
+
+ }
+ this.map += '\n';
+ }
+
+
+ console.log(this.map);
+ },
+
+ clear() {
+ console.clear();
+ this.map = '';
+ }
+};