First Artificial Intelligence System Project.
These instructions will install the system in your local machine.
-
Install Maven, if you haven't yet
brew install mavensudo apt-get install maven -
Clone the repository or download source code:
git clone https://github.com/juanmbellini/fill_zone.git
-
Change working directory to project root (i.e where pom.xml is located):
cd <project-root> -
Let maven resolve dependencies:
mvn dependency:resolve -
Create jar file
mvn clean package [-D dir=<destination-directory>]Note: If no destination was indicated, jar file will be under
<project-root>/target
The application can be executed running java -jar <path-to-jar>.
It can be configured in order to execute in different modes. This is done including parameters. The following sections will describe these modes.
You can display the usage message by setting the -h or the --help parameters.
Example of usage:
java -jar <path-to-jar> -h
To indicate the searching strategy, you must include the -S or the --strategy parameters, together with the selected strategy.
Options are:
dfsbfsiddfsiddfs-bordergreedyastar(Default option)
Example of usage:
java -jar <path-to-jar> --strategy greedy
In case greedy or astar are selected, an heuristic must be specified. You can do this with the -H or the --heuristic parameters, together with the selected strategy.
Options are:
remaining-groupsremaining-lockersremaining-colors(Default option)two-colorscombinedmax-admissible
Example of usage:
java -jar <path-to-jar> --strategy astar -H two-colors
There are three ways of indicating the type of board to be solved.
In case you want to create a random board, you must specify the -rB or the --random-board parameters, indicating rows, columns and colors with the following parameters:
- Rows:
-ror--rows(Default: 8) - Columns:
-cor--columns(Default: 8) - Colors:
-xor--colors(Default: 8)
This is the default option.
Example of usage:
java -jar <path-to-jar> --strategy dfs -random-board -r 7 -c 8 -x 10
In case you already have a board, and you want the system to load and solve it, you can specify the -fB or the --file-board parameters, indicating the path of the file with the -i or the --input parameters.
The default value is "Board.brd" saved in the current working directory.
Example of usage:
java -jar <path-to-jar> --strategy dfs -fB -i <path-of-file>
Note: The file must be a text file with the following format: line 1: [amount-of-rows] line 2: [amount-of-columns] line 3: [amount-of-colors] line 4: [blank-line] line 5: [row #1] line 6: [row #2] ... line 5 + [amount-of-rows] - 1 : [row #[amount-of-rows]]
The system already brings built-in boards that can be selected. This is done with the -sB or the --stored-board parameters, indicating the number of board with the -b or the --board-number parameters.
The default value is 6.
The amount of stored boards is 7.
Example of usage:
java -jar <path-to-jar> --strategy bfs -sB --board-number 7
The application implements to ways of giving the solution output.
You can print the solution directly to standard output (i.e the console). In order to do this, include the -cO or the --console parameters.
This is the default option.
If 10 or less colors are selected, the output will include real colors when printing the boards. Otherwise, just numbers will be printed.
Example of usage:
java -jar <path-to-jar> --strategy bfs --random-board -r 7 -c 8 -x 10 --console
In case you want to save the solution into a file, you must include the -fO or the --save parameters, indicating the output path with the -o or the --output parameters.
The default value is a file called "solution.txt" saved in the current working directory.
Example of usage:
java -jar <path-to-jar> --strategy bfs --sB -b 5 --save -o <path-of-solution-file>
- Juan Marcos Bellini
- Natalia Navas
- Francisco Bartolomé
- General Problem Solver Engine is based on https://github.com/apierri/GeneralProblemSolver project.