Another quick backend fix.
This commit is contained in:
parent
5b18d3c0eb
commit
6bdee0edc4
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue