GithubHelp home page GithubHelp logo

chess's People

Contributors

herzogian avatar kerryboyko avatar

Forkers

kerryboyko

chess'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

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

  1. any move that results in the moving player's king being checked or remaining in check is invalid
  2. any move that results in the non-moving player's king being placed in check records it in the game state
  3. if a player is in check, they must move out of check (this is a special case of 1)

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.