<commit_before>package ru.apetrov;

import ru.apetrov.models.Horse;

public class ChessBoard {

	private Figure[][] figures = new Figure[8][8];

    	public void move(Figure figure, Position position){
        	if (boardRangeChecking(position) && positionOccupiedChecking(figure, position)){
            		if (!figures[figure.getPosition().getY()][figure.getPosition().getX()].equals(new Horse(position))){
                		if (moveByDiagonal(figure, position) && moveByVerticaleOrHorizontale(figure, position)){
                    			this.removeFigure(figure);
                    			figure.setPosition(position);
                    			this.addFigure(figure);
                		}
            		}else {
                		if (moveByDiagonal(figure, position) && moveByVerticaleOrHorizontale(figure, position)){
                    			this.removeFigure(figure);
                    			figure.setPosition(position);
                    			this.addFigure(figure);
                		}
            		}
        	}
    	}

    	public void addFigure(Figure figure){
        	this.figures[figure.getPosition().getY()][figure.getPosition().getX()] = figure;
    	}

    	public  void removeFigure(Figure figure){
        	this.figures[figure.getPosition().getY()][figure.getPosition().getX()] = null;
    	}

    	public boolean boardRangeChecking(Position position){

        	boolean result = false;

        	if (!position.equals(null)){
            		if (position.getY() <= figures.length && position.getY() >= 0 && position.getX() <= figures.length && position.getX() >= 0){
                		result = true;
            		}
        	}
        	return result;
    	}

    	public boolean positionOccupiedChecking(Figure figure, Position position){
        	boolean result = false;<commit_msg>update ChessBoard<commit_after>package ru.apetrov;

import ru.apetrov.models.Horse;

public class ChessBoard {

	private Figure[][] figures = new Figure[8][8];

    	public void move(Figure figure, Position position){
        	if (boardRangeChecking(position) && positionOccupiedChecking(figure, position)){
            		if (!figures[figure.getPosition().getY()][figure.getPosition().getX()].equals(new Horse(position))){
                		if (moveByDiagonal(figure, position) && moveByVerticaleOrHorizontale(figure, position)){
                    			this.removeFigure(figure);
                    			figure.setPosition(position);
                    			this.addFigure(figure);
                		}
            		}else {
                    		this.removeFigure(figure);
                    		figure.setPosition(position);
                    		this.addFigure(figure);
                	}
        	}
    	}

    	public void addFigure(Figure figure){
        	this.figures[figure.getPosition().getY()][figure.getPosition().getX()] = figure;
    	}

    	public  void removeFigure(Figure figure){
        	this.figures[figure.getPosition().getY()][figure.getPosition().getX()] = null;
    	}

    	public boolean boardRangeChecking(Position position){

        	boolean result = false;

        	if (!position.equals(null)){
            		if (position.getY() <= figures.length && position.getY() >= 0 && position.getX() <= figures.length && position.getX() >= 0){
                		result = true;
            		}
        	}
        	return result;
    	}

    	public boolean positionOccupiedChecking(Figure figure, Position position){
        	boolean result = false;
{'fraction_non_alphanumeric': 0.11982633863965268, 'fraction_numerical': 0.0023154848046309695, 'mean_word_length': 2.0884718498659516, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '252807', 'n_tokens_mistral': 994, 'n_tokens_neox': 952, 'n_words': 165}