Another quick backend fix.

This commit is contained in:
Sage Vaillancourt 2022-10-17 16:18:39 -04:00
parent 5b18d3c0eb
commit 6bdee0edc4
1 changed files with 2 additions and 14 deletions

View File

@ -1,4 +1,4 @@
const { Piece } = require('./logic') const { Piece, startingBoard } = require('./logic')
const BLACK = 0; const WHITE = 1; 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 { class Board {
constructor(props) { constructor(props) {
this.state = props?.text ? this.state = props?.text ?
this.stateFromText(props.text) : this.originalState(); this.stateFromText(props.text) : startingBoard();
} }
setHand(hand) { setHand(hand) {