<commit_before>package com.bbdr.chess;

public class Knight extends Piece implements Renderable, Moveable {
    
    /**
     * Returns whether the Knight can move to relative coordinates (relX, relY).
     * This method is used as the first step for move validation. Its outputs
     * do not depend on the current configuration of the board. That is, the
     * method returns true if the move to relative (relX, relY) are valid in
     * any board configuration. Because it is fixed, its results should be
     * used to build a cache.
     * @param relX the x-coordinate relative to the piece.
     * @param relY the y-coordinate relative to the piece.
     * @return true if the Knight can move to this relative location.
     */
    
    public boolean isValidMove(int relX, int relY){
           
        if (relY == -2) {
            if (relX == -1 || relX ==  1 ) {
                return true;
            }
        }
        if (relX == 2) {
            if(relY == -1 || relY == 1)
                return true;
        }
        if (relY == 2) {
            if(relX == -1 || relX == 1)
                return true;
        }
        if (relX == -2) {
            if(relY == -1 || relY == 1)
                return true;
        }
        // The movement matched none of the valid patterns;
        // this move is not valid.
        return false;
       
    }
   
    @Override
    public boolean canMoveTo(int relX, int relY, Board board) {   
        return true;
    }
    
    @Override
    public void draw() {
        // TODO
    }
    
    @Override
    public int getRank() {
        return Piece.RANK_KNIGHT;
    }
    
    public Knight(int x, int y, int player) {
        super(x, y, player);<commit_msg>moves for Horsey 2.0<commit_after>package com.bbdr.chess;


public class Knight extends Piece implements Renderable, Moveable {
    
    /**
     * Returns whether the Knight can move to relative coordinates (relX, relY).
     * This method is used as the first step for move validation. Its outputs
     * do not depend on the current configuration of the board. That is, the
     * method returns true if the move to relative (relX, relY) are valid in
     * any board configuration. Because it is fixed, its results should be
     * used to build a cache.
     * @param relX the x-coordinate relative to the piece.
     * @param relY the y-coordinate relative to the piece.
     * @return true if the Knight can move to this relative location.
     */
    
    public boolean isValidMove(int relX, int relY){
        
        // Get the absolute values for relX and relY
        relY = Math.abs(relY);
        relX = Math.abs(relX);
        
        // Valid moves for the Knight:
        if (relX == 2 || relY == 2) {
            if (relX == 1 || relY == 1) {
                return true;
            }
        }
        // The movement matched none of the valid patterns;
        // this move is not valid.
        return false;
    }
   
    @Override
    public boolean canMoveTo(int relX, int relY, Board board) {   
        return true;
    }
    
    @Override
    public void draw() {
        // TODO
    }
    
    @Override
    public int getRank() {
        return Piece.RANK_KNIGHT;
    }
    
    public Knight(int x, int y, int player) {
        super(x, y, player);
{'fraction_non_alphanumeric': 0.08429003021148036, 'fraction_numerical': 0.005438066465256798, 'mean_word_length': 1.7094926350245498, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5977494', 'n_tokens_mistral': 956, 'n_tokens_neox': 935, 'n_words': 380}