Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • sdas
2 results

Target

Select target project
  • m18016950/programmation2
  • m19026678/programmation2
  • b19010528/programmation2
  • s19027981/programmation2
  • s19028363/programmation2
  • m19009032/programmation2
  • c17027775/programmation2
  • a18023913/programmation2
  • i19004033/programmation2
  • b19014051/programmation2
  • b18012845/programmation2
  • s18015722/programmation2
  • r19006520/programmation2
  • b15012919/programmation2
  • a16023918/programmation2
  • s19026449/programmation2
  • p23020787/programmation2
17 results
Select Git revision
  • master
  • sdas
2 results
Show changes
Commits on Source (1)
Showing
with 987 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/>
</classpath>
*.class
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>projetechecs-master</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
public class Bishop extends Piece {
public Bishop(int x, int y, Player owner){
super(x, y, owner);
}
public boolean isMoveAuthorized(Board board, Coordinates destination){
int dx = destination.getX();
int dy = destination.getY();
int ox = this.getX();
int oy = this.getY();
Coordinates origin = new Coordinates(ox,oy);
for(int i=0; i<=7;i++) {
for(int j=0; j<=7;j++) {
if(board.sameDiagonalNothingBetween(origin, destination) &&(dx-ox)%(dy-oy)==0) {return true;}
}
}
return false;
}
@Override
public Type getType() {
return Type.BISHOP;
}
@Override
public int getValue() {
return 3;
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.File;
public class Board{
private Piece[][] array;
public Board(String fileName, Player white, Player black){
int pieceType;
int col;
int row;
String nextWord;
Player owner;
this.array = new Piece[8][8];
try {
File file = new File(fileName);
if(file.exists()==false) {
System.err.println("Error: Cannot find file "+ fileName);
System.exit(1);
}
Scanner in = new Scanner(file);
while(in.hasNext()) {
if ((nextWord = in.nextLine()).length()>2) {
pieceType = nextWord.charAt(0);
col = nextWord.charAt(1)-'0';
row = nextWord.charAt(2)-'0';
owner = black;
if (pieceType >= 'a' && pieceType <= 'z')
owner = white;
switch(pieceType) {
case 'K' : case 'k' :
{ this.addPiece(new King(col, row, owner)); break;}
case 'Q' : case 'q' :
{ this.addPiece(new Queen(col, row, owner)); break;}
case 'B' : case 'b' :
{ this.addPiece(new Bishop(col, row, owner)); break;}
case 'R' : case 'r' :
{ this.addPiece(new Rook(col, row, owner)); break;}
case 'N' : case 'n' :
{ this.addPiece(new Knight(col, row, owner)); break;}
case 'P' : case 'p' :
{ this.addPiece(new Pawn(col, row, owner)); break;}
}
}
}
in.close();
}
catch(FileNotFoundException e) {
System.err.println("Error file not found : "+e);
System.exit(1);
}
}
public List<Coordinates> getAllCoordinates(){
List<Coordinates> allCoordinates = new ArrayList<>();
for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) allCoordinates.add(new Coordinates(j, i));
return allCoordinates;
}
public List<Piece> getPieces(Player player) {
List<Piece> pieces = new ArrayList<>();
List<Piece> all = getPieces();
for (Piece piece : all) if (player.equals(piece.getOwner())) pieces.add(piece);
return pieces;
}
public List<Piece> getPieces() {
List<Piece> all = new ArrayList<>();
for (Piece[] pieces : array) for (Piece piece : pieces) if (piece != null) all.add(piece);
return all;
}
public void addPiece(Piece piece){
array[piece.getY()][piece.getX()] = piece;
}
public Piece getPiece(Coordinates coordinates){
return array[coordinates.getY()][coordinates.getX()];
}
public Piece getPiece(int x, int y){
return array[y][x];
}
public void emptyCell(Coordinates coordinates){
array[coordinates.getY()][coordinates.getX()] = null;
}
public boolean isEmptyCell(Coordinates coordinates){
return array[coordinates.getY()][coordinates.getX()] == null;
}
public boolean isEmptyCell(int x, int y){
return array[y][x] == null;
}
public boolean sameColumnNothingBetween(Coordinates origin, Coordinates destination){
if (origin.equals(destination)) return false;
if (origin.getX() != destination.getX()) return false;
int min = Math.min(origin.getY(), destination.getY());
int max = Math.max(origin.getY(), destination.getY());
for (int i = min ; i <= max; i++) {
if (!isEmptyCell(origin.getX(), i)) return false;
}
return true;
}
public boolean sameRowNothingBetween(Coordinates origin, Coordinates destination){
if (origin.equals(destination)) return false;
if (origin.getY() != destination.getY()) return false;
int min = Math.min(origin.getX(), destination.getX());
int max = Math.max(origin.getX(), destination.getX());
for (int i = min + 1; i < max; i++) {
if (!isEmptyCell(i, origin.getY())) return false;
}
return true;
}
public boolean sameDiagonalNothingBetween(Coordinates origin, Coordinates destination){
if (origin.equals(destination)) return false;
int lenX = Math.abs(origin.getX() - destination.getX());
int lenY = Math.abs(origin.getY() - destination.getY());
if (lenX != lenY) return false;
if (origin.getX() - destination.getX() > 1) {
if (origin.getY() - destination.getY() > 1)
for (int i = 1; i < lenX; i++) if (!isEmptyCell(origin.getX() - i, origin.getY() - i)) return false;
if (origin.getY() - destination.getY() < -1)
for (int i = 1; i < lenX; i++) if (!isEmptyCell(origin.getX() - i, origin.getY() + i)) return false;
}
if (origin.getX() - destination.getX() < -1) {
if (origin.getY() - destination.getY() > 1)
for (int i = 1; i < lenX; i++) if (!isEmptyCell(origin.getX() + i, origin.getY() - i)) return false;
if (origin.getY() - destination.getY() < -1)
for (int i = 1; i < lenX; i++) if (!isEmptyCell(origin.getX() + i, origin.getY() + i)) return false;
}
return true;
}
}
import java.util.Random;
public class ChessBot extends Player {
Board board;
public ChessBot(ChessColor color){
super(color);
board = null;
}
public void setBoard(Board board){
this.board = board;
}
@Override
public FromTo getFromTo() {
Random rd = new Random();
FromTo chosenMove = new FromTo(0,0,0,0);
int max = -1;
int scorePiece;
for(Move move : getAllMoves(board)) {
if(move.pieceAtDestination == null) {
scorePiece = 0;
} else {
scorePiece = move.pieceAtDestination.getValue();
}
if(this.isCheck && move.pieceAtOrigin.getType() == Piece.Type.KING)
scorePiece += 100;
if (scorePiece > max || (scorePiece == max && rd.nextBoolean())) {
chosenMove = new FromTo(move.origin.getX(),move.origin.getY(),move.destination.getX(),move.destination.getY());
max = scorePiece;
}
}
return chosenMove;
}
}
public enum ChessColor {
BLACK,
WHITE;
}
import java.awt.*;
import java.awt.Color;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class ChessUI extends JFrame implements MouseListener, MouseMotionListener {
JLayeredPane layeredPane;
JPanel chessBoard;
int cellSize;
private ImageIcon[] chessIcons;
private JLabel[] pieceLabels;
JLabel movingChessPiece;
int originXMove;
int originYMove;
int destXMove;
int destYMove;
boolean moveFreshness;
int xAdjustment;
int yAdjustment;
public ChessUI(){
this.cellSize = 60;
Dimension boardSize = new Dimension(8 * cellSize, 8 * cellSize);
// Use a Layered Pane for this this application
layeredPane = new JLayeredPane();
getContentPane().add(layeredPane);
layeredPane.setPreferredSize(boardSize);
layeredPane.addMouseListener(this);
layeredPane.addMouseMotionListener(this);
//Add a chess board to the Layered Pane
chessBoard = new JPanel();
layeredPane.add(chessBoard, JLayeredPane.DEFAULT_LAYER);
chessBoard.setLayout( new GridLayout(8, 8) );
chessBoard.setPreferredSize( boardSize );
chessBoard.setBounds(0, 0, boardSize.width, boardSize.height);
for (int i = 0; i < 64; i++) {
JPanel square = new JPanel( new BorderLayout() );
chessBoard.add( square );
square.setBackground( (i + i / 8) % 2 == 1 ? Color.GRAY : Color.WHITE );
}
initIcons();
initPieceLabels();
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pack();
setResizable(true);
setLocationRelativeTo( null );
setVisible(true);
}
/** ---------------------------------------------------------------------------------
* Chess piece graphics **/
private void initIcons() {
chessIcons = new ImageIcon[] {
new ImageIcon("./img/Chess_kdt60.png"),
new ImageIcon("./img/Chess_qdt60.png"),
new ImageIcon("./img/Chess_rdt60.png"),
new ImageIcon("./img/Chess_bdt60.png"),
new ImageIcon("./img/Chess_ndt60.png"),
new ImageIcon("./img/Chess_pdt60.png"),
new ImageIcon("./img/Chess_klt60.png"),
new ImageIcon("./img/Chess_qlt60.png"),
new ImageIcon("./img/Chess_rlt60.png"),
new ImageIcon("./img/Chess_blt60.png"),
new ImageIcon("./img/Chess_nlt60.png"),
new ImageIcon("./img/Chess_plt60.png")
};
}
private void initPieceLabels() {
pieceLabels = new JLabel[64];
for(int k = 0; k < 64; k++) {
JLabel label = new JLabel();
label.setVisible(false);
label.setSize(cellSize, cellSize);
pieceLabels[k] = label;
JPanel panel = (JPanel)chessBoard.getComponent(k);
panel.add(label);
}
}
private JLabel getPieceLabel(int row, int column) {
return pieceLabels[row * 8 + column];
}
private ImageIcon getImageIcon(Piece.Type type, ChessColor color) {
return chessIcons[type.ordinal() + (color == ChessColor.WHITE ? Piece.Type.values().length : 0)];
}
/**
* This method takes a piece of a color and places it in the specified coordinates.
* @param type Desired type
* @param color Desired color (should only be either Color.white or Color.black)
* @param coord Coordinates of the piece
*/
public void placePiece(Piece.Type type, ChessColor color, Coordinates coord) {
getPieceLabel(coord.getY(), coord.getX()).setIcon(getImageIcon(type, color));
getPieceLabel(coord.getY(), coord.getX()).setVisible(true);
}
/**
* This method removes the piece at the specified position, if there is any.
* @param coord Coordinates of the piece
*/
public void removePiece(Coordinates coord) {
getPieceLabel(coord.getY(), coord.getX()).setVisible(false);
}
/** ---------------------------------------------------------------------------------
* Events management **/
/**
* This method waits for the player to enter a move in the UI. Calling this is blocking.
*/
public FromTo waitForPlayerMove() {
moveFreshness = false;
while(! moveFreshness)
try {
synchronized (this.getClass()) {
this.getClass().wait();
}
}
catch (Exception e) {
System.err.println("ERROR : interrupted while waiting for chess move");
System.err.println(e);
System.exit(-1);
}
return new FromTo(originXMove, originYMove, destXMove, destYMove);
}
public void mousePressed(MouseEvent e){
movingChessPiece = null;
originXMove = e.getX() / cellSize;
originYMove = e.getY() / cellSize;
xAdjustment = - e.getX() + originXMove * cellSize;
yAdjustment = - e.getY() + originYMove * cellSize;
movingChessPiece = new JLabel(getPieceLabel(originYMove, originXMove).getIcon());
movingChessPiece.setVisible(getPieceLabel(originYMove, originXMove).isVisible());
movingChessPiece.setLocation(e.getX() + xAdjustment, e.getY() + yAdjustment);
if(movingChessPiece.getIcon() != null)
movingChessPiece.setSize(movingChessPiece.getIcon().getIconWidth(), movingChessPiece.getIcon().getIconHeight());
layeredPane.add(movingChessPiece, JLayeredPane.DRAG_LAYER);
}
//Move the chess piece around
public void mouseDragged(MouseEvent me) {
if (movingChessPiece == null) return;
movingChessPiece.setLocation(me.getX() + xAdjustment, me.getY() + yAdjustment);
}
//Drop the chess piece back onto the chess board
public void mouseReleased(MouseEvent e) {
if(movingChessPiece == null) return;
movingChessPiece.setVisible(false);
layeredPane.remove(movingChessPiece);
movingChessPiece = null;
destXMove = e.getX() / cellSize;
destYMove = e.getY() / cellSize;
moveFreshness = true;
synchronized (this.getClass()) {
this.getClass().notifyAll();
}
}
public void mouseClicked(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e) {}
public static void main(String[] args) {
ChessUI ui = new ChessUI();
ui.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
for(int k = 0; k < Piece.Type.values().length; k++)
ui.placePiece(Piece.Type.values()[k], ChessColor.BLACK, new Coordinates(k, 0));
for(int k = 0; k < Piece.Type.values().length; k++)
ui.placePiece(Piece.Type.values()[k], ChessColor.WHITE, new Coordinates(k, 1));
ui.pack();
ui.setResizable(true);
ui.setLocationRelativeTo( null );
ui.setVisible(true);
}
}
public class Coordinates{
private int x;
private int y;
public Coordinates(int x, int y){
this.x = x;
this.y = y;
}
public int getX(){
return x;
}
public int getY(){
return y;
}
@Override
public String toString(){
return "x= "+x+" y= "+y;
}
@Override
public boolean equals(Object o) {
if (this.getClass() != o.getClass()) return false;
if(this==o) return true;
Coordinates oCords = (Coordinates)o;
return this.x == oCords.x && this.y == oCords.y;
}
}
public class FromTo {
private final Coordinates from;
private final Coordinates to;
public FromTo(int ox, int oy, int dx, int dy) {
from = new Coordinates(ox,oy);
to = new Coordinates(dx,dy);
}
public Coordinates getFrom() {
return this.from;
}
public Coordinates getTo() {
return this.to;
}
}
import java.util.List;
import java.util.Stack;
public class GameUI {
public Board board;
private Player white;
private Player black;
private Player currentPlayer;
private ChessUI ui;
private Stack<Move> history;
public GameUI(ChessUI ui, String boardConfigFileName, Player white, Player black){
this.board = new Board(boardConfigFileName, white, black);
this.white = white;
this.black = black;
this.currentPlayer = white;
this.ui = ui;
this.history = new Stack<Move>();
for(Piece p : board.getPieces())
this.ui.placePiece(p.getType(), p.getColor(), p.getPosition());
}
public Board getBoard(){
return this.board;
}
public boolean undo(){
if(this.history.empty()) return false;
Move move = this.history.pop();
board.emptyCell(move.destination);
ui.removePiece(move.destination);
if(move.pieceAtDestination != null){
move.pieceAtDestination.setPosition(move.destination);
board.addPiece(move.pieceAtDestination);
ui.placePiece(move.pieceAtDestination.getType(), move.pieceAtDestination.getColor(), move.pieceAtDestination.getPosition());
}
board.emptyCell(move.origin);
ui.removePiece(move.origin);
move.pieceAtOrigin.setPosition(move.origin);
board.addPiece(move.pieceAtOrigin);
ui.placePiece(move.pieceAtOrigin.getType(), move.pieceAtOrigin.getColor(), move.pieceAtOrigin.getPosition());
currentPlayer = move.pieceAtOrigin.getOwner();
if(move.pieceAtDestination != null)
currentPlayer.removeFromScore(move.pieceAtDestination.getValue());
return true;
}
public boolean isMovePlayable(Move gameMove){
Piece piece = board.getPiece(gameMove.origin);
if(piece == null
||currentPlayer.getColor() != piece.getColor()
|| !gameMove.pieceAtOrigin.isMoveAuthorized(board, gameMove.destination)
|| gameMove.pieceAtOrigin.getOwner() != currentPlayer){
System.out.println("Le coups ne peut pas etre jouer 1");
return false;}
if (gameMove.pieceAtDestination != null
&& gameMove.pieceAtDestination.sameColor(gameMove.pieceAtOrigin)) {
System.out.println("Le coups ne peut pas etre jouer 2");
return false;}
applyMove(gameMove);
/**if (isCheck(getOpponent(currentPlayer))) {
undo();
return false;
}
***/
undo();
return true;
}
public void applyMove(Move move){
Piece piece = board.getPiece(move.origin);
history.push(move);
board.emptyCell(piece.getPosition());
piece.setPosition(move.destination);
board.addPiece(piece);
switchPlayers();
}
public void switchPlayers(){
this.currentPlayer = getOpponent(currentPlayer);
}
public Player getOpponent(Player player){
if (player == white) return black;
return player;
}
public boolean isPrey(Piece prey){
Player playerOp = getOpponent(prey.owner);
List<Move> opponentMoves = playerOp.getAllMoves(board);
for (Move move : opponentMoves) {
if (prey.equals(move.pieceAtDestination)) return true;
}
return false;
}
public boolean isCheck(Player player){return isPrey(player.getKing());}
public boolean isCheckMate(Player player){
return false;
}
public void determineWinner(){
}
public void play(){
int numberOfHits = 0;
while(numberOfHits < 50){
System.out.println("A toi de jouer " + currentPlayer.getColor());
Move move;
do {
move = new Move(board, currentPlayer.getFromTo());
}
while(!isMovePlayable(move));
applyMove(move);
ui.placePiece(move.pieceAtOrigin.getType(), move.pieceAtOrigin.getColor(), move.destination);
ui.removePiece(move.origin);
numberOfHits++;
switchPlayers();
numberOfHits ++;
System.out.println("Nombre de coups: " + numberOfHits+" /50");
switchPlayers();
}
}
}
public class Human extends Player{
ChessUI ui;
public Human(ChessUI ui, ChessColor color){
super(color);
this.ui = ui;
}
@Override
public FromTo getFromTo() {
return ui.waitForPlayerMove();
}
}
public class King extends Piece {
public King(int x, int y, Player owner){
super(x, y, owner);
owner.setKing(this);
}
public boolean isMoveAuthorized(Board board, Coordinates destination){
int dx = destination.getX();
int dy = destination.getY();
int ox = this.getX();
int oy = this.getY();
for(int i=-1;i<=1;i++) {
for(int j=-1; j<=1; j++) {
if( (dx-ox)==i && (dy-oy)==j && board.isEmptyCell(dx, dy)) {
return true;
}
}
}
return false;
}
@Override
public Type getType() {
return Type.KING;
}
@Override
public int getValue() {
return 0;
}
}
public class Knight extends Piece {
public Knight(int x, int y, Player owner){
super(x, y, owner);
}
public boolean isMoveAuthorized(Board board, Coordinates destination){
int dx = destination.getX();
int dy = destination.getY();
int ox = this.getX();
int oy = this.getY();
for(int i=-2; i <= 2; i++) {
for(int j=-2; j <= 2; j++) {
if(((dx-ox)%2==1 && (dy-oy)%2==0) || ((dx-ox)%2==0 && (dy-oy)%2==1)) {
return true;
}
}
}
return false;
}
@Override
public Type getType() {
return Type.KNIGHT;
}
@Override
public int getValue() {
return 3;
}
}
public class Main{
public static void main(String[] args) {
ChessUI ui = new ChessUI();
GameUI g = new GameUI(ui, "boardConfigurationFiles/FullBoard.txt", new Human(ui, ChessColor.WHITE), new Human(ui, ChessColor.BLACK));
g.play();
}
}
public class Move{
final Coordinates origin;
final Coordinates destination;
final Piece pieceAtOrigin;
final Piece pieceAtDestination;
public Move(Board board, Coordinates origin, Coordinates destination){
this.origin = origin;
this.destination = destination;
this.pieceAtOrigin = board.getPiece(origin);
this.pieceAtDestination = board.getPiece(destination);
}
public Move(Coordinates origin, Coordinates destination, Piece pieceAtOrigin, Piece pieceAtDestination){
this.origin = origin;
this.destination = destination;
this.pieceAtOrigin = pieceAtOrigin;
this.pieceAtDestination = pieceAtDestination;
}
public Move(Board board, FromTo ft){
this.origin = ft.getFrom();
this.destination = ft.getTo();
this.pieceAtOrigin = board.getPiece(ft.getFrom());
this.pieceAtDestination = board.getPiece(ft.getTo());
}
}
public class Pawn extends Piece {
public Pawn(int x, int y, Player owner){
super(x, y, owner);
}
public boolean isMoveAuthorized(Board board, Coordinates destination){
int dx = destination.getX();
int dy = destination.getY();
int ox = this.getX();
int oy = this.getY();
int absx = Math.abs(dx-ox);
int absy = Math.abs(dy-oy);
for(int i=0; i<=7; i++) {
if((oy==1 || oy == 6) && (absy==1 || absx == 2) && board.isEmptyCell(destination)&&absx==0) {return true;}
if((oy!=1 || oy!=6) && absy==1 && absx==0){return true;}
return false;
}
return true;
}
@Override
public Type getType() {
return Type.PAWN;
}
@Override
public int getValue() {
return 1;
}
}
import java.util.ArrayList;
import java.util.List;
public abstract class Piece{
protected Coordinates position;
protected Player owner;
public Piece(int x, int y, Player owner){
this.position = new Coordinates(x,y);
this.owner = owner;
}
public enum Type {
KING,
QUEEN,
ROOK,
BISHOP,
KNIGHT,
PAWN
}
public void setPosition(Coordinates destination){
this.position = destination;
}
public Player getOwner(){
return this.owner;
}
public ChessColor getColor(){
return this.owner.color;
}
public Coordinates getPosition(){
return this.position;
}
public int getX(){
return this.position.getX();
}
public int getY(){
return this.position.getY();
}
public List<Move> getAllMoves(Board board) {
List<Move> allMoves = new ArrayList<>();
for (Coordinates coordinates : board.getAllCoordinates()){
if (this.isMoveAuthorized(board,coordinates)){
allMoves.add(new Move(board, position, coordinates));
}
}
return allMoves;
}
public boolean sameColor(Piece piece){
return this.getColor()== piece.getColor();
}
public abstract boolean isMoveAuthorized(Board board, Coordinates destination);
public abstract Type getType();
public abstract int getValue();
}
import java.util.ArrayList;
import java.util.List;
public abstract class Player{
protected ChessColor color;
private int score;
private King king;
public boolean isCheck;
public boolean isCheckMate;
public Player(ChessColor color){
this.color = color;
this.score = 0;
this.isCheckMate = false;
}
public ChessColor getColor(){
return this.color;
}
public int getScore(){
return this.score;
}
public void addToScore(int value){
score+=value;
}
public void removeFromScore(int value){
score-= value;
}
public abstract FromTo getFromTo();
public Piece getKing(){
return this.king;
}
public void setKing(King king){
this.king=king;
}
public boolean isCheckMate(Board board){
return false;
}
public void setCheck(){
}
public void unSetCheck(){
}
public List<Move> getAllMoves(Board board) {
return null;
}
@Override
public String toString(){
return null;
}
}
public class Queen extends Piece {
public Queen(int x, int y, Player owner){
super(x, y, owner);
}
public boolean isMoveAuthorized(Board board, Coordinates destination){
int dx = destination.getX();
int dy = destination.getY();
int ox = this.getX();
int oy = this.getY();
Coordinates origin = new Coordinates(ox,oy);
for(int i=0; i<=7;i++) {
for(int j=0; j<=7;j++) {
if(board.sameColumnNothingBetween(origin,destination)&& dy<=7 && dy >=0) {return true;}
else if(board.sameRowNothingBetween(origin,destination)&& dx<=7 && dx>=0) {return true;}
else if(board.sameDiagonalNothingBetween(origin, destination) &&(dx-ox)%(dy-oy)==0) {return true;}
}
}
return false;
}
@Override
public Type getType() {
return Type.QUEEN;
}
@Override
public int getValue() {
return 9;
}
}