AxilleasGalanis / MimMax-Algorithm-App

MinMax algorithm with alpha-beta pruning application made in Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MimMax Algorithm Application

This application showcases the MinMax algorithm enhanced by alpha-beta pruning. To execute the program make sure to download and import the org.json library. Furthermore, sample trees in JSON format are available within the "Sample" folder.

Features

The application on repeat prints the options menu below:

-i <filename> : insert tree from file
-j [<filename>] : print tree in the specified filename using JSON format
-d [<filename>] : print tree in the specified filename using DOT format
-c : calculate tree using min-max algorithm
-p : calculate tree using min-max and alpha-beta pruning optimization
-q : quit this program

$>

-i <filename> : The program parses and retrieves the data from the file located at <filepath>. if the file is read successfully, the message "OK" is printed.

-j [<filename>] : Saves the tree's contents in JSON format to the file at <filepath>. The presence of the <filepath> file is optional. If it is not specified, the output is directed to stdout.

-d [<filename>] : Outputs the tree's contents to the <filepath> file in a format compatible with the dot program from the graphviz suite for graph visualization. The presence of the <filepath> file is optional. If it is not specified, the output is directed to stdout.

-c : The MinMax algorithm is computed for the tree. Provides the path of nodes from the root to the leaves, leading to the optimal selection determined by the algorithm.

-p : The MinMax algorithm with the alpha-beta pruning enhancement is computed for the tree. Presents the ratio of total nodes to pruned nodes [Total, Pruned], and also provides the path of nodes from the root to the leaves, which leads to the optimal selection as determined by the algorithm.

-q : Quits the program.

Compilation and Execution

First of all download the the org.json library. Then compile the file using the command:

javac -cp .:filepath/to/json/file/json-simple-1.1.1.jar MinMax/MinMax.java 

Execute the program using the command:

java -cp .:filepath/to/json/file/json-simple-1.1.1.jar MinMax/MinMax

About

MinMax algorithm with alpha-beta pruning application made in Java.


Languages

Language:Java 100.0%