1.0.1 • Published 2 years ago

@rafapaezbas/chess-cli v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Chess-cli

Javascript chess cli.

♟ ♜ ♞ ♝ ♛ ♚

chess board

npm install -g @rafapaezbas/chess-cli
chess-cli

How to play.

Control the cursor with arrows. Select piece with return key.

Api

const Chess = require('@rafapaezbas/chess-cli')
const chess = new Chess()

getPosition(fen = false)

const jsonPosition = chess.getPosition()
const fenPosition = chess.getPosition(true)

move({ src, dst })

chess.getPosition({ src:12, dst:28 }) // e4

moveIsLegal({ src, dst })

// inital position
const isLegal = chess.moveIsLegal({ src:12, dst:28 }) // true

start()

Starts key controls and rules of movements to cursor control.

chess.start()