Coder Social home page Coder Social logo

es6-chess's People

Contributors

tagraves avatar

Stargazers

 avatar

Watchers

 avatar  avatar

es6-chess's Issues

Build test suite

It makes sense to build an extensive test suite. The test suite should send pieces through a preset list of moves that cover every possibility and impossibility.

Use Karma or QUnit.

Ambiguous piece reference

In some cases, algebraic notation is ambiguous - e.g. there are some cases where two rooks can move to the same spot, so Re8 doesn't convey enough information. The game should specify which rook is moving in these cases (e.g. Rfe8), but it currently doesn't.

Refactor notation and move logic

Notation is all over the place in the code; this should be moved into a controller Notation.js that gets called by the View when it needs to update the notation pane.

Also, moves are not really being tracked - pieces just have a lot of unnecessary properties that indicate what the previous move was. Why not add a Move class that tracks all of this logic (and stores each move's notation, etc.)? This will eliminate, for example, the justMovedTwo property of pieces - instead, the game will just check the last move and see if it was a Pawn moving two.

Refactor DOM updating

As it is now, we have to manually specify how the DOM should be updated whenever we perform an update. Instead, we should create a representation DOM (ala React) using ES6 maps and have a View.updateDOM() method that checks for changes in the representation and updates accordingly.

Add logic for promoting pawns

As it stands now, pawns cannot promote.

class Pawn {
  this.promote = function (pieceType) {
    let piece = new pieceType(this.location, this.owner);
    //then what?
  }
}

Have location.occupant and piece.location watch each other

As it is now, all of the functions that change one of these also change the other. But why not use a setter to make them watch each other?

class Location {
  set occupant (piece) {
    this.occupant = piece;
    piece.location = this;
  }
}
class Piece {
  set location (location) {
    this.location = location;
    location.occupant = this;
  }
}

This may fail testing at the moment because of the en passant method which does some tricky stuff.

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.