Slightly less buggish Paco-Sako
authorBenjamin Auder <benjamin.auder@somewhere>
Sun, 3 Jan 2021 15:20:31 +0000 (16:20 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sun, 3 Jan 2021 15:20:31 +0000 (16:20 +0100)
client/src/base_rules.js
client/src/translations/rules/Pacosako/en.pug
client/src/translations/rules/Pacosako/es.pug
client/src/translations/rules/Pacosako/fr.pug
client/src/translations/variants/es.pug
client/src/translations/variants/fr.pug
client/src/variants/Pacosako.js

index e91a43e..770561b 100644 (file)
@@ -1071,6 +1071,7 @@ export const ChessRules = class ChessRules {
       }
       if (
         V.OnBoard(rx, ry) &&
       }
       if (
         V.OnBoard(rx, ry) &&
+        this.board[rx][ry] != V.EMPTY &&
         this.getPiece(rx, ry) == piece &&
         this.getColor(rx, ry) == color
       ) {
         this.getPiece(rx, ry) == piece &&
         this.getColor(rx, ry) == color
       ) {
index 6fe1bc1..371b00b 100644 (file)
@@ -8,6 +8,6 @@ p
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
-  | , and the associated
+  | , and the associated 
   a(href="http://pacoplay.com/") playing area
   | .
   a(href="http://pacoplay.com/") playing area
   | .
index 6fe1bc1..371b00b 100644 (file)
@@ -8,6 +8,6 @@ p
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
-  | , and the associated
+  | , and the associated 
   a(href="http://pacoplay.com/") playing area
   | .
   a(href="http://pacoplay.com/") playing area
   | .
index 6fe1bc1..371b00b 100644 (file)
@@ -8,6 +8,6 @@ p
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
   a(href="https://www.youtube.com/watch?v=tQ2JLsFvfxI") Video
   | &nbsp;showing gameplay. See also 
   a(href="http://pacosako.com/") the main website
-  | , and the associated
+  | , and the associated 
   a(href="http://pacoplay.com/") playing area
   | .
   a(href="http://pacoplay.com/") playing area
   | .
index 97e528d..0f7ac86 100644 (file)
@@ -411,6 +411,7 @@ p.
     "Gridolina",
     "Hamilton",
     "Magnetic",
     "Gridolina",
     "Hamilton",
     "Magnetic",
+    "Pacosako",
     "Parachute",
     "Takenmake",
     "Titan",
     "Parachute",
     "Takenmake",
     "Titan",
index 950700d..53fcc16 100644 (file)
@@ -410,6 +410,7 @@ p.
     "Gridolina",
     "Hamilton",
     "Magnetic",
     "Gridolina",
     "Hamilton",
     "Magnetic",
+    "Pacosako",
     "Parachute",
     "Takenmake",
     "Titan",
     "Parachute",
     "Takenmake",
     "Titan",
index 430cfb0..e935240 100644 (file)
@@ -120,9 +120,6 @@ export class PacosakoRules extends ChessRules {
 
   getPiece(i, j, color) {
     const p = this.board[i][j].charAt(1);
 
   getPiece(i, j, color) {
     const p = this.board[i][j].charAt(1);
-
-console.log(p);
-
     if (ChessRules.PIECES.includes(p)) return p;
     const c = this.board[i][j].charAt(0);
     // NOTE: this.turn == HACK, but should work...
     if (ChessRules.PIECES.includes(p)) return p;
     const c = this.board[i][j].charAt(0);
     // NOTE: this.turn == HACK, but should work...
@@ -288,6 +285,7 @@ console.log(p);
       this.lastMoveEnd.push(Object.assign({}, move.end, { p: released }));
     }
     V.PlayOnBoard(this.board, move);
       this.lastMoveEnd.push(Object.assign({}, move.end, { p: released }));
     }
     V.PlayOnBoard(this.board, move);
+    this.postPlay(move);
   }
 
   undo(move) {
   }
 
   undo(move) {
@@ -298,6 +296,7 @@ console.log(p);
       this.turn = V.GetOppCol(this.turn);
       this.movesCount--;
     }
       this.turn = V.GetOppCol(this.turn);
       this.movesCount--;
     }
+    this.postUndo(move);
   }
 
   getCurrentScore() {
   }
 
   getCurrentScore() {