Fix Dark enlightened array update
authorBenjamin Auder <benjamin.auder@somewhere>
Sun, 6 Jan 2019 12:13:30 +0000 (13:13 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sun, 6 Jan 2019 12:13:30 +0000 (13:13 +0100)
public/javascripts/variants/Dark.js

index f1bd6c0..79d27b5 100644 (file)
@@ -16,14 +16,20 @@ class DarkRules extends ChessRules
 
        updateEnlightened()
        {
-               const pawnShift = {"w":-1, "b":1};
-               // Initialize with pieces positions (which are seen)
                for (let i=0; i<V.size.x; i++)
                {
                        for (let j=0; j<V.size.y; j++)
                        {
                                this.enlightened["w"][i][j] = false;
                                this.enlightened["b"][i][j] = false;
+                       }
+               }
+               const pawnShift = {"w":-1, "b":1};
+               // Initialize with pieces positions (which are seen)
+               for (let i=0; i<V.size.x; i++)
+               {
+                       for (let j=0; j<V.size.y; j++)
+                       {
                                if (this.board[i][j] != V.EMPTY)
                                {
                                        const color = this.getColor(i,j);