UNPKG

xchess

Version:

Chess Engine

189 lines (139 loc) 2.41 kB
export {StateHandler} class StateHandler { #target; constructor(target){ this.#target = target; } // State get game(){ return this.#target.game; } get next(){ const next = this.#target.next; if(next) return next.handler; return null; } get prev(){ const prev = this.#target.prev; if(prev) return prev.handler; return null; } get isCurrent(){ return this === this.#target.context.current; } // Config get time(){ return this.#target.time; } get color(){ return this.#target.color; } get count(){ return this.#target.count; } get fullmoveNumber(){ return this.#target.fullmoveNumber; } get halfmoveClock(){ return this.#target.halfmoveClock; } get doubleMovePawn(){ return this.#target.doubleMovePawn; } get enPassantTarget(){ return this.#target.enPassantTarget; } get wk(){ return this.#target.wk; } get wq(){ return this.#target.wq; } get bk(){ return this.#target.bk; } get bq(){ return this.#target.bq; } get move(){ return this.#target.lastMove; } get isCheck(){ return this.#target.isCheck; } get checkKing(){ return this.#target.checkKing; } get checkKingTarget(){ return this.#target.checkKingTarget; } get hash(){ return this.#target.hash; } get repetition(){ return this.#target.repetition; } get ownRepetition(){ return this.#target.ownRepetition; } get newRepetition(){ return this.#target.newRepetition; } // Stat get status(){ return this.#target.status; } get isProxy(){ return this.#target.isProxy; } get isSetup(){ return this.#target.isSetup; } get isMovement(){ return this.#target.isMovement; } get isPromotion(){ return this.#target.isPromotion; } get isDrawOffer(){ return this.#target.isDrawOffer; } get isEnd(){ return this.#target.isEnd; } get isWin(){ return this.#target.isWin; } get isDraw(){ return this.#target.isDraw; } get isImmediate(){ return this.#target.isImmediate; } get isCheckmate(){ return this.#target.isCheckmate; } get isStalemate(){ return this.#target.isStalemate; } get winner(){ return this.#target.winner; } get loser(){ return this.#target.loser; } get subject(){ return this.#target.subject; } get result(){ return this.#target.result; } // I/O get fen(){ return this.#target.fen; } // Log goto(){ this.game.goto(this.count); } }