Source: game_state.js

import SquareSet from './square_set'
import Hand from './hand'

/** A Shogi Game State */
class GameState {
  /**
   * Create a game state.
   * @param {Object} args - The properties of the game state.
   * @param {number} args.current_player_number - The number of the current player.
   * @param {Object[]} args.squares - An array of square properties
   * @param {Object[]) args.hands - The hands of each player.
   */
  constructor(args) {
    /** @member {number} */
    this.currentPlayerNumber = args.current_player_number;

    /** @member {SquareSet} */
    this.squares = new SquareSet({squares: args.squares});

    /** @member {Hand[]} */
    this.hands = args.hands.map(function(m) { return new Hand(m); });  
  }

  /**
   * The game state serialized as simple objects.
   * @return {Object}
   */
  get asJson() {
    return {
      current_player_number: this.currentPlayerNumber,
      squares: this.squares.asJson().squares,
      hands: this.hands.map(function(h) { return h.asJson; })
    };
  }

  /**
   * The square that's selected.
   * @return {(Square|null)}
   */
  get selectedSquare() {
    return this.squares.selected();
  }

  findSquare(id) {

  }

  playersTurn(playerNumber) {

  }

  capturedSquare(from, to) {

  }

  capturedSquareId(from, to) {

  }

  pieceMovedToPromotionZone(from, to) {

  }

  inCheckmate(playerNumber) {

  }

  inCheck(playerNumber) {

  }

  nonOuPiecesCannotMove(playerNumber) {

  }

  ouCannotMove(playerNumber) {

  }

  get winner() {

  }

  get dup() {

  }

  opponentOf(playerNumber) {

  }

  get opponent() {

  }

  performMove(from, to, captured) {

  }

  move(fromId, toId) {

  }

  drop(pieceId, squareId) {

  }

  selectPiece(squareId) {

  }

  deselectPiece(squareId) {

  }

  promote(squareId) {

  }

  passTurn() {

  }
}

export default GameState