head	1.17;
access;
symbols
	tonic_4:1.17
	tonic_3:1.17
	tonic_2:1.16
	demo:1.16.0.2
	design_report:1.16
	DAVEG_CDP:1.1.0.2;
locks; strict;
comment	@ * @;


1.17
date	95.12.15.11.04.34;	author hartmans;	state Exp;
branches;
next	1.16;

1.16
date	95.12.12.10.25.19;	author daveg;	state Exp;
branches;
next	1.15;

1.15
date	95.12.11.11.24.13;	author daveg;	state Exp;
branches;
next	1.14;

1.14
date	95.12.07.17.15.53;	author daveg;	state Exp;
branches;
next	1.13;

1.13
date	95.12.06.21.06.21;	author daveg;	state Exp;
branches;
next	1.12;

1.12
date	95.12.06.14.12.35;	author daveg;	state Exp;
branches;
next	1.11;

1.11
date	95.12.05.10.53.16;	author daveg;	state Exp;
branches;
next	1.10;

1.10
date	95.12.04.21.03.50;	author daveg;	state Exp;
branches;
next	1.9;

1.9
date	95.12.04.18.41.44;	author daveg;	state Exp;
branches;
next	1.8;

1.8
date	95.12.04.08.44.22;	author daveg;	state Exp;
branches;
next	1.7;

1.7
date	95.12.04.07.34.03;	author daveg;	state Exp;
branches;
next	1.6;

1.6
date	95.12.04.07.06.02;	author daveg;	state Exp;
branches;
next	1.5;

1.5
date	95.12.04.02.46.02;	author daveg;	state Exp;
branches;
next	1.4;

1.4
date	95.12.03.19.56.06;	author hartmans;	state Exp;
branches;
next	1.3;

1.3
date	95.12.03.09.44.41;	author daveg;	state Exp;
branches;
next	1.2;

1.2
date	95.12.01.23.02.48;	author hartmans;	state Exp;
branches;
next	1.1;

1.1
date	95.11.30.10.24.24;	author daveg;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	95.11.30.10.24.25;	author daveg;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	95.12.01.04.53.10;	author daveg;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	95.12.01.13.58.07;	author daveg;	state Exp;
branches;
next	;


desc
@@


1.17
log
@Add a destructor for antichess_move_gen
@
text
@#include <move_generator.h>
#include <chess_capture_move.h>
#include <antichess_board.h>

class antichess_move_gen : public move_generator {
public:

    antichess_move_gen(const array <chess_capture_move> *m);
    // Effects: constructs a generator that returns all the valid
    // moves at the current time.
    virtual ~antichess_move_gen();
    bool get(move *&m);
    // Modifies: this
    // Effects:  If more moves remain, returns true and sets m to be a pointer
    //  to the next move, else returns false.

private:
    int index;
    int length;
    const array <chess_capture_move> *a;
};

antichess_move_gen::antichess_move_gen (const array <chess_capture_move> *m) {
  index = 0;
  a = m;
  length = m->length();
}

antichess_move_gen::~antichess_move_gen() {
    delete (array <chess_capture_move> * )a;
}

bool antichess_move_gen::get (move *&m) {
  if (index >= length)
    return false;
  
  m = &a->operator[](index++);
  return true;
}

void add_to_array(chess_capture_move mv,array<chess_capture_move> *forces,
		  array<chess_capture_move> *normal){
    
    if (mv.get_piece_taken() != chess_display_board::none)
	forces->append(mv);
    else
	normal->append(mv);
}


