Implement moving on engine

Thus make all state management the engine's responsibility, and remove
the state maintaining code from frontend!
This commit is contained in:
2021-12-14 21:56:27 +01:00
parent c49bedf0ad
commit a1207f2404
3 changed files with 15 additions and 37 deletions

View File

@@ -160,7 +160,7 @@ export class ConfigVis {
this.piecesVis = new Map();
}
draw(canvas) {
for (let [position, piece] of this.configuration.board) {
for (let [position, piece] of this.configuration) {
if (this.piecesVis.has(position)) {
if (this.piecesVis.get(position).piece == piece) {
continue;
@@ -175,7 +175,7 @@ export class ConfigVis {
this.piecesVis.set(position, pv);
}
for (let [position, pv] of this.piecesVis) {
if (!this.configuration.board.has(position)) {
if (!this.configuration.has(position)) {
pv.undraw();
this.piecesVis.delete(position);
}