A chessboard module for board games in Linux command-line
Use
pip install chessboardCLI
to install it.
The full docs is provided here.
- Get the sign of an integer:
sign = lambda a: (a>0) - (a<0)
- In Python 3.4,
math.cos(math.pi/2) = xxx*e(-17)
, a value beyond zero - Coodinate rotation formula (ANTICLOCKWISE):
tx = (x - x0)*cos(theta) - (y - y0)*sin(theta) + x0
ty = (x - x0)*sin(theta) + (y - y0)*cos(theta) + y0