A bit of reset() cleanup

This commit is contained in:
Sage Vaillancourt 2020-12-29 16:55:35 -05:00
parent bd8dec72d5
commit e59e1a68f5
1 changed files with 7 additions and 7 deletions

View File

@ -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;
}