format
This commit is contained in:
parent
1bd6e6dfea
commit
c157dc4ba1
|
@ -17,7 +17,7 @@ const assertFile = (maybeFile: string): FILE => {
|
|||
default:
|
||||
throw new Error("Invalid file");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const toRank = (maybeRank: string | number): RANK => {
|
||||
switch (maybeRank) {
|
||||
|
@ -48,7 +48,7 @@ const toRank = (maybeRank: string | number): RANK => {
|
|||
default:
|
||||
throw new Error("Invalid rank");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export type PieceState = {
|
||||
kind: PIECE;
|
||||
|
@ -92,12 +92,10 @@ const isSubset = (lhs: BoardState, rhs: BoardState): boolean => {
|
|||
return false;
|
||||
}
|
||||
|
||||
const samePiece = piece.kind === rhsPiece.kind && piece.color === rhsPiece.color;
|
||||
|
||||
return samePiece;
|
||||
return piece.kind === rhsPiece.kind && piece.color === rhsPiece.color;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default BoardState;
|
||||
export { opposite, isEqual, isSubset, };
|
||||
export { opposite, isEqual, isSubset };
|
||||
|
|
|
@ -17,7 +17,7 @@ export type MakeMove = (
|
|||
|
||||
export type PromotePawn = (
|
||||
location: Coordinates,
|
||||
kind: PIECE,
|
||||
kind: PIECE
|
||||
) => Promise<BoardState | null>;
|
||||
|
||||
export type Api = {
|
||||
|
@ -116,7 +116,10 @@ const makeMove = (baseUri: string): MakeMove => {
|
|||
};
|
||||
|
||||
const promotePawn = (baseUri: string): PromotePawn => {
|
||||
return async (location: Coordinates, kind: PIECE): Promise<BoardState | null> => {
|
||||
return async (
|
||||
location: Coordinates,
|
||||
kind: PIECE
|
||||
): Promise<BoardState | null> => {
|
||||
const promoteUri = `${baseUri}/promote`;
|
||||
|
||||
const payload = {
|
||||
|
@ -151,6 +154,6 @@ const promotePawn = (baseUri: string): PromotePawn => {
|
|||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export { init };
|
||||
|
|
Loading…
Reference in a new issue