A
A
Artyom Kalinin2019-03-04 19:27:00
JavaScript
Artyom Kalinin, 2019-03-04 19:27:00

How to create chess using javascript?

I am a chess lover, and I also study javascript and I would like to make simple chess as my project, there is no talk about the game mode on the Internet. I have no idea how to implement this.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Talyan, 2019-03-04
@flapflapjack

Matrix 8x8.
Each figure is a class.
When you tell the figure where to go, the check() method of the figure is called - it checks whether it is possible to go there, whether your figure is at the end of the path. Etc., is it the end of the field. After - the go() method - if there is an enemy figure on the way - eat() if empty, then nothing.
Also, each time after the move, call the check is_shah is_pat and is_mat.
You just have to google the terms from my answer that are incomprehensible to you, and - profit.

D
Denis Ineshin, 2019-03-04
@IonDen

First, make a hot-sit mode, this is when 2 people play at the same computer in turn.
This will make it easier to get started.

I
Ivan Filatov, 2019-03-04
@NYMEZIDE

https://github.com/lhartikk/simple-chess-ai + https://jsfiddle.net/q76uzxwe/1/
https://github.com/oakmac/chessboardjs
https://github.com/jhlywa/chess .js
, here are some examples of how to implement chess in javascript. You can study.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question