Further fix in Alice chess; still some issues
[vchess.git] / public / javascripts / components / game.js
index 170aeac..a7acc10 100644 (file)
@@ -412,7 +412,6 @@ Vue.component('my-game', {
                };
                const socketMessageListener = msg => {
                        const data = JSON.parse(msg.data);
-                       console.log("Receive message: " + data.code);
                        switch (data.code)
                        {
                                case "newgame": //opponent found
@@ -575,7 +574,9 @@ Vue.component('my-game', {
                        this.newGame("computer");
                },
                newGame: function(mode, fenInit, color, oppId, moves, continuation) {
-                       const fen = "brnbnkrq/pppppppp/8/8/8/8/PPPPPPPP/BNNRKBQR 11111111111111111111";//fenInit || VariantRules.GenRandInitFen();
+                       //const fen = "bbrkqnrn/pppppppp/8/8/8/8/PPPPPPPP/NNRKQBBR 1111";
+                       //const fen = "bbrkqnr1/pppppp1p/6o1/6s1/3SS3/8/PPP2PPP/NNRKQBBR 1111"; //first 2 moves == pb
+                       const fen = fenInit || VariantRules.GenRandInitFen();
                        console.log(fen); //DEBUG
                        this.score = "*";
                        if (mode=="human" && !oppId)
@@ -635,7 +636,8 @@ Vue.component('my-game', {
                        }
                        else //against computer
                        {
-                               this.mycolor = "w";//Math.random() < 0.5 ? 'w' : 'b';
+                               //this.mycolor = "w";
+                               this.mycolor = Math.random() < 0.5 ? 'w' : 'b';
                                if (this.mycolor == 'b')
                                        setTimeout(this.playComputerMove, 500);
                        }