removed accidentally created submodule, broke everything up into JS modules, put CSS in its own file. create game and update state from FEN-formatted strings. also implemented serialization to FEN

This commit is contained in:
2022-02-07 13:51:38 +01:00
parent 6d1cac8231
commit 3f847b2eee
6 changed files with 231 additions and 66 deletions

20
constants.js Normal file
View File

@@ -0,0 +1,20 @@
export const LETTER_PIECE_NAME_LOOKUP = {}
export const PIECE_NAME_LETTER_LOOKUP = {}
for (const [letter, name] of Object.entries({
r: 'rook',
b: 'bishop',
q: 'queen',
k: 'king',
p: 'pawn',
n: 'knight',
})) {
LETTER_PIECE_NAME_LOOKUP[letter] = `black-${name}`
LETTER_PIECE_NAME_LOOKUP[letter.toUpperCase()] = `white-${name}`
PIECE_NAME_LETTER_LOOKUP[`black-${name}`] = letter
PIECE_NAME_LETTER_LOOKUP[`white-${name}`] = letter.toUpperCase()
}
export const files = Array.from("abcdefgh")
export const STARTING_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"