ree
This commit is contained in:
parent
87e04d639d
commit
049b6b9dae
@ -1 +1 @@
|
|||||||
,caleb,caleb-gaming-laptop-archlinux,13.01.2023 10:13,file:///home/caleb/.config/libreoffice/4;
|
,caleb,caleb-ryzen-archlinux,14.01.2023 14:36,file:///home/caleb/.config/libreoffice/4;
|
@ -11,8 +11,7 @@ public class MP1_CalebFontenot {
|
|||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{ //2965
|
{ //2965
|
||||||
/*
|
int[][] intArray1 = { // Horizontal
|
||||||
int[][] intArray = { // Horizontal
|
|
||||||
{0, 1, 0, 3, 1, 6, 1},
|
{0, 1, 0, 3, 1, 6, 1},
|
||||||
{0, 1, 6, 8, 6, 0, 1},
|
{0, 1, 6, 8, 6, 0, 1},
|
||||||
{5, 6, 2, 1, 8, 2, 9},
|
{5, 6, 2, 1, 8, 2, 9},
|
||||||
@ -21,7 +20,7 @@ public class MP1_CalebFontenot {
|
|||||||
{3, 3, 3, 3, 4, 0, 7}
|
{3, 3, 3, 3, 4, 0, 7}
|
||||||
};
|
};
|
||||||
|
|
||||||
int[][] intArray = { // Vertical
|
int[][] intArray2 = { // Vertical
|
||||||
{0, 1, 0, 3, 1, 6, 1},
|
{0, 1, 0, 3, 1, 6, 1},
|
||||||
{0, 1, 6, 8, 6, 0, 1},
|
{0, 1, 6, 8, 6, 0, 1},
|
||||||
{5, 5, 2, 1, 8, 2, 9},
|
{5, 5, 2, 1, 8, 2, 9},
|
||||||
@ -29,8 +28,7 @@ public class MP1_CalebFontenot {
|
|||||||
{1, 5, 6, 1, 4, 0, 7},
|
{1, 5, 6, 1, 4, 0, 7},
|
||||||
{3, 5, 3, 3, 4, 0, 7}
|
{3, 5, 3, 3, 4, 0, 7}
|
||||||
};
|
};
|
||||||
*/
|
int[][] intArray3 = { // Diagonal 1
|
||||||
int[][] intArray = { // Diagonal 1
|
|
||||||
{0, 1, 0, 3, 1, 6, 1},
|
{0, 1, 0, 3, 1, 6, 1},
|
||||||
{0, 1, 6, 8, 6, 0, 1},
|
{0, 1, 6, 8, 6, 0, 1},
|
||||||
{9, 6, 2, 1, 8, 2, 9},
|
{9, 6, 2, 1, 8, 2, 9},
|
||||||
@ -38,8 +36,8 @@ public class MP1_CalebFontenot {
|
|||||||
{1, 3, 9, 1, 4, 0, 7},
|
{1, 3, 9, 1, 4, 0, 7},
|
||||||
{3, 3, 3, 9, 4, 0, 7}
|
{3, 3, 3, 9, 4, 0, 7}
|
||||||
};
|
};
|
||||||
printArray(intArray);
|
printArray(intArray3);
|
||||||
System.out.println(isConsecutiveFour(intArray));
|
System.out.println(isConsecutiveFour(intArray3));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printArray(int[][] array)
|
public static void printArray(int[][] array)
|
||||||
@ -103,22 +101,10 @@ public class MP1_CalebFontenot {
|
|||||||
System.out.println("Checking next line...");
|
System.out.println("Checking next line...");
|
||||||
}
|
}
|
||||||
System.out.println("Checking for Diagonal matches...");
|
System.out.println("Checking for Diagonal matches...");
|
||||||
for (int rowIterate = 0; rowIterate < values.length; ++rowIterate) {
|
for (int rowIterate = 0; rowIterate < (values.length - 4); ++rowIterate) {
|
||||||
y = 0;
|
for (int x = 0; x < values.length - 1; ++x) {
|
||||||
for (int x = 0; x < values[0].length - 1; ++x) {
|
if (values[x][rowIterate] == values[x][rowIterate + 1])
|
||||||
++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);
|
|
||||||
}
|
}
|
||||||
if (intCounter == 3) {
|
|
||||||
System.out.println("Diagonal match!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("Checking next line...");
|
System.out.println("Checking next line...");
|
||||||
}
|
}
|
||||||
System.out.println("No match found.");
|
System.out.println("No match found.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user