Javascript Chess Engine