A sample Scala project counting the number of possible placements of a number of chess pieces (pawns excluded) on a chessboard of given dimensions.
sbt in version not lesser than 0.13 (available here). Others may work, but that's not been tested.
Java 7 or higher.
Calling sbt test
(i.e. running the test code) assumes /dev/null
is available.
Calling sbt run
in the root directory of the project causes all unresolved dependencies to be fetched, compiles the sources and runs the program.
Upon start, the program will ask for arguments by printing requests to standard output (e.g. Number of columns:
).
The appropriate argument is to be input to standard input followed by a newline character.
Afterwards, it will ask for the output path for the computed placements (to be provided the same way). It is required the filepath references the location of a writable/creatable file.
After calculations are done, the program will return the number of possible placements to standard output, and the found placements will be written down in the file.