Untitled

mail@pastecode.io avatar
unknown
java
7 months ago
456 B
3
Indexable
Never
package piezas;

public class Caballo extends Piezas {

	public Caballo(String nombre, String color) {
		super("C", color);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean esMovimientoValido(int origenX, int origenY, int destinoX, int destinoY) {
		int deltaX = Math.abs(destinoX - origenX);
		int deltaY = Math.abs(destinoY - origenY);

		return (deltaX == 1 && deltaY == 2) || (deltaX == 2 && deltaY == 1);
	}

}
Leave a Comment