Javascript chess engine