chess's People
Forkers
kerryboykochess's Issues
Checkmate
If a move causes check, and there's no way to get out of check, it is checkmate
cleanup / remove unused files
- remove
Chess-v0.0.1.tgz
- remove all files under
js/lib
other than 'validate.js', 'utilities.js', 'update.js' (all others are unused)
Better ad-hoc testing approach
Find a better approach of ad-hoc unit testing. The current approach doesn't tell you if the move should succeed, only that it does. It's also painfully verbose per-test:
if (move('C4', 'E3')) {
console.log('moved')
} else {
console.log('move failed')
};
Firstly, throwing an Error when there's an error is good practice, and you don't really need to see that it's succeeded on every run, so something like this would be good:
if (!move('C4', 'E3')) {
throw Error('[SHOULD_BE_VALID] moving C4 to E3 should be valid')
}
Think about how to run these tests in the DRYest way possible
King moves/captures
can move/capture one square in any direction
Castling
- triggered by moving an unmoved king two squares towards an unmoved rook
- no pieces can be in the way
- the king cannot move through check (make sure no enemy pieces attack the intermediate square)
Check management
- any move that results in the moving player's king being checked or remaining in check is invalid
- any move that results in the non-moving player's king being placed in check records it in the game state
- if a player is in check, they must move out of check (this is a special case of 1)
Basic Stalemate
If a player is not in check, but has no legal moves, the game is a draw
Leave the full set of stalemate conditions for later
Linear moves/captures (bishops, rooks, queens)
- Bishops and queens can move diagonally
- Rooks and queens can move horizontally and vertically
- cannot pass through pieces
Pawn moves/captures
- can move forward one empty square at a time
- can capture diagonally
- first move can be two squares
- can en passant
Queening
- triggers when a pawn reaches the opponents back rank
- the transform is specified by
=Q
appended to the target square notation - the pawn is replaced with the selected piece
Knight moves/captures
- move in a 2-to-1 L shape
- can jump other 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.