diff --git a/.gitignore b/.gitignore index 6b1f432..4be9f73 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,16 @@ /Semester 3/Assignments/MP2-chapter4_Java20_CalebFontenot/dist/ /Semester 3/Assignments/MP2-chapter4_Java20_CalebFontenot/build/ /Semester 3/Assignments/MP2_Navigation_CalebFontenot/target/ +/Semester 3/Assignments/MP3_Recursion_CalebFontenot/target/ +/Semester 3/Assignments/MP3_Recursion_CalebFontenot2/target/ +/Semester 3/Assignments/MP3_Recusion_CalebFontenot3/nbproject/private/ +/Semester 3/Assignments/MP3_Recusion_CalebFontenot3/build/ +/Semester 3/Assignments/MP3_Recusion_CalebFontenot3/dist/ +/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/private/ +/Semester 3/Assignments/MP3_Recursion_CalebFontenot/build/ +/Semester 3/Assignments/SerialPog/nbproject/private/ +/Semester 3/Assignments/SerialPog/build/ +/Semester 3/Assignments/SerialPog/target/ +/Semester 3/Assignments/SerialPog2/target/ +/Semester 3/Assignments/SerialPogAnt/nbproject/private/ +/Semester 3/Assignments/SerialPogAnt/build/ diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/build.xml b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/build.xml new file mode 100644 index 0000000..064cc2c --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project MP3_Recursion_CalebFontenot. + + + diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/manifest.mf b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/mp2-recursion-3.pdf b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/mp2-recursion-3.pdf new file mode 100644 index 0000000..863ad9a Binary files /dev/null and b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/mp2-recursion-3.pdf differ diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/build-impl.xml b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/build-impl.xml new file mode 100644 index 0000000..beafdc7 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/build-impl.xml @@ -0,0 +1,1799 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + ${platform.java} -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/genfiles.properties b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/genfiles.properties new file mode 100644 index 0000000..f69c75b --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=44c2f96f +build.xml.script.CRC32=0c59a678 +build.xml.stylesheet.CRC32=f85dc8f2@1.107.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=44c2f96f +nbproject/build-impl.xml.script.CRC32=47a26e92 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.107.0.48 diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.properties b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.properties new file mode 100644 index 0000000..8f0f0e2 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.properties @@ -0,0 +1,95 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/MP3_Recursion_CalebFontenot.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/MP3_Recursion_CalebFontenot +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=17 +javac.target=17 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=MP3_Recursion_CalebFontenot +main.class=mp3_recursion_calebfontenot.MP3_Recursion_CalebFontenot +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=JDK_17 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.xml b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.xml new file mode 100644 index 0000000..73fc8f7 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/nbproject/project.xml @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + MP3_Recursion_CalebFontenot + + + + + + + + + + diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/BinaryToDecimal.java b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/BinaryToDecimal.java new file mode 100644 index 0000000..2ee5409 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/BinaryToDecimal.java @@ -0,0 +1,39 @@ +package mp3_recursion_calebfontenot; + + +import java.util.Scanner; + +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +/** + * + * @author caleb + */ +public class BinaryToDecimal { + + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + while (true) { + System.out.print("Enter a binary number: "); + String binary = input.nextLine(); + System.out.println(binary + " in decimal is " + binaryToDecimal(binary)); + } + } + + public static int binaryToDecimal(String binaryString) { + return binaryToDecimal(binaryString, 0, binaryString.length(), 0); + } + + public static int binaryToDecimal(String binaryString, int low, int high, int value) { + if (low == binaryString.length() - 1) { + return value; + } + if (binaryString.charAt(low) == '1') { + return binaryToDecimal(binaryString, ++low, --high, value += Math.pow(2, high)); + } else { + return binaryToDecimal(binaryString, ++low, --high, value); + } + } +} diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/DecimalToBinary.java b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/DecimalToBinary.java new file mode 100644 index 0000000..721c72b --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/DecimalToBinary.java @@ -0,0 +1,62 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package mp3_recursion_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class DecimalToBinary { + + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + while (true) { + System.out.print("Enter a decimal integer: "); + int decimal = input.nextInt(); + System.out.println(decimal + " is " + decimalToBinary(decimal) + " in binary."); + } + } + + public static String decimalToBinary(int value) { + return reverse(decimalToBinary(value, "")); + } + + public static String decimalToBinary(int value, String bin) { + if (value == 0) { + return bin += ""; + } else if (value > 0) { + if (value % 2 == 1) { + return decimalToBinary((int) Math.floor(value / 2), bin + "1"); + } else { + return decimalToBinary((int) Math.floor(value / 2), bin + "0"); + } + } + + return "0 naht ssel si eulav"; + + } + public static String reverse(String input) { + String returnString = ""; + for (int i = input.length() - 1; 0 <= i; --i) { + returnString += input.charAt(i); + } + return returnString; + } + + public static String decimalToBinaryIterative(int value) { + String bin = ""; + while (value > 0) { + if (value % 2 == 1) + bin += "1"; + else + bin += "0"; + + value /= 2; + } + return reverse(bin); + } +} diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/MP3_Recursion_CalebFontenot.java b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/MP3_Recursion_CalebFontenot.java new file mode 100644 index 0000000..afe691a --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/MP3_Recursion_CalebFontenot.java @@ -0,0 +1,16 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package mp3_recursion_calebfontenot; + +/** + * + * @author caleb + */ +public class MP3_Recursion_CalebFontenot { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/Maze.java b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/Maze.java new file mode 100644 index 0000000..a5670eb --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/Maze.java @@ -0,0 +1,325 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package mp3_recursion_calebfontenot; + + +import java.util.Optional; +import javafx.application.Application; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.Button; +import javafx.scene.control.ButtonType; +import javafx.scene.control.Label; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Line; +import javafx.scene.shape.Rectangle; +import javafx.stage.Stage; + +/** + * + * @author caleb + */ +public class Maze extends Application +{ + + double paneWidth = 440; + double paneHeight = 440; + + private Cell[][] board = new Cell[8][8]; + private Button btFindPath = new Button("Find Path Top Left to Bottom Right"); + private Button btClearPath = new Button("Clear Path"); + private Label lblStatus = new Label(); + + @Override // Override the start method in the Application class + public void start(Stage primaryStage) + { + GridPane gridPane = new GridPane(); + for (int i = 0; i < 8; i++) + { + for (int j = 0; j < 8; j++) + { + gridPane.add(board[i][j] = new Cell(), j, i); + } + } + + HBox hBox = new HBox(5); + hBox.setAlignment(Pos.CENTER); + hBox.getChildren().addAll(btFindPath, btClearPath); + + BorderPane pane = new BorderPane(); + pane.setTop(lblStatus); + BorderPane.setAlignment(lblStatus, Pos.CENTER); + pane.setCenter(gridPane); + pane.setBottom(hBox); + + // Create a scene and place it in the stage + Scene scene = new Scene(pane, paneWidth, paneHeight + 60); + primaryStage.setTitle("Maze"); // Set the stage title + primaryStage.setScene(scene); // Place the scene in the stage + primaryStage.show(); // Display the stage + + btFindPath.setOnAction(e -> findPath()); + btClearPath.setOnAction(e -> clearPath()); + showSampleMessage(); + + } + + public void showSampleMessage() + { + Alert a = new Alert(Alert.AlertType.CONFIRMATION); + + a.setTitle("Maze Information"); + a.setHeaderText(" Put this message in its proper place. "); + a.setContentText("This square cannot have an X"); + Optional result = a.showAndWait(); + if (result.get() == ButtonType.OK) + { + System.out.println("OK "); + } + else if (result.get() == ButtonType.CANCEL) + { + System.out.println("CANCEL"); + } + } + + public void findPath() + { + if (findPath(0, 0)) + { + lblStatus.setText("path found"); + } + else + { + lblStatus.setText("No path exists"); + } + } + + public boolean findPath(int row, int col) + { + board[row][col].visit(); + + if ((col == 7) && (row == 7)) + { + board[row][col].selectCell(); + return true; + } + + if ((row > 0) && !board[row - 1][col].marked() + && !board[row - 1][col].blocked() && !board[row - 1][col].visited()) + { + block(row, col); + + if (findPath(row - 1, col)) + { + board[row][col].selectCell(); + return true; + } + + unblock(row, col); + } + + if ((row < 7) && !board[row + 1][col].marked() + && !board[row + 1][col].blocked() && !board[row + 1][col].visited()) + { + block(row, col); + + if (findPath(row + 1, col)) + { + board[row][col].selectCell(); + return true; + } + + unblock(row, col); + } + + if ((col > 0) && !board[row][col - 1].marked() + && !board[row][col - 1].blocked() && !board[row][col - 1].visited()) + { + block(row, col); + if (findPath(row, col - 1)) + { + board[row][col].selectCell(); + return true; + } + + unblock(row, col); + } + + if ((col < 7) && !board[row][col + 1].marked() + && !board[row][col + 1].blocked() && !board[row][col + 1].visited()) + { + block(row, col); + if (findPath(row, col + 1)) + { + board[row][col].selectCell(); + return true; + } + + unblock(row, col); + } + + return false; + } + + // Temporary block the neighbor to prevent neighboring path + public void block(int row, int col) + { + if (row > 0) + { + board[row - 1][col].block(); + } + + if (row < 7) + { + board[row + 1][col].block(); + } + + if (col > 0) + { + board[row][col - 1].block(); + } + + if (col < 7) + { + board[row][col + 1].block(); + } + } + + // Remove the temporary block + public void unblock(int row, int col) + { + if (row > 0) + { + board[row - 1][col].unblock(); + } + + if (row < 7) + { + board[row + 1][col].unblock(); + } + + if (col > 0) + { + board[row][col - 1].unblock(); + } + + if (col < 7) + { + board[row][col + 1].unblock(); + } + } + + public void clearPath() + { + for (int row = 0; row < board.length; row++) + { + for (int col = 0; col < board[row].length; col++) + { + board[row][col].deselectCell(); + } + } + } + + public static void main(String[] args) + { + launch(args); + } + + // Inner class + class Cell extends StackPane + { + + private boolean marked = false; + private boolean visited = false; + private boolean blocked = false; + + double width = paneWidth / 8; + double height = paneHeight / 8; + private Rectangle rectangle = new Rectangle(0, 0, width, height); + + Line line1 = new Line(0, 0, width, height); + Line line2 = new Line(width, 0, 0, height); + + public Cell() + { + this.getChildren().add(rectangle); + rectangle.setFill(Color.WHITE); + rectangle.setStroke(Color.BLACK); + + this.setOnMousePressed(e -> + { + marked = !marked; + if (marked) + { + mark(); + } + else + { + unmark(); + } + }); + } + + public void mark() + { + this.getChildren().addAll(line1, line2); + } + + public void unmark() + { + this.getChildren().remove(line1); + this.getChildren().remove(line2); + } + + public boolean marked() + { + return marked; + } + + public void visit() + { + visited = true; + } + + public boolean visited() + { + return visited; + } + + public boolean blocked() + { + return blocked; + } + + public void block() + { + blocked = true; + } + + public void unblock() + { + blocked = false; + } + + public void selectCell() + { + rectangle.setFill(Color.RED); + } + + public void deselectCell() + { + rectangle.setFill(Color.WHITE); + blocked = false; + visited = false; + } + } + +} + diff --git a/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/StringPermuatation.java b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/StringPermuatation.java new file mode 100644 index 0000000..88ec478 --- /dev/null +++ b/Semester 3/Assignments/MP3_Recursion_CalebFontenot/src/mp3_recursion_calebfontenot/StringPermuatation.java @@ -0,0 +1,30 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package mp3_recursion_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class StringPermuatation { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.print("Enter a string: "); + String s = input.nextLine(); + System.out.println("The permuatation for " + s + " is:"); + displayPermutation(s); + } + + public static void displayPermutation(String s) { + displayPermutation(" ", s); + } + public static void displayPermutation(String s1, String s2) { + if (s2.equals("")) { + + } + } +} diff --git a/Semester 3/Assignments/SerialPog2/pom.xml b/Semester 3/Assignments/SerialPog2/pom.xml new file mode 100644 index 0000000..ec70dd1 --- /dev/null +++ b/Semester 3/Assignments/SerialPog2/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot + SerialPog2 + 1.0-SNAPSHOT + jar + + UTF-8 + 20 + 20 + com.calebfontenot.serialpog2.SerialPog2 + + \ No newline at end of file diff --git a/Semester 3/Assignments/SerialPogAnt/build.xml b/Semester 3/Assignments/SerialPogAnt/build.xml new file mode 100644 index 0000000..654f5ac --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project SerialPogAnt. + + + diff --git a/Semester 3/Assignments/SerialPogAnt/manifest.mf b/Semester 3/Assignments/SerialPogAnt/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Semester 3/Assignments/SerialPogAnt/nbproject/build-impl.xml b/Semester 3/Assignments/SerialPogAnt/nbproject/build-impl.xml new file mode 100644 index 0000000..7892c25 --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/nbproject/build-impl.xml @@ -0,0 +1,1799 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + ${platform.java} -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/SerialPogAnt/nbproject/genfiles.properties b/Semester 3/Assignments/SerialPogAnt/nbproject/genfiles.properties new file mode 100644 index 0000000..de72ffe --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=6aa6ae3a +build.xml.script.CRC32=3b213a64 +build.xml.stylesheet.CRC32=f85dc8f2@1.107.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=6aa6ae3a +nbproject/build-impl.xml.script.CRC32=86addcb3 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.107.0.48 diff --git a/Semester 3/Assignments/SerialPogAnt/nbproject/project.properties b/Semester 3/Assignments/SerialPogAnt/nbproject/project.properties new file mode 100644 index 0000000..bd83799 --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/nbproject/project.properties @@ -0,0 +1,98 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=SerialPogAnt +application.vendor=caleb +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/SerialPogAnt.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/SerialPogAnt +endorsed.classpath= +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.RXTX.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=17 +javac.target=17 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=SerialPogAnt +main.class=serialpogant.SerialPog2 +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=Graal_JDK_20 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Semester 3/Assignments/SerialPogAnt/nbproject/project.xml b/Semester 3/Assignments/SerialPogAnt/nbproject/project.xml new file mode 100644 index 0000000..ad2866b --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/nbproject/project.xml @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + SerialPogAnt + + + + + + + + + + diff --git a/Semester 3/Assignments/SerialPogAnt/src/serialpogant/SerialPog2.java b/Semester 3/Assignments/SerialPogAnt/src/serialpogant/SerialPog2.java new file mode 100644 index 0000000..0c2e627 --- /dev/null +++ b/Semester 3/Assignments/SerialPogAnt/src/serialpogant/SerialPog2.java @@ -0,0 +1,48 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ +package serialpogant; + +import java.io.OutputStream; +import java.io.IOException; +import gnu.io.*; + +/** + * + * @author caleb + */ +public class SerialPog2 { + + public static void main(String[] args) { + // Define the serial port name (e.g., COM3 for Windows, /dev/ttyUSB0 for Linux) + String serialPortName = "/dev/ttyACM0"; // Replace with your Arduino's serial port + + // Define the baud rate (must match the Arduino sketch) + int baudRate = 9600; + + try { + // Open the serial port + CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName); + SerialPort serialPort = (SerialPort) portIdentifier.open("", 2000); + + // Configure the serial port + serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); + + // Get the output stream from the serial port + OutputStream outputStream = serialPort.getOutputStream(); + + // String to send to Arduino + String messageToSend = "Hello, Arduino!"; + + // Convert the string to bytes and write to the serial port + byte[] messageBytes = messageToSend.getBytes(); + outputStream.write(messageBytes); + + // Close the serial port when done + serialPort.close(); + } catch (PortInUseException | NoSuchPortException | UnsupportedCommOperationException | IOException e) { + e.printStackTrace(); + } + } + +}