2 Komitmen 73bf1482f5 ... 2317b76b63

Pembuat SHA1 Pesan Tanggal
  Dim Dim 2317b76b63 merge 6 tahun lalu
  Dim Dim a35dd54a50 before pull 6 tahun lalu
4 mengubah file dengan 159 tambahan dan 156 penghapusan
  1. 5 3
      .eslintrc.js
  2. 141 141
      package-lock.json
  3. 12 11
      src/Game/game/machine/GameMachine.js
  4. 1 1
      src/Game/game/machine/GameMoves.js

+ 5 - 3
.eslintrc.js

@@ -1,7 +1,8 @@
 module.exports = {
     "env": {
         "browser": true,
-        "es6": true
+        "es6": true,
+        "node": true
     },
     "extends": "eslint:recommended",
     "parserOptions": {
@@ -21,7 +22,7 @@ module.exports = {
         ],
         "linebreak-style": [
             "error",
-            "unix"
+            "windows"
         ],
         "quotes": [
             "error",
@@ -30,6 +31,7 @@ module.exports = {
         "semi": [
             "error",
             "always"
-        ]
+        ],
+        "no-console": 0
     }
 };

File diff ditekan karena terlalu besar
+ 141 - 141
package-lock.json


+ 12 - 11
src/Game/game/machine/GameMachine.js

@@ -1,5 +1,7 @@
 // var Card = require('./Card.js');
-var SHA256 = require("crypto-js/sha256");
+
+const SHA256 = require('crypto-js/sha256');
+
 // TODO test
 
 // Need to create an initialization move or something to get verified!
@@ -10,7 +12,7 @@ class GameMachine {
         this.state = {
             board: new Board(),
             players: [],
-            hash: "0123456789",
+            hash: '0123456789',
             stacks: {
                 moves: [],
                 hashes: []
@@ -38,8 +40,7 @@ class GameMachine {
     }
 
     save() {
-        let temp = { ...this.state, board: this.state.board.save() };
-        return temp;
+        return {...this.state, board: this.state.board.save()};
     }
 
     load(state) {
@@ -67,7 +68,7 @@ class GameMachine {
     getWinner() {
         const score1 = this.state.board.getScore(this.state.players[0]);
         const score2 = this.state.board.getScore(this.state.players[1]) + 1;
-        return  score1 == score2 ? -1 
+        return  score1 === score2 ? -1
             : (
                 score1 > score2
                     ? this.state.players[0]
@@ -114,7 +115,7 @@ class Board {
         // These 2 to be updated after every move
         this.triggerPaths = []; // like attackVectors
         this.plusPaths = []; // like attackVectors
-        for (var i=0; i < 9; i += 1) {
+        for (let i=0; i < 9; i += 1) {
             this.triggerPaths[i] = [];
             this.plusPaths[i] = {
                 winners: [],
@@ -133,7 +134,7 @@ class Board {
         console.log('Cards :');
         let s = '';
         for(let i=0,j=0;i<9;i+=1) {
-            s += `P${this.owners[i]}:${(this.data[i] ? this.data[i].attack.reduce((a,b) => a + b + "|", "|") : 'Empty')}\t`;
+            s += `P${this.owners[i]}:${(this.data[i] ? this.data[i].attack.reduce((a,b) => a + b + '|', '|') : 'Empty')}\t`;
             j += 1;
             if(j%3===0)s += '\n';
         }
@@ -153,7 +154,7 @@ class Board {
         console.log('---------------------------');
         s = '';
         for(let i=0,j=0;i<9;i+=1) {
-            s += `[${(this.plusPaths[i].winners.reduce((a,b) => a + b + '|', "|"))}]\t\t`;
+            s += `[${(this.plusPaths[i].winners.reduce((a,b) => a + b + '|', '|'))}]\t\t`;
             j += 1;
             if(j%3===0)s += '\n';
         }
@@ -195,7 +196,7 @@ class Board {
         case 1: return -3;  //return {x: 0, y:1};
         case 2: return -1;  //return {x: -1, y:0};
         case 3: return 3;   //return {x: 0, y:-1};
-        default: throw Error ("Cannot _getDisplacement of this value: " + j);
+        default: throw Error ('Cannot _getDisplacement of this value: ' + j);
         }
     }
 
@@ -271,7 +272,7 @@ class Board {
                 pluses[sum] = (pluses[sum] || 0) + 1;
             }
         }
-        for (var i in pluses) {
+        for (let i in pluses) {
             if (pluses[i] > 1) {
                 this.plusPaths[position].winners.push(parseInt(i, 10)); 
             }
@@ -287,7 +288,7 @@ class Board {
         return {
             data: this.data,
             owners: this.owners
-        }
+        };
     }
     load(state) {
         this.data = state.data;

+ 1 - 1
src/Game/game/machine/GameMoves.js

@@ -78,7 +78,7 @@ class RevealMove extends GameMove {
     }
 
     performMove() {
-        console.log("Reveal move processed");
+        console.log('Reveal move processed');
     }
 }
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini