28 lines
564 B
C++
28 lines
564 B
C++
// #include "Fou.h"
|
|
|
|
Fou::Fou(int x, int y) : Piece(FOU, x, y) {
|
|
|
|
}
|
|
|
|
// ABSTRACT
|
|
bool Fou::can(int x, int y){
|
|
bool inDiag = abs( _x-x ) == abs( _y-y );
|
|
|
|
// Si deplacement pas en diagonale, on retourne faux
|
|
if( !inDiag ) return false;
|
|
|
|
// On verifie que la diagonale est degagee
|
|
int xstep = ( x-_x ) / abs( x-_x );
|
|
int ystep = ( y-_y ) / abs( y-_y );
|
|
|
|
// for( int i = _x+xstep, j = _y+ystep ; i != x && j != y ; i+=xstep, j+=ystep )
|
|
// if( ctx._p1->at(i, j) != NULL ) return false;
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
char Fou::getchar(){
|
|
return 'F';
|
|
}
|