AlexBolot / ProblemeDesDames

This project is a study project, answering to a school assignment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chess Pieces Problem

Summary :

  1. About the project
    1. The goal
    2. How to use
  2. What to know about the classes
    1. ChessBoard
    2. ChessPiece
      1. The Chess Pieces
  3. Coming soon
  4. Libraries
  5. Author

1 - About the project

This project is a study project, answering to a school assignment.

1.1 - The goal

"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.

1.2 - How to use

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

2 - What to know about the classes

2.1 - ChessBoard

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);
}

2.2 - ChessPiece

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);
}

2.2.1 - The Chess Pieces

Here is the list of all the Chess Pieces implemented in this application :

ChessPiecePatterns

Note : The Chess Pieces all extends the ChessPiece class. This way they all behave the same way.

3 - Coming soon

Please check the TODO.md file in this repository to find out what updates are planned.

4 - Libraries

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

5 - Author

Alexandre BOLOT
My GitHub
My LinkedIn

About

This project is a study project, answering to a school assignment.

License:MIT License


Languages

Language:Java 100.0%