This project is a study project, answering to a school assignment.
"What's the maximum of Queens that I can place on a 8x8 Chess Board without them being in conflict" ?
This Project is here to answer this question !
But not only :
- It will give you the answer to any official Chess Piece
- It will also give you the answer on a nxm grid (you specify the m & n —> m & n < 10.000)
- Note : the max n value should be tested in the next version.
The App class starts the Application. It has a small CLI that asks you for the main informations :
- Width of your grid
- Height of your grid
- The Chess Piece you want to use
- How many attempts (note that the more attemps you select, the more accurate your result will be)
- If you want to print the grid at the end (Y for yes, N for no)
Note, if you type "All" as amount of attemps, it will try all possibilities.
It will give a really accurate result but it will take a lot more time !
It will the solve the problem and print 3 informations :
- The max number of ChessPieces placed on the grid
- The time spend for the calculation in miliseconds
- The grid with the most optimal combination found during the process
The ChessBoard class has 3 main tasks :
- Handling the grid (setting and getting the value of each position)
- Asking the ChessPiece to apply it's pattern on the grid
- Printing the grid when it's the optimal grid found.
Note : this class implements IChessBoard, an Interface that imposes the methods needed by the ChessPiece to apply its pattern.
public interface IChessBoard
{
int getStatus (int row, int col);
void setStatus (int row, int col, int status);
}
The ChessPiece interface imposes the methods needed by the ChessPiece to apply its pattern.
public abstract class ChessPiece
{
public abstract void applyPattern (Object sender, int row, int col);
}
Here is the list of all the Chess Pieces implemented in this application :
Note : The Chess Pieces all extends the ChessPiece class. This way they all behave the same way.
Please check the TODO.md file in this repository to find out what updates are planned.
Only 3 libraries are used for this Maven QuickStart project
- Java8 : JDK 1.8.111
- Maven : JUnit 4.12
- Maven : hamcrest-core:1.3
Note : those libraries are already included in : org.jetbrains.idea.maven.model.MavenArchetype@88f75e0f