Compare commits
3 Commits
5c2fde6c69
...
3b56a1fb50
Author | SHA1 | Date | |
---|---|---|---|
|
3b56a1fb50 | ||
|
2714b23dab | ||
|
53d046858f |
@ -6,6 +6,11 @@
|
|||||||
<option name="name" value="Central Repository" />
|
<option name="name" value="Central Repository" />
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="snapshots" />
|
||||||
|
<option name="name" value="Sonatype Snapshots" />
|
||||||
|
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="central" />
|
<option name="id" value="central" />
|
||||||
<option name="name" value="Maven Central repository" />
|
<option name="name" value="Maven Central repository" />
|
||||||
|
35
pom.xml
35
pom.xml
@ -13,5 +13,38 @@
|
|||||||
<maven.compiler.target>19</maven.compiler.target>
|
<maven.compiler.target>19</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.fxmisc.richtext</groupId>
|
||||||
|
<artifactId>richtextfx</artifactId>
|
||||||
|
<version>0.11.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>12.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>20.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.8</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>edu.jturn.cs3642.CS3642-Artificial_Intelligence/Assignments.A1.GUIDriver</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
@ -14,6 +14,8 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
@ -122,32 +124,17 @@ public class Driver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void writeToFile(String name, StringBuffer values) {
|
private static void writeToFile(String name, StringBuffer values) {
|
||||||
File directory = new File("src/Assignments/A1/results");
|
URL resourcePath = Driver.class.getResource("/A1/results/AStar.txt");
|
||||||
if (!directory.exists()) {
|
URI resourceURI = URI.create(resourcePath.toString());
|
||||||
directory.mkdirs();
|
File resource = new File(resourceURI.getPath());
|
||||||
System.out.println("Creating Directory: results");
|
|
||||||
}
|
|
||||||
|
|
||||||
File output = new File(directory, name + ".txt");
|
try (FileWriter out = new FileWriter(resource)) {
|
||||||
|
|
||||||
try {
|
|
||||||
if (!output.createNewFile()) {
|
|
||||||
System.out.println("File Already Exists: " + name + ".txt");
|
|
||||||
} else {
|
|
||||||
System.out.println("File Created: " + name + ".txt");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Error creating file: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
try (FileWriter out = new FileWriter(output)) {
|
|
||||||
out.write(values.toString());
|
out.write(values.toString());
|
||||||
System.out.println("Data written to file: " + name + ".txt");
|
System.out.println("Data written to file: " + name + ".txt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Error writing to file: " + e.getMessage());
|
System.err.println("Error writing to file: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
openDirectoryFile(resource);
|
||||||
openDirectoryFile(output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void openDirectoryFile(File open) {
|
private static void openDirectoryFile(File open) {
|
||||||
|
26
src/main/java/Assignments/A1/GUIDriver.java
Normal file
26
src/main/java/Assignments/A1/GUIDriver.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package Assignments.A1;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class GUIDriver extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws Exception {
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("/A1/view/BoardView.fxml"));
|
||||||
|
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("A1/view/styles.css").toExternalForm());
|
||||||
|
|
||||||
|
stage.setTitle("JavaFX and Maven");
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
9
src/main/java/Assignments/A1/GUILauncher.java
Normal file
9
src/main/java/Assignments/A1/GUILauncher.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package Assignments.A1;
|
||||||
|
|
||||||
|
public class GUILauncher {
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
GUIDriver.main(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
0
src/main/resources/A1/results/AStar.txt
Normal file
0
src/main/resources/A1/results/AStar.txt
Normal file
0
src/main/resources/A1/results/BFS.txt
Normal file
0
src/main/resources/A1/results/BFS.txt
Normal file
0
src/main/resources/A1/results/DFS.txt
Normal file
0
src/main/resources/A1/results/DFS.txt
Normal file
0
src/main/resources/A1/results/UCS.txt
Normal file
0
src/main/resources/A1/results/UCS.txt
Normal file
0
src/main/resources/A1/view/BoardView.fxml
Normal file
0
src/main/resources/A1/view/BoardView.fxml
Normal file
0
src/main/resources/A1/view/styles.css
Normal file
0
src/main/resources/A1/view/styles.css
Normal file
Loading…
Reference in New Issue
Block a user