<commit_before>package tp.pr5.logic;

import tp.pr5.Resources.Resources;

public class ReversiMove extends Move {

	public ReversiMove(int moveColumn, int moveRow, Counter moveColour) {
		super(moveColour, moveColumn);
		super.row = moveRow;
	}

	@Override
	public boolean executeMove(Board b) throws InvalidMove {
		boolean valid = false;
		
		if ((column >= 1 && column <= Resources.DIMX_REVERSI) && 
			(row >= 1 && row <= Resources.DIMY_REVERSI) && 
			(b.getPosition(column, row) == Counter.EMPTY)) { 
				//TODO: terminnar execute move
				
				valid = checkHorizontal(b, column, row, true); // True = left Part
					if(!valid) valid = checkHorizontal(b, column, row, false); // False = right part
						if (!valid) valid = checkVertical(b, column, row, true); // True = Up part
							if (!valid) valid = checkVertical(b, column, row, false); // True = Up part	
				
		}	
		 
		return valid;
	}

	// CheckHorizontal: Function to Check left and right colors given a fixed position
	
	public boolean checkHorizontal(Board b, int x, int y, boolean left) {
		boolean valid = false;
		int auxColumn = x, total = 0;
		Counter color = b.getPosition(x, y);
 <commit_msg>[REVERSI] Make a move now is finished<commit_after>package tp.pr5.logic;

import tp.pr5.Resources.Resources;

public class ReversiMove extends Move {

	public ReversiMove(int moveColumn, int moveRow, Counter moveColour) {
		super(moveColour, moveColumn);
		super.row = moveRow;
	}

	@Override
	public boolean executeMove(Board b) throws InvalidMove {
		boolean valid = false;
		
		if ((column >= 1 && column <= Resources.DIMX_REVERSI) && 
			(row >= 1 && row <= Resources.DIMY_REVERSI) && 
			(b.getPosition(column, row) == Counter.EMPTY)) { 
				
				// Un movimiento es vlido si puede revertir alguna celda formada
				// Y adems las posiciones estn dentro del tablero y es una celda vaca
				
				valid = checkHorizontal(b, column, row, true); // True = left Part
					if(!valid) valid = checkHorizontal(b, column, row, false); // False = right part
						if (!valid) valid = checkVertical(b, column, row, true); // True = Up part
							if (!valid) valid = checkVertical(b, column, row, false); // True = Up part	
								if (!valid) valid = checkDiagonal(b, column, row, true); // True = topLeft
									if (!valid) valid = checkDiagonal(b, column, row, false); // False = Bottom Right
		}	
		 
		return valid;
	}

	// CheckHorizontal: Function to Check left and right colors given a fixed position
	
	public boolean checkHorizontal(Board b, int x, int y, boolean left) {
		boolean valid = false;
		int auxColumn = x, total = 0;
		Counter color = b.getPosition(x, y);
 
{'fraction_non_alphanumeric': 0.11686838124054463, 'fraction_numerical': 0.0037821482602118004, 'mean_word_length': 3.3360655737704916, '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': '2250008', 'n_tokens_mistral': 949, 'n_tokens_neox': 820, 'n_words': 282}