From 049b6b9daea6a44d8d4115d64fd95ffcffaef87f Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Tue, 17 Jan 2023 11:07:01 -0600 Subject: [PATCH] ree --- .../MP1_CalebFontenot/.~lock.mp1-s23-1.docx# | 2 +- .../mp1_calebfontenot/MP1_CalebFontenot.java | 30 +++++-------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Semester 2/Assignments/MP1_CalebFontenot/.~lock.mp1-s23-1.docx# b/Semester 2/Assignments/MP1_CalebFontenot/.~lock.mp1-s23-1.docx# index 6b00f5e..df1e365 100644 --- a/Semester 2/Assignments/MP1_CalebFontenot/.~lock.mp1-s23-1.docx# +++ b/Semester 2/Assignments/MP1_CalebFontenot/.~lock.mp1-s23-1.docx# @@ -1 +1 @@ -,caleb,caleb-gaming-laptop-archlinux,13.01.2023 10:13,file:///home/caleb/.config/libreoffice/4; \ No newline at end of file +,caleb,caleb-ryzen-archlinux,14.01.2023 14:36,file:///home/caleb/.config/libreoffice/4; \ No newline at end of file diff --git a/Semester 2/Assignments/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.java b/Semester 2/Assignments/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.java index e282bb4..a58450a 100644 --- a/Semester 2/Assignments/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.java +++ b/Semester 2/Assignments/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.java @@ -11,8 +11,7 @@ public class MP1_CalebFontenot { public static void main(String[] args) { //2965 - /* - int[][] intArray = { // Horizontal + int[][] intArray1 = { // Horizontal {0, 1, 0, 3, 1, 6, 1}, {0, 1, 6, 8, 6, 0, 1}, {5, 6, 2, 1, 8, 2, 9}, @@ -21,7 +20,7 @@ public class MP1_CalebFontenot { {3, 3, 3, 3, 4, 0, 7} }; - int[][] intArray = { // Vertical + int[][] intArray2 = { // Vertical {0, 1, 0, 3, 1, 6, 1}, {0, 1, 6, 8, 6, 0, 1}, {5, 5, 2, 1, 8, 2, 9}, @@ -29,8 +28,7 @@ public class MP1_CalebFontenot { {1, 5, 6, 1, 4, 0, 7}, {3, 5, 3, 3, 4, 0, 7} }; - */ - int[][] intArray = { // Diagonal 1 + int[][] intArray3 = { // Diagonal 1 {0, 1, 0, 3, 1, 6, 1}, {0, 1, 6, 8, 6, 0, 1}, {9, 6, 2, 1, 8, 2, 9}, @@ -38,8 +36,8 @@ public class MP1_CalebFontenot { {1, 3, 9, 1, 4, 0, 7}, {3, 3, 3, 9, 4, 0, 7} }; - printArray(intArray); - System.out.println(isConsecutiveFour(intArray)); + printArray(intArray3); + System.out.println(isConsecutiveFour(intArray3)); } public static void printArray(int[][] array) @@ -103,22 +101,10 @@ public class MP1_CalebFontenot { System.out.println("Checking next line..."); } System.out.println("Checking for Diagonal matches..."); - for (int rowIterate = 0; rowIterate < values.length; ++rowIterate) { - y = 0; - for (int x = 0; x < values[0].length - 1; ++x) { - ++y; - if (values[rowIterate][x] == values[rowIterate + 1][y + 1]) { - intCounter++; - System.out.println(values[rowIterate][x] + " " + values[rowIterate + 1][y ] + ", intCounter: " + intCounter); - } else { - intCounter = 0; - System.out.println(values[rowIterate][x] + " " + values[rowIterate + 1][y] + ", intCounter: " + intCounter); + for (int rowIterate = 0; rowIterate < (values.length - 4); ++rowIterate) { + for (int x = 0; x < values.length - 1; ++x) { + if (values[x][rowIterate] == values[x][rowIterate + 1]) } - if (intCounter == 3) { - System.out.println("Diagonal match!"); - return true; - } - } System.out.println("Checking next line..."); } System.out.println("No match found.");