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:
20
constants.js
Normal file
20
constants.js
Normal 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"
|
||||
Reference in New Issue
Block a user