- if (!by) {
- const oppCol = V.GetOppCol(color);
- // Look in all directions for a "color" piece
- for (let step of V.steps[V.KNIGHT]) {
- const xx = x + step[0],
- yy = y + step[1];
- if (
- V.OnBoard(xx, yy) &&
- this.getPiece(xx, yy) == V.KNIGHT &&
- this.getColor(xx, yy) == color
- ) {
- const px = x - step[0],
- py = y - step[1];
- if (V.OnBoard(px, py)) {
- if (this.board[px][py] == V.EMPTY) {
- const hash = "s" + px + py;
- if (!squares[hash]) {
- squares[hash] = true;
- Array.prototype.push.apply(
- moves,
- this.getActionMoves([x, y], [px, py], [xx, yy])
- );
- }
- else { //add piece doing action
- }
- }
- } else {
- const hash = "s" + xx + yy;
+ const oppCol = V.GetOppCol(color);
+ // Look in all directions for a "color" piece
+ for (let step of V.steps[V.KNIGHT]) {
+ const xx = x + step[0],
+ yy = y + step[1];
+ if (
+ V.OnBoard(xx, yy) &&
+ this.getPiece(xx, yy) == V.KNIGHT &&
+ this.getColor(xx, yy) == color
+ ) {
+ const px = x - step[0],
+ py = y - step[1];
+ if (V.OnBoard(px, py)) {
+ if (this.board[px][py] == V.EMPTY) {
+ const hash = "s" + px + py;