Comments (2)
Hi. This is solved with very few lines of code in the move validation example.
You can simply execute a "setPosition" after entering the move.
if (result) {
this.chessboard.state.moveInputProcess.then(() => { // wait for the move input process has finished
this.chessboard.setPosition(chess.fen(), true).then(() => { // update position, maybe castled and wait for animation has finished
makeEngineMove(event.chessboard)
})
})
}
You could also take a look at the "Playfield" extension, where the move validation and more is implemented in a more sophisticated (but also a bit more complicated) way.
from cm-chessboard.
Thanks, I'll give that a try.
from cm-chessboard.
Related Issues (20)
- Absolute URLs to SVGs (pieces/markers/arrows) HOT 4
- Optimise turning the board to allow multiple turnings in the queue.
- Highlight square HOT 2
- Arrows extension HOT 8
- Arrows sometimes display wrong HOT 4
- Error on rendering the board HOT 3
- showPromotionDialog() always cancels HOT 2
- Implementation of premoves HOT 3
- Would it be possible to update the readme file? HOT 4
- 2 Player on same PC HOT 4
- Example code for local play HOT 2
- Error when changing fen position while creating it. HOT 1
- setPosition for new Chess()? HOT 3
- Add a WebSocket example to the demo HOT 4
- Add entry point index.js HOT 5
- Is there a drag & drop to place pieces on the board? HOT 3
- Is there an option to disable "tap & go" and require "drag & drop" to move a piece? HOT 2
- Capablanca chessboard implementation HOT 2
- How to fetch the marked squares
- Implementation of fairy chess pieces
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cm-chessboard.