<commit_before><commit_msg>ChecktheCheck enum skeleton, not ready<commit_after>package chapter1;

import java.util.Scanner;

/**
 * Created by Daniel on 24/04/2016.
 */
public class P23ChecktheCheck {
    public enum movements {
        NORTHEAST,
        NORTHWEST,
        SOUTHWEST,
        SOUTHEAST,
        NORTH,
        SOUTH,
        EAST,
        WEST
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] input = new String[8]; // start putting in the matrix

        for (int i = 0; i < 8; i++) {
            input[i] = scanner.next();
        }

        char[][] matrix = new char[12][12];

        for (int i = 0; i < 12; i++) {
            for (int j = 0; j < 12; j++) {
                matrix[i][j] = '1';
            }
        }

        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                matrix[i + 2][j + 2] = input[i].charAt(j);
            }
        }
        printMatrix(matrix, 8, 8); // debug matrix

        // for the part of cols and rows, can put enums, causa the queen will use the same object as
        // the rook and the bishop
        // bishop seems the most difficult
        // rook can use some cols and rows logic
        // pawn,king aren't hardly to do
        // no logic to do with knight

        for (int i = 2; i < 10; i++) {
            for (int j = 2; j < 10; j++) {
                switch (matrix[i][j]) {
                    case 'p':
                        if (matrix[i + 1][j - 1] == 'K' || matrix[i + 1][j + 1] == 'K') {
                            System.out.println("Pawn Check!");
                        }
                        break;
                    case 'P':
                        if (matrix[i - 1][j - 1] == 'k' || matrix[i - 1][j + 1] == 'k') {
                            System.out.println("Pawn Check!");
                        }
                        break;
                    case 'n':
                        if (matrix[i + 2][j + 1] == 'K' || matrix[i + 2][j - 1] == 'K' || matrix[i - 2][j - 1] == 'K' || matrix[i - 2][j + 1] == 'K' || matrix[i + 1][j + 2] == 'K' || matrix[i - 1][j + 2] == 'K' || matrix[i + 1][j - 2] == 'K' || matrix[i - 1][j - 2] == 'K') {
                            System.out.println("Knight Check!");
                        }
                        break;
                    case 'N':
                        if (matrix[i + 2][j + 1] == 'k' || matrix[i + 2][j - 1] == 'k' || matrix[i - 2][j - 1] == 'k' || matrix[i - 2][j + 1] == 'k' || matrix[i + 1][j + 2] == 'k' || matrix[i - 1][j + 2] == 'k' || matrix[i + 1][j - 2] == 'k' || matrix[i - 1][j - 2] == 'k') {
                            System.out.println("Knight Check!");
                        }
                        break;
                    case 'b':  // work with bugs, bug fix tomorrow;
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) < 2 || (j - k) < 2) { //index out
                                    break;
                                }                                   // index out
                                if (matrix[i - k][j - k] != '.') {
                                    if (matrix[i - k][j - k] == 'K') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i + k][j + k] == 'K') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) <= 2 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i - k][j + k] != '.') {
                                    if (matrix[i - k][j + k] == 'K') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j - k) <= 2) {
                                    break;
                                }
                                if (matrix[i + k][j - k] == 'K') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                    case 'B':  // work with bugs, bug fix tomorrow;
                        for (int k = 1; k < 8; k++) {     // northwest
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) < 2 || (j - k) < 2) { //index out
                                    break;
                                }                                   // index out
                                if (matrix[i - k][j - k] != '.') {
                                    if (matrix[i - k][j - k] == 'k') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {  // southeast
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i + k][j + k] == 'k') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {  // northeast
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) <= 2 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i - k][j + k] != '.') {
                                    if (matrix[i - k][j + k] == 'k') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j - k) <= 2) {
                                    break;
                                }
                                if (matrix[i + k][j - k] == 'k') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                    case 'R':

                        break;

                }
            }
        }

    }

    private static void printMatrix(char[][] matrix, int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                System.out.printf(String.valueOf(matrix[i + 2][j + 2]));
            }
            System.out.println();
        }
    }

    private static void setPart(char[][] matrix, movements part) {
        for (int i = 2; i < 10; i++) {
            for (int j = 2; j < 10; j++) {
                switch (part) {
                    case NORTHEAST:
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) <= 2 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i - k][j + k] != '.') {
                                    if (matrix[i - k][j + k] == 'k') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        break;
                    case NORTHWEST:
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i - k) < 2 || (j - k) < 2) { //index out
                                    break;
                                }                                   // index out
                                if (matrix[i - k][j - k] != '.') {
                                    if (matrix[i - k][j - k] == 'k') {
                                        System.out.println("bishop check");
                                        break;
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                        break;
                    case SOUTHEAST:
                        for (int k = 1; k < 8; k++) {  // southeast
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j + k) >= 10) {
                                    break;
                                }
                                if (matrix[i + k][j + k] == 'k') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                        break;
                    case SOUTHWEST:
                        for (int k = 1; k < 8; k++) {
                            for (int l = 1; l < 8; l++) {
                                if ((i + k) >= 10 || (j - k) <= 2) {
                                    break;
                                }
                                if (matrix[i + k][j - k] == 'k') {
                                    System.out.println("bishop check");
                                    break;
                                } else {
                                    break;
                                }
                            }
                        }
                        break;
                    case NORTH:
                        for (int k = 1; k < 8; k++) {
                            if ((i - k) <= 2) {
                                break;
                            }
                            if (matrix[i - k][j] == 'k') {
                                System.out.println("rook check");
                                break;
                            } else {
                                break;
                            }

                        }
                        break;
                    case SOUTH:
                        for (int k = 1; k < 8; k++) {
                            if ((i - k) >= 10) {
                                break;
                            }
                            if (matrix[i + k][j] == 'k') {
                                System.out.println("rook check");
                                break;
                            } else {
                                break;
                            }

                        }
                        break;
                    case WEST:
                        for (int k = 1; k < 8; k++) {
                            if ((j - k) <= 2) {
                                break;
                            }
                            if (matrix[i][j - k] == 'k') {
                                System.out.println("rook check");
                                break;
                            } else {
                                break;
                            }

                        }
                        break;
                    case EAST
                        for (int k = 1; k < 8; k++) {
                            if ((j + k) <= 10) {
                                break;
                            }
                            if (matrix[i][j + k] == 'k') {
                                System.out.println("rook check");
                                break;
                            } else {
                                break;
                            }

                        }
                        break;
                }
            }

        }

    }

}

{'fraction_non_alphanumeric': 0.11355055237029786, 'fraction_numerical': 0.013075094392392673, 'mean_word_length': 0.4565173116089613, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 109, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6065610', 'n_tokens_mistral': 3568, 'n_tokens_neox': 3151, 'n_words': 866}