oakmac / chessboardjs

JavaScript chessboard
https://chessboardjs.com
MIT License
2.01k stars 408 forks source link

Allow creating boards smaller than 8x8 #199

Open ivan444 opened 4 years ago

ivan444 commented 4 years ago

Enable create boards smaller than 8x8 for games similar to chess.

The behavior is controller by a config params:

numRows: int
numColumns: int

The code restricts it to a square board (forces numRows == numColumns). It's possible to create a non-squared board, but it's hard to test if it covers all use-cases. That's why I kept the restriction.

It easy to extend the code to support more than 8x8 rows and columns. But then you run into column & row naming issues (most of the code assumes they are a single character). Considering parseInt function, it should be somewhat trivial to extend it to up to 36 rows and many more columns (if you go above a-z column names).

Closes #198