A bit of reset() cleanup
This commit is contained in:
parent
bd8dec72d5
commit
e59e1a68f5
14
src/index.js
14
src/index.js
|
@ -62,7 +62,7 @@ function isKing(piece) {
|
|||
|
||||
function imageFromPiece(piece) {
|
||||
if (piece) {
|
||||
let image = piece.color === WHITE ? piece.type : piece.type + 6;
|
||||
const image = piece.color === WHITE ? piece.type : piece.type + 6;
|
||||
return Images[image];
|
||||
}
|
||||
return null;
|
||||
|
@ -88,7 +88,6 @@ class Piece {
|
|||
this.color = color;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Board extends React.Component {
|
||||
|
@ -133,11 +132,12 @@ class Board extends React.Component {
|
|||
new Piece(BLACK, KNIGHT),
|
||||
new Piece(BLACK, ROOK)
|
||||
];
|
||||
let squares = whiteRow;
|
||||
squares = squares.concat(Array(8).fill(new Piece(WHITE, PAWN)));
|
||||
squares = squares.concat(Array(32).fill(null));
|
||||
squares = squares.concat(Array(8).fill(new Piece(BLACK, PAWN)));
|
||||
squares = squares.concat(blackRow);
|
||||
let squares = whiteRow.concat(
|
||||
Array(8).fill(new Piece(WHITE, PAWN)),
|
||||
Array(32).fill(null),
|
||||
Array(8).fill(new Piece(BLACK, PAWN)),
|
||||
blackRow);
|
||||
|
||||
return squares;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue