diff --git a/src/backend.js b/src/backend.js index 28f72c8..eb5bf58 100644 --- a/src/backend.js +++ b/src/backend.js @@ -1,4 +1,4 @@ -const { Piece } = require('./logic') +const { Piece, startingBoard } = require('./logic') const BLACK = 0; const WHITE = 1; @@ -27,22 +27,10 @@ function settingText(setting) { } } -function range(n) { - return Array.from(Array(n).keys()); -} - -function imageFromPiece(piece) { - if (piece && piece.type >= 0) { - const image = piece.color === WHITE ? piece.type : piece.type + 6; - return Images[image]; - } - return null; -} - class Board { constructor(props) { this.state = props?.text ? - this.stateFromText(props.text) : this.originalState(); + this.stateFromText(props.text) : startingBoard(); } setHand(hand) {