Compare commits

..
3 changed files with 10 additions and 39 deletions

View file

@ -1,46 +1,17 @@
import { Game } from "./game";
import { Game } from "./utils";
export type GameListener = (board: Game) => void;
export enum MoveFlag {
NORMAL = 0,
PAWN_DOUBLE = 1,
EN_PASSANT = 2,
CASTLE_KING = 3,
CASTLE_QUEEN = 4,
PROMOTION = 5,
CAPTURE = 6,
CAPTURE_PROMOTE = 7,
}
export enum Promotion {
QUEEN = 0,
ROOK = 1,
BISHOP = 2,
KNIGHT = 3,
}
export enum Capture {
NONE = 0,
PAWN = 1,
KNIGHT = 2,
BISHOP = 3,
ROOK = 4,
QUEEN = 5,
}
export enum Piece {
// bit 0-2: piece type (0-6)
EMPTY = 0,
QUEEN = 1,
ROOK = 2,
BISHOP = 3,
KNIGHT = 4,
PAWN = 5,
KING = 6,
KING = 1,
QUEEN = 2,
ROOK = 3,
BISHOP = 4,
KNIGHT = 5,
PAWN = 6,
// bit 3: color (0-1)
WHITE = 0<<3,
BLACK = 1<<3,
WHITE = 8,
BLACK = 16,
}
export const CHAR_TO_PIECE: Record<string, number> = {

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { PIECE_TO_CHAR } from "$lib/chess/types";
import { boardToAscii, Game, startFEN } from "$lib/chess/game";
import { boardToAscii, Game, startFEN } from "$lib/chess/utils";
let showIndex = $state(false);
let fen = $state(startFEN);