cosinekitty / flywheel Goto Github PK
View Code? Open in Web Editor NEWA chess engine for the web browser
License: MIT License
A chess engine for the web browser
License: MIT License
Pressing the Play button should cause the computer to take over the player whose turn to move it is. Pressing Play should always make the current side be a computer player and the remaining side be a human player. When the computer is thinking, the Play button should change to a Pause button. If Pause is pressed, both players should revert to human players.
Using undo/redo buttons should set back to human-vs-human; otherwise computer will start thinking during undo/redo!
Given a board position and a legal move, generate the Portable Game Notation (PGN) string for it.
Client code (e.g. FlyWorker) should be able to pass callback function that receives updates with the current search status, including best path, node counters, etc. FlyWorker can in turn post messages back to the main thread for updating the UI.
Generate FEN for a given position.
After selecting the source square of a move, the demo must make it easier to cancel the move. One major problem is that currently, clicking back on the same source square does not cancel the move. Any illegal move, including source-source, should work to cancel the move! Also consider some other way to explicitly abort a move (press ESC? click on some cancel icon?)
Initializing with FEN means the reported ply number is not the same as moveStack.length
, so will need to fix all those existing assumptions first.
Ambiguity in NumTurnsPlayed() between how many moves can be popped (moveStack.length) and half-move clock for assessing draws.
When the game ends, the score (e.g. "1-0" or "1/2-1/2") should be superimposed on the board.
After clicking on a piece or while dragging it, the piece bitmap should move around with the mouse. When dropped on a legal square, the piece should snap to that location. When moved to an illegal destination, the piece should sprite-slide back to its origin.
Board.CurrentPlayerCanMove() currently generates a list of all legal moves just to find out whether there are any legal moves. Later, the AI will benefit greatly from a faster implementation that returns true after finding any legal move.
No more throwing strings! Need to make all exceptions uniformly handled as nice error objects that hold stack traces, are classifiable by their types, etc.
Search should terminate within 10 milliseconds of time expiration, unless level 1 search has not yet completed, in which case it should be allowed to complete to find a decent move.
Should be able to select from time limit or search depth limit uniformly in either MateSearch or Search.
Choosing between time limit and max depth limit should be orthogonal to what kind of search is being performed (should be separate function calls).
Repro steps:
It is in AnimateMove():
var image = <HTMLElement> coords.source.squareDiv.children[0];
image.style.position = 'absolute';
To prevent unintended side-effects, it would be wise to avoid exposing any internal state in a mutable way to callers (at least ones that use TypeScript -- can't stop all the monkey-patchers out there). Moves pushed onto board.moveStack should be copies of the ones handed back to callers. Likewise, there needs to be a way to clone a chess board so that changes made to it have no effect on the original board object.
Display board graphically.
Allow user to click, touch, or drag pieces to move them.
Prompt for promotion piece.
Reject illegal moves.
Provide command for letting the computer think.
Rotate board.
When the user promotes a pawn in the demo, it should present a menu of 4 pieces (same color as the player): Queen, Rook, Bishop, Knight. User should click on one of these to choose the promotion piece, or a Cancel icon to abort the move. The mouse should start out positioned above the Queen option because it is the most likely choice.
Currently the demo allows moving pieces only by single-clicking on the piece to be moved, then clicking on the target square. It should also allow moving pieces by dragging the piece (holding down the mouse and releasing it on the target square).
Make the unit tests unambiguously pass/fail with big green (pass) or red (fail) marker at bottom of screen. Maybe nice green check box or red X (for color-blind people).
Demo should use Vanilla JS only.
Demo app loads on iPhone but when I press Play button, the computer never finishes its move. Should test using Safari on Mac also.
If all top-level moves lead to a forced loss, pick whichever one postpones the loss the longest (has the best score) and terminate the search immediately.
Otherwise (if at least one move is not yet a forced loss), remove all forced-loss moves from the top-level move list to avoid re-thinking them at deeper levels.
Any time there is exactly one move remaining in the top-level list, immediately choose it. (This handles the case where there is exactly one legal move.)
Will need to implement PGN generator first.
When the computer makes a move, animate it. Afterward, leave the source and target squares subtly highlighted somehow (perhaps draw a border around them).
Create a function board.GameResult() that returns data indicating whether the game is over. If so, it should also indicate whether White won, Black won, or the game is a draw. If the game is a draw, should indicate which kind of draw it is:
Moves in the array should be cloned, to prevent unintended side-effects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.