move_generator* antichess_board::valid_moves(int p) const{
    int x1, y1,x,y;
    bool is_queen = false;
    int dir;
    antichess_board *b = (antichess_board *) this;
    bool top_right_loop = true;
    bool top_left_loop = true;
    bool bottom_right_loop = true;
    bool bottom_left_loop = true;
    int pieces_to_find;
    array<chess_capture_move> *possible_moves_p=new array <chess_capture_move>;
    array <chess_capture_move> &possible_moves = *possible_moves_p;
    array<chess_capture_move> *forced_moves_p = new array <chess_capture_move>;
    array <chess_capture_move> &forced_moves = *forced_moves_p;

    if (p != current_player())
	return new antichess_move_gen(possible_moves_p);
    
    pieces_to_find = pieces_remaining(p);
        
    color capture_color, this_color;
    if (p==0){
	capture_color = black;
	this_color = white;
	dir = 1;
    }
    else if (p==1){
	capture_color = white;
	this_color = black;
	dir = -1;
    }
    else
	check(p==1,"Invalid player");
    
    for(y1=0;y1<8;y1++)
	for(x1=0;x1<8;x1++){
	    
	    if (pieces_to_find<=0)
		break;
	    
	    if (b->fetch(y1,x1).piece_color != this_color)
		continue;
	    
	    is_queen = false;
	    
	    pieces_to_find--;
	    
	    switch(b->fetch(y1,x1).piece_type){
	    case invalid:  break;  //this should never happen
	    case none:     break;
	    case pawn:
		// Check for 1 forward, not capture
		if ((y1+dir < 8) && (y1 +dir >=0) &&
		    (b->fetch(y1+dir,x1).piece_type == none)){
		    chess_capture_move temp(x1,y1,x1,y1+dir,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		
		// Check for moving 2 forward
		// There was already a check that x2,y2 was legal place to be
		if (((y1==1) && (this_color==white)) ||
		    ((y1==6) && (this_color==black)))
		    if ((y1+2*dir < 8) && (y1 +2*dir >=0) &&
			(b->fetch(y1+2*dir,x1).piece_type == none) &&
			(b->fetch(y1+dir,x1).piece_type == none)){
			chess_capture_move temp(x1,y1,x1,y1+2*dir,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		
		// Check for captures
		if ((y1+dir < 8) && (y1+dir>=0) && (x1+1 < 8) &&
		    (b->fetch(y1+dir,x1+1).piece_color == capture_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1+dir,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1+dir < 8) && (y1+dir>=0) && (x1-1 >= 0) &&
		    (b->fetch(y1+dir,x1-1).piece_color == capture_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1+dir,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		break;
		
	    case knight:
		if ((y1+2 < 8) && (x1+1 < 8) &&
		    (b->fetch(y1+2,x1+1).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1+2,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1+2 < 8) && (x1-1 >= 0) &&
		    (b->fetch(y1+2,x1-1).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1+2,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1-2 >=0) && (x1+1 <8) &&
		    (b->fetch(y1-2,x1+1).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1-2,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1-2 >= 0) && (x1-1 >= 0) &&
		    (b->fetch(y1-2,x1-1).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1-2,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1+1 < 8) && (x1+2 <8) &&
		    (b->fetch(y1+1,x1+2).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1+2,y1+1,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1-1 >= 0) && (x1+2 <8) &&
		    (b->fetch(y1-1,x1+2).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1+2,y1-1,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1+1 < 8) && (x1-2 >= 0) &&
		    (b->fetch(y1+1,x1-2).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1-2,y1+1,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		if ((y1-1 >= 0) && (x1-2 >= 0) &&
		    (b->fetch(y1-1,x1-2).piece_color != this_color)){
		    chess_capture_move temp(x1,y1,x1-2,y1-1,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
		break;
		
	    case queen:
		is_queen =true;
		// then fall through: queen = rook+bishop		
	    case rook:
		for(x=x1+1;x<8;x++){
		    if (b->fetch(y1,x).piece_type == none){
			chess_capture_move temp(x1,y1,x,y1,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else {
			if (b->fetch(y1,x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x,y1,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			break;
		    }
		}

		for(x=x1-1;x>=0;x--){
		    if (b->fetch(y1,x).piece_type == none){
			chess_capture_move temp(x1,y1,x,y1,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else {
			if (b->fetch(y1,x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x,y1,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			break;
		    }
		}

		for(y=y1+1;y<8;y++){
		    if (b->fetch(y,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,y,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else {
			if (b->fetch(y,x1).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,y,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			break;
		    }
		}

		for(y=y1-1;y>=0;y--){
		    if (b->fetch(y,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,y,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else {
			if (b->fetch(y,x1).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,y,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			break;
		    }
		}
		
		if (!is_queen)
		    break;
		
	    case bishop:
		top_right_loop = true;
		top_left_loop = true;
		bottom_right_loop = true;
		bottom_left_loop = true;
		
		for(x=1;x<8;x++){
		    
		    if (top_right_loop && (x1+x<8) && (y1+x<8)) {
			if (b->fetch(y1+x,x1+x).piece_type == none){
			    chess_capture_move temp(x1,y1,x1+x,y1+x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else if (b->fetch(y1+x,x1+x).piece_color == 
				capture_color) {
			    top_right_loop = false;
			    chess_capture_move temp(x1,y1,x1+x,y1+x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else
			    top_right_loop = false;
		    }			
	
		    if (bottom_right_loop && (x1+x<8) && (y1-x>=0)){
			if (b->fetch(y1-x,x1+x).piece_type == none){
			    chess_capture_move temp(x1,y1,x1+x,y1-x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else if (b->fetch(y1-x,x1+x).piece_color == 
				 capture_color){
			    bottom_right_loop = false;
			    chess_capture_move temp(x1,y1,x1+x,y1-x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else
			    bottom_right_loop = false;
		    }
		    
		    if (top_left_loop && (x1-x>=0) && (y1+x<8)){
			if (b->fetch(y1+x,x1-x).piece_type == none){
			    chess_capture_move temp(x1,y1,x1-x,y1+x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else if (b->fetch(y1+x,x1-x).piece_color == 
				 capture_color){
			    top_left_loop = false;
			    chess_capture_move temp(x1,y1,x1-x,y1+x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else
			    top_left_loop = false;
		    }

		    if (bottom_left_loop && (x1-x>=0) && (y1-x>=0)){
			if (b->fetch(y1-x,x1-x).piece_type == none){
			    chess_capture_move temp(x1,y1,x1-x,y1-x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else if (b->fetch(y1-x,x1-x).piece_color == 
				 capture_color) {
			    bottom_left_loop = false;
			    chess_capture_move temp(x1,y1,x1-x,y1-x,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
			else
			    bottom_left_loop = false;
		    }		    

		}
		break;
		
	    case king:
		for(y=y1-1;y<=y1+1;y++)
		    for(x=x1-1;x<=x1+1;x++){
			if (((x==x1) && (y==y1)) ||
			    (y < 0) ||
			    (y > 7) ||
			    (x < 0) ||
			    (x > 7))
			    continue;
			if (b->fetch(y,x).piece_color != this_color){
			    chess_capture_move temp(x1,y1,x,y,b);
			    add_to_array(temp,forced_moves_p,possible_moves_p);
			}
		    }
		break;
	    }
	}

    if (forced_moves.length() != 0)
	return new antichess_move_gen(forced_moves_p);
    else
	return new antichess_move_gen(possible_moves_p);
}


@


1.16
log
@bug fix on bishop moves
@
text
@d11 1
a11 1

d28 4
@


1.15
log
@bug fixes
@
text
@d236 4
@


1.14
log
@and even more bug fixes
@
text
@d90 2
d108 1
a108 1
		     ((y1==6) && (this_color==black)))
d123 1
a123 1
		(b->fetch(y1+dir,x1-1).piece_color == capture_color)){
a299 1
		
@


1.13
log
@fixed rook problem
@
text
@a36 2
static bool capture_found;

d40 2
a41 11
    extensions b;
    
//    mv.display(&b, cout);
    if (!capture_found){
	if (mv.get_piece_taken() != chess_display_board::none){
	    capture_found = true;
	    forces->append(mv);
	}
	else
	    normal->append(mv);
    }
d43 1
a43 1
	forces->append(mv);
d61 1
a61 2
    capture_found = false;
    
d105 8
a112 6
		if ((y1+2*dir < 8) && (y1 +2*dir >=0) &&
		    (b->fetch(y1+2*dir,x1).piece_type == none) &&
		    (b->fetch(y1+dir,x1).piece_type == none)){
		    chess_capture_move temp(x1,y1,x1,y1+2*dir,b);
		    add_to_array(temp, forced_moves_p, possible_moves_p);
		}
d120 1
a120 1
		if ((y1+dir < 8) && (y1+dir>=0) && (x1-1 > 0) &&
d202 3
a204 3
		for(x=y1+1;x<8;x++){
		    if (b->fetch(x,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,x,b);
d208 2
a209 2
			if (b->fetch(y1,x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,x,b);
d216 3
a218 3
		for(x=y1-1;x>=0;x--){
		    if (b->fetch(x,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,x,b);
d222 2
a223 2
			if (b->fetch(y1,x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,x,b);
d242 3
a244 2
			else  if (b->fetch(y1+x,x1+x).piece_color == 
				  capture_color) {
d259 1
d274 1
d289 1
d302 10
a311 8
		for(x=-1;x<2;x++)
		    for(y=-1;y<2;y++){
			if (!x && !y)
			    break;
			if ((y1+y<0)||(y1+y>7)||(x1+x<7)||(x+x1>7))
			    break;
			if (b->fetch(y1+y,x1+x).piece_color != this_color){
			    chess_capture_move temp(x1,y1,x1+x,y1+y,b);
d318 2
a319 2
    if (forced_moves.length() != 0) {
	cout << forced_moves.length() << "\n";
a320 1
    }
@


1.12
log
@bug fixes
@
text
@d219 1
a219 1
			    chess_capture_move temp(x1,y1,x1,y1+x,b);
@


1.11
log
@a few more bug fixes
@
text
@d19 1
d26 1
d30 1
a30 1
  if ( index == a->length())
d41 4
d100 1
a100 1
		break;
d119 1
a119 1
		    (b->fetch(y1+dir,x1).piece_type != none)){
a125 1
		    (b->fetch(y1+dir,x1+1).piece_type != none) &&
a130 1
		(b->fetch(y1+dir,x1-1).piece_type != none) &&
d139 1
a139 1
		    (b->fetch(y1+2,x1+1).piece_color != capture_color)){
d143 2
a144 2
		if ((y1+2 < 8) && (x1-1 > 0) &&
		    (b->fetch(y1+2,x1-1).piece_color != capture_color)){
d148 2
a149 2
		if ((y1-2 >0) && (x1+1 <8) &&
		    (b->fetch(y1-2,x1+1).piece_color != capture_color)){
d153 2
a154 2
		if ((y1-2 > 0) && (x1-1 > 0) &&
		    (b->fetch(y1-2,x1-1).piece_color != capture_color)){
d159 1
a159 1
		    (b->fetch(y1+1,x1+2).piece_color != capture_color)){
d163 2
a164 2
		if ((y1-1 > 0) && (x1+2 <8) &&
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d168 2
a169 2
		if ((y1+1 < 8) && (x1-2 > 0) &&
		    (b->fetch(y1+1,x1-2).piece_color != capture_color)){
d173 2
a174 2
		if ((y1-1 > 0) && (x1-2 > 0) &&
		    (b->fetch(y1-1,x1-2).piece_color != capture_color)){
d186 1
a186 1
			chess_capture_move temp(x1,y1,x1+x,y1,b);
d189 1
a189 1
		    if(x!=8){
d191 1
a191 1
			    chess_capture_move temp(x1,y1,x1+x,y1,b);
d200 1
a200 1
			chess_capture_move temp(x1,y1,x1-x,y1,b);
d203 1
a203 1
		    if(x!=-1){
d205 1
a205 1
			    chess_capture_move temp(x1,y1,x1-x,y1,b);
d214 1
a214 1
			chess_capture_move temp(x1,y1,x1,y1+x,b);
d217 1
a217 1
		    if(x!=8){
d228 1
a228 1
			chess_capture_move temp(x1,y1,x1,y1-x,b);
d231 1
a231 1
		    if(x!=-1){
d233 1
a233 1
			    chess_capture_move temp(x1,y1,x1,y1-x,b);
d245 1
a245 1
		for(x=0;x<8;x++){
d247 40
a286 7

		    if ((x1+x>8) || (y1+x>8))
			top_right_loop = false;
		    if (top_right_loop &&
			(b->fetch(y1+x,x1+x).piece_color != this_color)){
			chess_capture_move temp(x1,y1,x1+x,y1+x,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
a287 2
		    else
			top_right_loop = false;
d289 13
a302 29
		    if ((x1+x>8) || (y1-x<0))
			bottom_right_loop = false;
		    if (bottom_right_loop &&
			(b->fetch(y1-x,x1+x).piece_color != this_color)){
			chess_capture_move temp(x1,y1,x1+x,y1-x,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else
			bottom_right_loop = false;
		    
		    if ((x1-x<0) || (y1+x>8))
			top_left_loop = false;
		    if (top_left_loop &&
			(b->fetch(y1+x,x1-x).piece_color != this_color)){
			chess_capture_move temp(x1,y1,x1-x,y1+x,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else
			top_left_loop = false;
		    
		    if ((x1-x<0) || (y1-x<0))
			bottom_left_loop = false;
		    if (bottom_left_loop &&
			(b->fetch(y1-x,x1-x).piece_color != this_color)){
			chess_capture_move temp(x1,y1,x1-x,y1-x,b);
			add_to_array(temp, forced_moves_p, possible_moves_p);
		    }
		    else
			bottom_left_loop = false;
d322 5
a326 1
    if (forced_moves.length == 0)
a327 2
    else
	return new antichess_move_gen(forced_moves_p);
@


1.10
log
@more bug fixes...
@
text
@d79 1
a79 1
    if (p==1){
d84 2
a210 1
			possible_moves.append(temp);
@


1.9
log
@bug fixes
@
text
@d153 1
a153 1
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d240 1
a240 1
		for(x=x1+1;x<8;x++){
d256 1
a256 1
		    if (top_left_loop &&
@


1.8
log
@bug fixes
@
text
@d35 1
a35 5
static array<chess_capture_move> *possible_moves_p = new array <chess_capture_move>;
static array <chess_capture_move> &possible_moves = *possible_moves_p;
static array<chess_capture_move> *forced_moves_p = new array <chess_capture_move>;
static array <chess_capture_move> &forced_moves = *forced_moves_p;
static bool capture_found = false;
d37 2
a38 1
void add_to_array(chess_capture_move mv){
d42 1
a42 1
	    forced_moves.append(mv);
d45 1
a45 1
	    possible_moves.append(mv);
d48 1
a48 1
	forced_moves.append(mv);
d62 6
a67 1

d104 1
a104 1
		    add_to_array(temp);
d113 1
a113 1
		    add_to_array(temp);
d121 1
a121 1
		    add_to_array(temp);
d127 1
a127 1
		    add_to_array(temp);
d135 1
a135 1
		    add_to_array(temp);
d140 1
a140 1
		    add_to_array(temp);
d145 1
a145 1
		    add_to_array(temp);
d150 1
a150 1
		    add_to_array(temp);
d155 1
a155 1
		    add_to_array(temp);
d160 1
a160 1
		    add_to_array(temp);
d165 1
a165 1
		    add_to_array(temp);
d170 1
a170 1
		    add_to_array(temp);
d181 1
a181 1
			add_to_array(temp);
d186 1
a186 1
			    add_to_array(temp);
d195 1
a195 1
			add_to_array(temp);
d200 1
a200 1
			    add_to_array(temp);
d210 1
a210 1
			add_to_array(temp);
d215 1
a215 1
			    add_to_array(temp);
d224 1
a224 1
			add_to_array(temp);
d229 1
a229 1
			    add_to_array(temp);
d248 1
a248 1
			add_to_array(temp);
d259 1
a259 1
			add_to_array(temp);
d269 1
a269 1
			add_to_array(temp);
d279 1
a279 1
			add_to_array(temp);
d296 1
a296 1
			    add_to_array(temp);
@


1.7
log
@more bug fixes
@
text
@d31 1
a31 1
  m = &a->fetch(index++);
@


1.6
log
@bug fixes
@
text
@d272 1
a272 1
		    if ((x1-x>8) || (y1-x>8))
@


1.5
log
@bug fixes
@
text
@d177 1
a177 1
		    if (b->fetch(y1,x1+x).piece_type == none){
d182 1
a182 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d191 1
a191 1
		    if (b->fetch(y1,x1-x).piece_type == none){
d196 1
a196 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d205 1
a205 1
		    if (b->fetch(y1+x,x1).piece_type == none){
d210 2
a211 2
		    if(y!=8){
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d220 1
a220 1
		    if (b->fetch(y1-x,x1).piece_type == none){
d224 2
a225 2
		    if(y!=-1){
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d289 2
@


1.4
log
@Make antichess/Makefile

	This sort of compiles until you get to antichess_board.C.
@
text
@d35 18
a55 2
    array<chess_capture_move> *possible_moves_p = new array <chess_capture_move>;
    array <chess_capture_move> &possible_moves = *possible_moves_p;
d59 1
a59 1
    register antichess_board *b = (antichess_board *) this;
d102 1
a102 1
		    possible_moves.append(temp);
d111 1
a111 1
		    possible_moves.append(temp);
d119 1
a119 1
		    possible_moves.append(temp);
d125 1
a125 1
		    possible_moves.append(temp);
d133 1
a133 1
		    possible_moves.append(temp);
d138 1
a138 1
		    possible_moves.append(temp);
d143 1
a143 1
		    possible_moves.append(temp);
d148 1
a148 1
		    possible_moves.append(temp);
d153 1
a153 1
		    possible_moves.append(temp);
d158 1
a158 1
		    possible_moves.append(temp);
d163 1
a163 1
		    possible_moves.append(temp);
d168 1
a168 1
		    possible_moves.append(temp);
d179 1
a179 1
			possible_moves.append(temp);
d184 1
a184 1
			    possible_moves.append(temp);
d193 1
a193 1
			possible_moves.append(temp);
d198 1
a198 1
			    possible_moves.append(temp);
d208 1
d213 1
a213 1
			    possible_moves.append(temp);
d222 1
a222 1
			possible_moves.append(temp);
d227 1
a227 1
			    possible_moves.append(temp);
d246 1
a246 1
			possible_moves.append(temp);
d257 1
a257 1
			possible_moves.append(temp);
d267 1
a267 1
			possible_moves.append(temp);
d277 1
a277 1
			possible_moves.append(temp);
d292 1
a292 1
			    possible_moves.append(temp);
a296 2
	    
	    return new antichess_move_gen(possible_moves_p);
d298 4
@


1.3
log
@added turn alternating
@
text
@d38 2
a39 1
    array<chess_capture_move> possible_moves;
d50 2
a51 2
    if (p != player_turn)
	return possible_moves;
d281 1
a281 1
	    return new antichess_move_gen(&possible_moves);
d285 1
@


1.2
log
@Integrate Antichess boarrd from DAVEG_CPD
@
text
@d49 3
d84 1
a84 3
		    chess_capture_move temp(x1,y1,x1,y1+dir,
					    b->fetch(y1+dir,x1).piece_type,
					    b->fetch(y1+dir,x1).piece_color);
d93 1
a93 3
		    chess_capture_move temp(x1,y1,x1,y1+2*dir,
					b->fetch(y1+2*dir,x1).piece_type,
					b->fetch(y1+2*dir,x1).piece_color);
d101 1
a101 3
		    chess_capture_move temp(x1,y1,x1+1,y1+dir,
					b->fetch(y1+dir,x1+1).piece_type,
					b->fetch(y1+dir,x1+1).piece_color);
d107 1
a107 3
		    chess_capture_move temp(x1,y1,x1-1,y1+dir,
					b->fetch(y1+dir,x1-1).piece_type,
					b->fetch(y1+dir,x1-1).piece_color);
d115 1
a115 3
		    chess_capture_move temp(x1,y1,x1+1,y1+2,
					b->fetch(y1+2,x1+1).piece_type,
					b->fetch(y1+2,x1+1).piece_color);
d120 1
a120 3
		    chess_capture_move temp(x1,y1,x1-1,y1+2,
					b->fetch(y1+2,x1-1).piece_type,
					b->fetch(y1+2,x1-1).piece_color);
d125 1
a125 3
		    chess_capture_move temp(x1,y1,x1+1,y1-2,
					b->fetch(y1-2,x1+1).piece_type,
					b->fetch(y1-2,x1+1).piece_color);
d130 1
a130 3
		    chess_capture_move temp(x1,y1,x1-1,y1-2,
					b->fetch(y1-2,x1-1).piece_type,
					b->fetch(y1-2,x1-1).piece_color);
d135 1
a135 3
		    chess_capture_move temp(x1,y1,x1+2,y1+1,
					b->fetch(y1+dir,x1-1).piece_type,
					b->fetch(y1+dir,x1-1).piece_color);
d140 1
a140 3
		    chess_capture_move temp(x1,y1,x1+2,y1-1,
					b->fetch(y1-1,x1+2).piece_type,
					b->fetch(y1-1,x1+2).piece_color);
d145 1
a145 3
		    chess_capture_move temp(x1,y1,x1-2,y1+1,
					b->fetch(y1+1,x1-2).piece_type,
					b->fetch(y1+1,x1-2).piece_color);
d150 1
a150 3
		    chess_capture_move temp(x1,y1,x1-2,y1-1,
					b->fetch(y1-1,x1-2).piece_type,
					b->fetch(y1-1,x1-2).piece_color);
d161 1
a161 3
			chess_capture_move temp(x1,y1,x1+x,y1,
						b->fetch(y1,x1+x).piece_type,
						b->fetch(y1,x1+x).piece_color);
d166 1
a166 4
			    chess_capture_move temp(x1,y1,x1+x,y1,
						    b->fetch(y1,
							     x1+x).piece_type,
						    b->fetch(y1,x1+x).piece_color);
d175 1
a175 3
			chess_capture_move temp(x1,y1,x1-x,y1,
						b->fetch(y1,x1-x).piece_type,
						b->fetch(y1,x1-x).piece_color);
d180 1
a180 3
			    chess_capture_move temp(x1,y1,x1-x,y1,
						    b->fetch(y1,x1-x).piece_type,
						    b->fetch(y1,x1-x).piece_color);
d189 1
a189 3
			chess_capture_move temp(x1,y1,x1,y1+x,
						b->fetch(y1+x,x1).piece_type,
						b->fetch(y1+x,x1).piece_color);
d194 1
a194 3
			    chess_capture_move temp(x1,y1,x1,y1+x,
						    b->fetch(y1+x,x1).piece_type,
						    b->fetch(y1+x,x1).piece_color);
d203 1
a203 3
			chess_capture_move temp(x1,y1,x1,y1-x,
						b->fetch(y1-x,x1).piece_type,
						b->fetch(y1-x,x1).piece_color);
d208 1
a208 3
			    chess_capture_move temp(x1,y1,x1,y1-x,
						    b->fetch(y1-x,x1).piece_type,
						    b->fetch(y1-x,x1).piece_color);
d227 1
a227 3
			chess_capture_move temp(x1,y1,x1+x,y1+x,
						b->fetch(y1+x,x1+x).piece_type,
						b->fetch(y1+x,x1+x).piece_color);
d238 1
a238 3
			chess_capture_move temp(x1,y1,x1+x,y1-x,
						b->fetch(y1-x,x1+x).piece_type,
						b->fetch(y1-x,x1+x).piece_color);
d248 1
a248 3
			chess_capture_move temp(x1,y1,x1-x,y1+x,
						b->fetch(y1+x,x1-x).piece_type,
						b->fetch(y1+x,x1-x).piece_color);
d258 1
a258 3
			chess_capture_move temp(x1,y1,x1-x,y1-x,
						b->fetch(y1-x,x1-x).piece_type,
						b->fetch(y1-x,x1-x).piece_color);
d273 1
a273 3
			    chess_capture_move temp(x1,y1,x1+x,y1+y,
						    b->fetch(y1+y,x1+x).piece_type,
						    b->fetch(y1+y,x1+x).piece_color);
@


1.1
log
@file antichess_valid_moves.C was initially added on branch DAVEG_CDP.
@
text
@d1 331
@


1.1.2.1
log
@valid moves generator
@
text
@a0 286
#include <move_generator.h>

class antichess_move_gen : public move_generator {
public:

    antichess_move_gen(const array <chess_capture_move> *moves);
    // Effects: constructs a generator that returns all the valid
    // moves at the current time.

    bool get(move &m);
    // Modifies: this
    // Effects:  If more moves remain, returns true and sets m to be a pointer
    //  to the next move, else returns false.

private:
    int index;
    const array <move> *a;
};

antichess_move_gen::antichess_move_gen (const array <move> *moves) {
  index = 0;
  a = history;
}

bool antichess_move_gen::get (move &m) {
  if ( index == a->length())
    return false;
  
  m = a->fetch(index++);
  return true;
}



move_generator* antichess_board::valid_moves(int p) const{
    array<move> possible_moves;
    int x1, y1,x,y;
    bool is_queen = false;
    int dir;
    antichess_board &b = *this;
    
    color capture_color, this_color;
    if (p=0){
	capture_color = black;
	this_color = white;
	dir = 1;
    }
    if (p=1){
	capture_color = white;
	this_color = black;
	dir = -1;
    }
    
    for(y1=0;y1<8;y1++)
	for(x1=0;x1<8;x1++){
	    
	    if (b(y1,x1).piece_color != this_color)
		break;
	    
	    switch(b(y1,x1).piece_type){
	    case invalid:  break;  //this should never happen
	    case none:     break;
	    case pawn:
		// Check for 1 forward, not capture
		if ((y1+dir < 8) && (y1 +dir >=0) &&
		    (b(y1+dir,x1).piece_type == none)){
		    chess_capture_move temp(x1,y1,x1,y1+dir,
					b(y1+dir,x1).piece_type);
		    possible_moves.append(temp);
		}
		
		// Check for moving 2 forward
		// There was already a check that x2,y2 was legal place to be
		if ((y1+2*dir < 8) && (y1 +2*dir >=0) &&
		    (b(y1+2*dir,x1).piece_type == none) &&
		    (b(y1+dir,x1).piece_type != none)){
		    chess_capture_move temp(x1,y1,x1,y1+2*dir,
					b(y1+2*dir,x1).piece_type);
		    possible_moves.append(temp);
		}
		
		// Check for captures
		if ((y1+dir < 8) && (y1+dir>=0) && (x1+1 < 8) &&
		    (b(y1+dir,x1+1).piece_type != none) &&
		    (b(y1+dir,x1+1).piece_color == capture_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1+dir,
					b(y1+dir,x1+1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1+dir < 8) && (y1+dir>=0) && (x1-1 > 0) &&
		(b(y1+dir,x1-1).piece_type != none) &&
		(b(y1+dir,x1-1).piece_color == capture_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1+dir,
					b(y1+dir,x1-1).piece_type);
		    possible_moves.append(temp);
		}
		break;
		
	    case knight:
		if ((y1+2 < 8) && (x1+1 < 8) &&
		    (b(y1+2,x1+1).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1+2,
					b(y1+2,x1+1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1+2 < 8) && (x1-1 > 0) &&
		    (b(y1+2,x1-1).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1+2,
					b(y1+2,x1-1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1-2 >0) && (x1+1 <8) &&
		    (b(y1-2,x1+1).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1+1,y1-2,
					b(y1-2,x1+1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1-2 > 0) && (x1-1 > 0) &&
		    (b(y1-2,x1-1).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1-1,y1-2,
					b(y1-2,x1-1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1+1 < 8) && (x1+2 <8) &&
		    (b(y1-1,x1+2).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1+2,y1+1,
					b(y1+dir,x1-1).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1-1 > 0) && (x1+2 <8) &&
		    (b(y1-1,x1+2).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1+2,y1-1,
					b(y1-1,x1+2).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1+1 < 8) && (x1-2 > 0) &&
		    (b(y1+1,x1-2).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1-2,y1+1,
					b(y1+1,x1-2).piece_type);
		    possible_moves.append(temp);
		}
		if ((y1-1 > 0) && (x1-2 > 0) &&
		    (b(y1-1,x1-2).piece_color != capture_color)){
		    chess_capture_move temp(x1,y1,x1-2,y1-1,
					b(y1-1,x1-2).piece_type);
		    possible_moves.append(temp);
		}
		break;
		
	    case queen:
		is_queen =true;
		// then fall through: queen = rook+bishop		
	    case rook:
		for(x=x1+1;x<8;x++){
		    if (b(y1,x1+x).piece_type == none){
			chess_capture_move temp(x1,y1,x1+x,y1,
						b(y1,x1+x).piece_type);
			possible_moves.append(temp);
		    }
		    if(x!=8){
			if (b(y1,x1+x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1+x,y1,
						    b(y1,x1+x).piece_type);
			    possible_moves.append(temp);
			}
			break;
		    }
		}

		for(x=x1-1;x>=0;x--){
		    if (b(y1,x1-x).piece_type == none){
			chess_capture_move temp(x1,y1,x1-x,y1,
						b(y1,x1-x).piece_type);
			possible_moves.append(temp);
		    }
		    if(x!=-1){
			if (b(y1,x1+x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1-x,y1,
						    b(y1,x1-x).piece_type);
			    possible_moves.append(temp);
			}
			break;
		    }
		}

		for(x=y1+1;x<8;x++){
		    if (b(y1+x,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,y1+x,
						b(y1+x,x1).piece_type);
			possible_moves.append(temp);
		    }
		    if(y!=8){
			if (b(y1,x1+x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,y1+x,
						    b(y1+x,x1).piece_type);
			    possible_moves.append(temp);
			}
			break;
		    }
		}

		for(x=y1-1;x>=0;x--){
		    if (b(y1-x,x1).piece_type == none){
			chess_capture_move temp(x1,y1,x1,y1-x,
						b(y1-x,x1).piece_type);
			possible_moves.append(temp);
		    }
		    if(y!=-1){
			if (b(y1,x1+x).piece_color == capture_color){
			    chess_capture_move temp(x1,y1,x1,y1-x,
						    b(y1-x,x1).piece_type);
			    possible_moves.append(temp);
			}
			break;
		    }
		}
		
		if (!is_queen)
		    break;
		
	    case bishop:
		for(x=x1+1;x<8;x++){
		    if ((x1+x>8) || (y1+x>8))
			break;
		    if (b(y1+x,x1+x).piece_color != this_color){
			chess_capture_move temp(x1,y1,x1+x,y1+x,
						b(y1+x,x1+x).piece_type);
			possible_moves.append(temp);
		    }
		    else
			break;
		}
		for(x=x1+1;x<8;x++){
		    if ((x1+x>8) || (y1-x<0))
			break;
		    if (b(y1-x,x1+x).piece_color != this_color){
			chess_capture_move temp(x1,y1,x1+x,y1-x,
						b(y1-x,x1+x).piece_type);
			possible_moves.append(temp);
		    }
		    else
			break;
		}
		for(x=x1+1;x<8;x++){
		    if ((x1-x<0) || (y1+x>8))
			break;
		    if (b(y1+x,x1-x).piece_color != this_color){
			chess_capture_move temp(x1,y1,x1-x,y1+x,
						b(y1+x,x1-x).piece_type);
			possible_moves.append(temp);
		    }
		    else
			break;
		}
		for(x=x1+1;x<8;x++){
		    if ((x1-x>8) || (y1-x>8))
			break;
		    if (b(y1-x,x1-x).piece_color != this_color){
			chess_capture_move temp(x1,y1,x1-x,y1-x,
						b(y1-x,x1-x).piece_type);
			possible_moves.append(temp);
		    }
		    else
			break;
		}
		
		break;
		
	    case king:
		for(x=-1;x<2;x++)
		    for(y=-1;y<2;y++){
			if (!x && !y)
			    break;
			if (b(y1+y,x1+x).piece_color != this_color){
			    chess_capture_move temp(x1,y1,x1+x,y1+y,
						    b(y1+y,x1+x).piece_type);
			    possible_moves.append(temp);
			}
		    }
		break;
	    }
	    
	    return new antichess_move_gen(&possible_moves);
	}
}

@


1.1.2.2
log
@general clean up
@
text
@a1 2
#include <chess_capture_move.h>
#include <antichess_board.h>
d6 1
a6 1
    antichess_move_gen(const array <chess_capture_move> *m);
d10 1
a10 1
    bool get(move *&m);
d17 1
a17 1
    const array <chess_capture_move> *a;
d20 1
a20 1
antichess_move_gen::antichess_move_gen (const array <chess_capture_move> *m) {
d22 1
a22 1
  a = m;
d25 1
a25 1
bool antichess_move_gen::get (move *&m) {
d29 1
a29 1
  m = &a->fetch(index++);
d36 1
a36 1
    array<chess_capture_move> possible_moves;
a40 5
    bool top_right_loop = true;
    bool top_left_loop = true;
    bool bottom_right_loop = true;
    bool bottom_left_loop = true;
    int pieces_to_find;
a46 1
	pieces_to_find = white_pieces;
a51 1
	pieces_to_find = black_pieces;
a56 3
	    if (pieces_to_find<=0)
		break;
	    
a59 2
	    pieces_to_find--;
	    
a221 1
		
a222 2
		    

d224 2
a225 3
			top_right_loop = false;
		    if (top_right_loop &&
			(b(y1+x,x1+x).piece_color != this_color)){
d231 3
a233 3
			top_right_loop = false;


d235 2
a236 3
			bottom_right_loop = false;
		    if (top_left_loop &&
			(b(y1-x,x1+x).piece_color != this_color)){
d242 3
a244 2
			bottom_right_loop = false;
		    
d246 2
a247 3
			top_left_loop = false;
		    if (top_left_loop &&
			(b(y1+x,x1-x).piece_color != this_color)){
d253 3
a255 2
			top_left_loop = false;
		    
d257 2
a258 3
			bottom_left_loop = false;
		    if (bottom_left_loop &&
			(b(y1-x,x1-x).piece_color != this_color)){
d264 1
a264 1
			bottom_left_loop = false;
@


1.1.2.3
log
@finished evaluate
@
text
@d42 1
a42 1
    register antichess_board *b = (antichess_board *) this;
d48 1
a48 3

    pieces_to_find = pieces_remaining(p);
        
d50 1
a50 1
    if (p==0){
d54 1
d56 1
a56 1
    if (p==1){
d60 1
d69 1
a69 1
	    if (b->fetch(y1,x1).piece_color != this_color)
d74 1
a74 1
	    switch(b->fetch(y1,x1).piece_type){
d80 1
a80 1
		    (b->fetch(y1+dir,x1).piece_type == none)){
d82 1
a82 2
					    b->fetch(y1+dir,x1).piece_type,
					    b->fetch(y1+dir,x1).piece_color);
d89 2
a90 2
		    (b->fetch(y1+2*dir,x1).piece_type == none) &&
		    (b->fetch(y1+dir,x1).piece_type != none)){
d92 1
a92 2
					b->fetch(y1+2*dir,x1).piece_type,
					b->fetch(y1+2*dir,x1).piece_color);
d98 2
a99 2
		    (b->fetch(y1+dir,x1+1).piece_type != none) &&
		    (b->fetch(y1+dir,x1+1).piece_color == capture_color)){
d101 1
a101 2
					b->fetch(y1+dir,x1+1).piece_type,
					b->fetch(y1+dir,x1+1).piece_color);
d105 2
a106 2
		(b->fetch(y1+dir,x1-1).piece_type != none) &&
		(b->fetch(y1+dir,x1-1).piece_color == capture_color)){
d108 1
a108 2
					b->fetch(y1+dir,x1-1).piece_type,
					b->fetch(y1+dir,x1-1).piece_color);
d115 1
a115 1
		    (b->fetch(y1+2,x1+1).piece_color != capture_color)){
d117 1
a117 2
					b->fetch(y1+2,x1+1).piece_type,
					b->fetch(y1+2,x1+1).piece_color);
d121 1
a121 1
		    (b->fetch(y1+2,x1-1).piece_color != capture_color)){
d123 1
a123 2
					b->fetch(y1+2,x1-1).piece_type,
					b->fetch(y1+2,x1-1).piece_color);
d127 1
a127 1
		    (b->fetch(y1-2,x1+1).piece_color != capture_color)){
d129 1
a129 2
					b->fetch(y1-2,x1+1).piece_type,
					b->fetch(y1-2,x1+1).piece_color);
d133 1
a133 1
		    (b->fetch(y1-2,x1-1).piece_color != capture_color)){
d135 1
a135 2
					b->fetch(y1-2,x1-1).piece_type,
					b->fetch(y1-2,x1-1).piece_color);
d139 1
a139 1
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d141 1
a141 2
					b->fetch(y1+dir,x1-1).piece_type,
					b->fetch(y1+dir,x1-1).piece_color);
d145 1
a145 1
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d147 1
a147 2
					b->fetch(y1-1,x1+2).piece_type,
					b->fetch(y1-1,x1+2).piece_color);
d151 1
a151 1
		    (b->fetch(y1+1,x1-2).piece_color != capture_color)){
d153 1
a153 2
					b->fetch(y1+1,x1-2).piece_type,
					b->fetch(y1+1,x1-2).piece_color);
d157 1
a157 1
		    (b->fetch(y1-1,x1-2).piece_color != capture_color)){
d159 1
a159 2
					b->fetch(y1-1,x1-2).piece_type,
					b->fetch(y1-1,x1-2).piece_color);
d169 1
a169 1
		    if (b->fetch(y1,x1+x).piece_type == none){
d171 1
a171 2
						b->fetch(y1,x1+x).piece_type,
						b->fetch(y1,x1+x).piece_color);
d175 1
a175 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d177 1
a177 3
						    b->fetch(y1,
							     x1+x).piece_type,
						    b->fetch(y1,x1+x).piece_color);
d185 1
a185 1
		    if (b->fetch(y1,x1-x).piece_type == none){
d187 1
a187 2
						b->fetch(y1,x1-x).piece_type,
						b->fetch(y1,x1-x).piece_color);
d191 1
a191 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d193 1
a193 2
						    b->fetch(y1,x1-x).piece_type,
						    b->fetch(y1,x1-x).piece_color);
d201 1
a201 1
		    if (b->fetch(y1+x,x1).piece_type == none){
d203 1
a203 2
						b->fetch(y1+x,x1).piece_type,
						b->fetch(y1+x,x1).piece_color);
d207 1
a207 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d209 1
a209 2
						    b->fetch(y1+x,x1).piece_type,
						    b->fetch(y1+x,x1).piece_color);
d217 1
a217 1
		    if (b->fetch(y1-x,x1).piece_type == none){
d219 1
a219 2
						b->fetch(y1-x,x1).piece_type,
						b->fetch(y1-x,x1).piece_color);
d223 1
a223 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d225 1
a225 2
						    b->fetch(y1-x,x1).piece_type,
						    b->fetch(y1-x,x1).piece_color);
d243 1
a243 1
			(b->fetch(y1+x,x1+x).piece_color != this_color)){
d245 1
a245 2
						b->fetch(y1+x,x1+x).piece_type,
						b->fetch(y1+x,x1+x).piece_color);
d255 1
a255 1
			(b->fetch(y1-x,x1+x).piece_color != this_color)){
d257 1
a257 2
						b->fetch(y1-x,x1+x).piece_type,
						b->fetch(y1-x,x1+x).piece_color);
d266 1
a266 1
			(b->fetch(y1+x,x1-x).piece_color != this_color)){
d268 1
a268 2
						b->fetch(y1+x,x1-x).piece_type,
						b->fetch(y1+x,x1-x).piece_color);
d277 1
a277 1
			(b->fetch(y1-x,x1-x).piece_color != this_color)){
d279 1
a279 2
						b->fetch(y1-x,x1-x).piece_type,
						b->fetch(y1-x,x1-x).piece_color);
d293 1
a293 1
			if (b->fetch(y1+y,x1+x).piece_color != this_color){
d295 1
a295 2
						    b->fetch(y1+y,x1+x).piece_type,
						    b->fetch(y1+y,x1+x).piece_color);
@
