🏡 index : github.com/captn3m0/okiya.git

author Nemo <me@captnemo.in> 2020-05-27 0:57:54.0 +05:30:00
committer Nemo <me@captnemo.in> 2020-05-27 0:57:54.0 +05:30:00
commit
60e6a89ccfff5e3db482e4bb1a96e31b75830c95 [patch]
tree
573bb1c15083f484c5f327961ccdda43cbbbd9a0
parent
f437cd3041fb32d2dd03dcd3a241b7992b3bd9eb
download
60e6a89ccfff5e3db482e4bb1a96e31b75830c95.tar.gz

style fixes



Diff

 src/App.js    | 25 +++++++++++++------------
 src/board.css |  2 +-
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/App.js b/src/App.js
index a9b7886..49c4772 100644
--- a/src/App.js
+++ a/src/App.js
@@ -1,4 +1,4 @@
import { INVALID_MOVE } from 'boardgame.io/core';
import { INVALID_MOVE } from "boardgame.io/core";

// Return true if `cells` is in a winning configuration.
function IsVictory(cells) {
@@ -57,19 +57,17 @@
];

function validMove(cell, id, tile) {
  const borders = [
    0,1,2,3,4,7,8,11,12,13,14,15
  ];
  const borders = [0, 1, 2, 3, 4, 7, 8, 11, 12, 13, 14, 15];
  // If first move, only allow borders
  if (tile === null) {
    return borders.includes(id)
    return borders.includes(id);
  }
  // else match against the last played tile
  return (cell[0] === tile[0] || cell[1] === tile[1]);
  return cell[0] === tile[0] || cell[1] === tile[1];
}

function unclaimed(tile) {
  return !(tile===0||tile===1);
  return !(tile === 0 || tile === 1);
}
const Okiya = {
  turn: {
@@ -96,8 +94,7 @@
      if (unclaimed(G.cells[id]) && validMove(G.cells[id], id, G.lastPlayed)) {
        G.lastPlayed = G.cells[id];
        G.cells[id] = parseInt(ctx.currentPlayer, 10);
      }
      else {
      } else {
        return INVALID_MOVE;
      }
    },
@@ -108,8 +105,8 @@
      return { winner: ctx.currentPlayer };
    }

    if(G.cells.filter(unclaimed).length === 0) {
      return {draw: true}
    if (G.cells.filter(unclaimed).length === 0) {
      return { draw: true };
    }

    let numMoves = Okiya.ai.enumerate(G, ctx).length;
@@ -117,10 +114,10 @@
    if (numMoves === 0) {
      return {
        winner: ctx.currentPlayer,
        stalemate: true
      }
        stalemate: true,
      };
    }
  },
};

export default Okiya;
export default Okiya;
diff --git a/src/board.css b/src/board.css
index 22599d2..6b97c28 100644
--- a/src/board.css
+++ a/src/board.css
@@ -52,4 +52,4 @@
}
.board td[data-tile^="D"] {
	background-color: #e056fd;
}
}