Giter Club home page Giter Club logo

chess's People

Contributors

haoranyu avatar

Watchers

 avatar  avatar

Forkers

islamailani

chess's Issues

Modify iterativeAddPossiblePosition

  • I would break the function signature into two separate lines to improve readability
  • As mentioned in discussion section, it would be better if maxIteration were -1 if you want to add possible Positions until you reach the end of the board (this way you can resize the board and the function will still work).
  • How about "xDelta" instead of "toRight" and "yDelta" instead of "toUp". "toRight" gives me the impression that I should only go rightward.
  • For this reason, the line "position = new Position(position.getRight(toRight).getUp(toUp))" is also a bit unclear. Especially because you can "getLeft" by adding a negative value.
  • What if the Position class had a function "getRelativePosition( int xDelta, int yDelta)"?

Checkmate understanding is wrong

  • A player wins when the opponent is in check and has no moves available. Your code has it so that a player wins if they capture the king (which should never really happen).
  • Your code doesn't work; in particular, you don't prevent a player from moving a piece if that puts their own king in check.

showPossibleNextPosition enhancement

use the "for each" loop in java to iterate through a list. It will look like:

  • for( Position possibleNextPosition : this.possibleNextPositions)
  • This is because it conveys what is being done in a more clean manner, and involves less variables.

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.