From b0d55a053a319e1972c52a3c851dff787f52e015 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 17 Nov 2020 11:57:38 +0100
Subject: [PATCH] Early draft of TitanChess

---
 client/src/variants/Titan.js | 50 ++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 client/src/variants/Titan.js

diff --git a/client/src/variants/Titan.js b/client/src/variants/Titan.js
new file mode 100644
index 00000000..9e147cd3
--- /dev/null
+++ b/client/src/variants/Titan.js
@@ -0,0 +1,50 @@
+import { ChessRules } from "@/base_rules";
+
+export class TitanRules extends ChessRules {
+  // Idea: yellow = bishop, orange = knight (for white)
+  // and, red = bishop + purple = knight (black side)
+  // (avoid using a bigger board, or complicated drawings)
+
+  // TODO: decode if piece + bishop or knight
+  getPiece() {}
+
+  // Code: a/c = bishop + knight/bishop j/l for king,
+  // m/o for knight, s/t for queen, u/v for rook
+  static get AUGMENTED_PIECES() {
+    return {
+      // ...
+    };
+  }
+  // or:
+  getExtraPiece(symbol) {
+    // TODO: switch ... case ... return b or n
+  }
+
+  // TODO: hook after any move from 1st rank,
+  // if piece not in usual list, bishop or knight appears.
+  getPotentialMovesFrom(sq) {
+    let moves = super.getPotentialMovesFrom(sq);
+    const color = this.turn;
+    if (
+      !ChessRules.PIECES.includes(this.board[sq[0]][sq[1]][1]) &&
+      ((color == 'w' && sq[0] == 7) || (color == "b" && sq[0] == 0))
+    ) {
+      // (or lookup table)
+      const newPiece = this.getExtraPiece(this.board[sq[0]][sq[1]][1])
+      moves.forEach(m => {
+        m.appear.push(
+          new PiPo({
+            p: newPiece,
+            c: color,
+            x: sq[0],
+            y: sq[1]
+          })
+        );
+      });
+    }
+    return moves;
+  }
+
+  // TODO: special case of move 1 = choose squares, knight first, then bishop
+  // (just click ?)
+};
-- 
2.44.0