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


1.17
date	95.12.12.10.25.22;	author daveg;	state Exp;
branches;
next	1.16;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1.1.2.2
date	95.12.01.04.53.12;	author daveg;	state Exp;
branches;
next	;


desc
@@


1.17
log
@bug fix on bishop moves
@
text
@#include <antichess_board.h>

bool antichess_board::are_valid_move_available(int player_num, 
						bool check_turn) const {
    int x1, y1,x,y;
    bool is_queen = false;
    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 dir;
    
    if (check_turn && (player_num != current_player()))
	return false;
     
    if (pieces_remaining(player_num) == 0)
	return false;
    
    color capture_color, this_color;
    if (player_num==0){
	capture_color = black;
	this_color = white;
	dir = 1;
    }
    else if (player_num==1){
	capture_color = white;
	this_color = black;
	dir = -1;
    }
    else
	check(player_num==1,"Invalid player");
        
    for(y1=0;y1<8;y1++)
	for(x1=0;x1<8;x1++){
	    
	    if (b->fetch(y1,x1).piece_color != this_color)
		continue;

	    is_queen = false;
	    
	    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)){
		    return true;
		}
		
		// 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+dir,x1).piece_type == none) &&
			(b->fetch(y1+2*dir,x1).piece_type == none)){
			return true;
		    }
		
		// Check for captures
		if ((y1+dir < 8) && (y1+dir>=0) && (x1+1 < 8) &&
		    (b->fetch(y1+dir,x1+1).piece_color == capture_color)){
		    return true;
		}
		if ((y1+dir < 8) && (y1+dir>=0) && (x1-1 >= 0) &&
		(b->fetch(y1+dir,x1-1).piece_color == capture_color)){
		    return true;
		}
		break;
		
	    case knight:
		if ((y1+2 < 8) && (x1+1 < 8) &&
		    (b->fetch(y1+2,x1+1).piece_color != this_color)){
		    return true;
		}
		if ((y1+2 < 8) && (x1-1 >= 0) &&
		    (b->fetch(y1+2,x1-1).piece_color != this_color)){
		    return true;
		}
		if ((y1-2 >=0) && (x1+1 <8) &&
		    (b->fetch(y1-2,x1+1).piece_color != this_color)){
		    return true;
		}
		if ((y1-2 >= 0) && (x1-1 >= 0) &&
		    (b->fetch(y1-2,x1-1).piece_color != this_color)){
		    return true;
		}
		if ((y1+1 < 8) && (x1+2 <8) &&
		    (b->fetch(y1+1,x1+2).piece_color != this_color)){
		    return true;
		}
		if ((y1-1 >= 0) && (x1+2 <8) &&
		    (b->fetch(y1-1,x1+2).piece_color != this_color)){
		    return true;
		}
		if ((y1+1 < 8) && (x1-2 >= 0) &&
		    (b->fetch(y1+1,x1-2).piece_color != this_color)){
		    return true;
		}
		if ((y1-1 >= 0) && (x1-2 >= 0) &&
		    (b->fetch(y1-1,x1-2).piece_color != this_color)){
		    return true;
		}
		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)
			return true;
		    else {
			if (b->fetch(y1,x).piece_color == capture_color)
			    return true;
			break;
		    }
		}

		for(x=x1-1;x>=0;x--){
		    if (b->fetch(y1,x).piece_type == none)
			return true;
		    else {
			if (b->fetch(y1,x).piece_color == capture_color)
			    return true;
			break;
		    }
		}

		for(x=y1+1;x<8;x++){
		    if (b->fetch(x,x1).piece_type == none)
			return true;
		    else {
			if (b->fetch(y1,x).piece_color == capture_color)
			    return true;
			break;
		    }
		}

		for(x=y1-1;x>=0;x--){
		    if (b->fetch(x,x1).piece_type == none)
			return true;
		    else {
			if (b->fetch(y1,x).piece_color == capture_color)
			    return true;
			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)
			    return true;
			else if (b->fetch(y1+x,x1+x).piece_color == 
				  capture_color)
			    return true;
			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)
			    return true;
			else if (b->fetch(y1-x,x1+x).piece_color == 
				 capture_color)
			    return true;
			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)
			    return true;
			else if (b->fetch(y1+x,x1-x).piece_color == 
				 capture_color)
			    return true;
			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)
			    return true;
			else if (b->fetch(y1-x,x1-x).piece_color == 
				 capture_color)
			    return true;
			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){
			    return true;
			}
		    }
		break;
	    }
	}
    return false;
}

@


1.16
log
@bug fixes
@
text
@d156 4
@


1.15
log
@and even more bug fixes
@
text
@d39 2
@


1.14
log
@bug fixes
@
text
@d52 7
a58 5
		if ((y1+2*dir < 8) && (y1 +2*dir >=0) &&
		    (b->fetch(y1+dir,x1).piece_type == none) &&
		    (b->fetch(y1+2*dir,x1).piece_type == none)){
		    return true;
		}
d65 1
a65 1
		if ((y1+dir < 8) && (y1+dir>=0) && (x1-1 > 0) &&
d69 1
a69 1
		break;  // yes, I know this is redundant
d200 9
a208 7
		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){
@


1.13
log
@more bug fixes
@
text
@d38 1
a38 1
		break;
d74 1
a74 1
		if ((y1+2 < 8) && (x1-1 > 0) &&
d78 1
a78 1
		if ((y1-2 >0) && (x1+1 <8) &&
d82 1
a82 1
		if ((y1-2 > 0) && (x1-1 > 0) &&
d90 1
a90 1
		if ((y1-1 > 0) && (x1+2 <8) &&
d94 1
a94 1
		if ((y1+1 < 8) && (x1-2 > 0) &&
d98 1
a98 1
		if ((y1-1 > 0) && (x1-2 > 0) &&
d109 1
a109 1
		    if (b->fetch(y1,x).piece_type == none){
d111 2
a112 3
		    }
		    if(x!=8){
			if (b->fetch(y1,x).piece_color == capture_color){
a113 1
			}
d119 1
a119 1
		    if (b->fetch(y1,x).piece_type == none){
d121 2
a122 3
		    }
		    if(x!=-1){
			if (b->fetch(y1,x).piece_color == capture_color){
a123 1
			}
d129 1
a129 1
		    if (b->fetch(x,x1).piece_type == none){
d131 2
a132 3
		    }
		    if(x!=8){
			if (b->fetch(y1,x).piece_color == capture_color){
a133 1
			}
d139 1
a139 1
		    if (b->fetch(x,x1).piece_type == none){
d141 2
a142 3
		    }
		    if(x!=-1){
			if (b->fetch(y1,x).piece_color == capture_color){
a143 1
			}
d148 1
a148 1
		if (!is_queen){
a149 1
		}
d153 1
a153 1
		for(x=0;x<8;x++){
d155 2
a156 4
		    if (top_right_loop){
			if ((x1+x>8) || (y1+x>8))
			    top_right_loop = false;
			else if (b->fetch(y1+x,x1+x).piece_type == none)
d158 1
a158 1
			else  if (b->fetch(y1+x,x1+x).piece_color == 
d165 2
a166 4
		    if (bottom_right_loop){
			if ((x1+x>8) || (y1-x<0))
			    bottom_right_loop = false;
			else if (b->fetch(y1-x,x1+x).piece_type != none)
d168 1
a168 1
			else if (b->fetch(y1-x,x1+x).piece_color != 
d175 2
a176 4
		    if (top_left_loop){
			if ((x1-x<0) || (y1+x>8))
			    top_left_loop = false;
			else if (b->fetch(y1+x,x1-x).piece_type != none)
d178 1
a178 1
			else if (b->fetch(y1+x,x1-x).piece_color != 
d185 2
a186 4
		    if (bottom_left_loop){
			if ((x1-x<0) || (y1-x<0))
			    bottom_left_loop = false;
			else if	(b->fetch(y1-x,x1-x).piece_type != none)
d188 1
a188 1
			else if (b->fetch(y1-x,x1-x).piece_color != 
@


1.12
log
@removed spewage
@
text
@d14 1
a14 1
        if (check_turn && (player_num != current_player()))
d53 2
a54 2
		    (b->fetch(y1+2*dir,x1).piece_type == none) &&
		    (b->fetch(y1+dir,x1).piece_type != none)){
a59 1
		    (b->fetch(y1+dir,x1+1).piece_type != none) &&
a63 1
		(b->fetch(y1+dir,x1-1).piece_type != none) &&
d67 1
a67 1
		break;
d71 1
a71 1
		    (b->fetch(y1+2,x1+1).piece_color != capture_color)){
d75 1
a75 1
		    (b->fetch(y1+2,x1-1).piece_color != capture_color)){
d79 1
a79 1
		    (b->fetch(y1-2,x1+1).piece_color != capture_color)){
d83 1
a83 1
		    (b->fetch(y1-2,x1-1).piece_color != capture_color)){
d87 1
a87 1
		    (b->fetch(y1+1,x1+2).piece_color != capture_color)){
d91 1
a91 1
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d95 1
a95 1
		    (b->fetch(y1+1,x1-2).piece_color != capture_color)){
d99 1
a99 1
		    (b->fetch(y1-1,x1-2).piece_color != capture_color)){
d156 1
a156 1
		if (!is_queen)
d158 1
a160 1

a162 1
		    
d164 10
a173 5
		    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)){
			return true;
d175 11
a185 9
		    else
			top_right_loop = false;


		    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)){
			return true;
a186 2
		    else
			bottom_right_loop = false;
d188 10
a197 5
		    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)){
			return true;
d199 11
a209 8
		    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)){
			return true;
a210 2
		    else
			bottom_left_loop = false;
@


1.11
log
@a few more bug fixes
@
text
@d14 1
a14 5
    save(cout);
    cout << player_num <<"\n";
    

    if (check_turn && (player_num != current_player()))
@


1.10
log
@more bug fixes...
@
text
@d3 2
a4 1
bool antichess_board::valid_move_available(int player_num) const {
d12 5
d18 1
a18 1
    if (player_num != current_player())
d20 4
a23 2
        
    int dir;
d30 1
a30 1
    if (player_num==1){
d35 3
a37 1
    
@


1.9
log
@more bug fixes
@
text
@d83 1
a83 1
		    (b->fetch(y1-1,x1+2).piece_color != capture_color)){
d158 1
a158 1
		for(x=x1+1;x<8;x++){
d173 1
a173 1
		    if (top_left_loop &&
@


1.8
log
@bug fixes
@
text
@d189 1
a189 1
		    if ((x1-x>8) || (y1-x>8))
@


1.7
log
@bug fixes
@
text
@d132 1
a132 1
		    if(y!=8){
d144 1
a144 1
		    if(y!=-1){
d204 2
@


1.6
log
@bug fixes and cloning stuff
@
text
@d105 1
a105 1
		    if (b->fetch(y1,x1+x).piece_type == none){
d109 1
a109 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d117 1
a117 1
		    if (b->fetch(y1,x1-x).piece_type == none){
d121 1
a121 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d129 1
a129 1
		    if (b->fetch(y1+x,x1).piece_type == none){
d133 1
a133 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
d141 1
a141 1
		    if (b->fetch(y1-x,x1).piece_type == none){
d145 1
a145 1
			if (b->fetch(y1,x1+x).piece_color == capture_color){
@


1.5
log
@bug fixes
@
text
@d3 1
a3 1
bool antichess_board::valid_moves_avail(int player_num) const {
@


1.4
log
@Make antichess/Makefile

	This sort of compiles until you get to antichess_board.C.
@
text
@d6 1
a6 1
    antichess_board &b = *this;
d31 1
a31 1
	    if (b(y1,x1).piece_color != this_color)
d34 1
a34 1
	    switch(b(y1,x1).piece_type){
d40 1
a40 1
		    (b(y1+dir,x1).piece_type == none)){
d47 2
a48 2
		    (b(y1+2*dir,x1).piece_type == none) &&
		    (b(y1+dir,x1).piece_type != none)){
d54 2
a55 2
		    (b(y1+dir,x1+1).piece_type != none) &&
		    (b(y1+dir,x1+1).piece_color == capture_color)){
d59 2
a60 2
		(b(y1+dir,x1-1).piece_type != none) &&
		(b(y1+dir,x1-1).piece_color == capture_color)){
d67 1
a67 1
		    (b(y1+2,x1+1).piece_color != capture_color)){
d71 1
a71 1
		    (b(y1+2,x1-1).piece_color != capture_color)){
d75 1
a75 1
		    (b(y1-2,x1+1).piece_color != capture_color)){
d79 1
a79 1
		    (b(y1-2,x1-1).piece_color != capture_color)){
d83 1
a83 1
		    (b(y1-1,x1+2).piece_color != capture_color)){
d87 1
a87 1
		    (b(y1-1,x1+2).piece_color != capture_color)){
d91 1
a91 1
		    (b(y1+1,x1-2).piece_color != capture_color)){
d95 1
a95 1
		    (b(y1-1,x1-2).piece_color != capture_color)){
d105 1
a105 1
		    if (b(y1,x1+x).piece_type == none){
d109 1
a109 1
			if (b(y1,x1+x).piece_color == capture_color){
d117 1
a117 1
		    if (b(y1,x1-x).piece_type == none){
d121 1
a121 1
			if (b(y1,x1+x).piece_color == capture_color){
d129 1
a129 1
		    if (b(y1+x,x1).piece_type == none){
d133 1
a133 1
			if (b(y1,x1+x).piece_color == capture_color){
d141 1
a141 1
		    if (b(y1-x,x1).piece_type == none){
d145 1
a145 1
			if (b(y1,x1+x).piece_color == capture_color){
d164 1
a164 1
			(b(y1+x,x1+x).piece_color != this_color)){
d174 1
a174 1
			(b(y1-x,x1+x).piece_color != this_color)){
d183 1
a183 1
			(b(y1+x,x1-x).piece_color != this_color)){
d192 1
a192 1
			(b(y1-x,x1-x).piece_color != this_color)){
d205 1
a205 1
			if (b(y1+y,x1+x).piece_color != this_color){
a210 2
	    
	    return false;
d212 1
@


1.3
log
@added turn alternating
@
text
@d12 1
a12 1
    if (player_num != player_turn)
d17 1
a17 1
    if (player_num=0){
d22 1
a22 1
    if (player_num=1){
d61 1
a61 1
		    true;
@


1.2
log
@Integrate Antichess boarrd from DAVEG_CPD
@
text
@d12 3
@


1.1
log
@file antichess_valid_moves_avail.C was initially added on branch DAVEG_CDP.
@
text
@d1 212
@


1.1.2.1
log
@valid moves availability
@
text
@a0 201
bool antichess_board::valid_moves(int p) const{
    int x1, y1,x,y;
    bool is_queen = false;
    antichess_board &b = *this;

    int dir;
    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)){
		    return true;
		}
		
		// 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)){
		    return true;
		}
		
		// 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)){
		    return true;
		}
		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)){
		    true;
		}
		break;
		
	    case knight:
		if ((y1+2 < 8) && (x1+1 < 8) &&
		    (b(y1+2,x1+1).piece_color != capture_color)){
		    return true;
		}
		if ((y1+2 < 8) && (x1-1 > 0) &&
		    (b(y1+2,x1-1).piece_color != capture_color)){
		    return true;
		}
		if ((y1-2 >0) && (x1+1 <8) &&
		    (b(y1-2,x1+1).piece_color != capture_color)){
		    return true;
		}
		if ((y1-2 > 0) && (x1-1 > 0) &&
		    (b(y1-2,x1-1).piece_color != capture_color)){
		    return true;
		}
		if ((y1+1 < 8) && (x1+2 <8) &&
		    (b(y1-1,x1+2).piece_color != capture_color)){
		    return true;
		}
		if ((y1-1 > 0) && (x1+2 <8) &&
		    (b(y1-1,x1+2).piece_color != capture_color)){
		    return true;
		}
		if ((y1+1 < 8) && (x1-2 > 0) &&
		    (b(y1+1,x1-2).piece_color != capture_color)){
		    return true;
		}
		if ((y1-1 > 0) && (x1-2 > 0) &&
		    (b(y1-1,x1-2).piece_color != capture_color)){
		    return true;
		}
		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){
			return true;
		    }
		    if(x!=8){
			if (b(y1,x1+x).piece_color == capture_color){
			    return true;
			}
			break;
		    }
		}

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

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

		for(x=y1-1;x>=0;x--){
		    if (b(y1-x,x1).piece_type == none){
			return true;
		    }
		    if(y!=-1){
			if (b(y1,x1+x).piece_color == capture_color){
			    return true;
			}
			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){
			return true;
		    }
		    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){
			return true;
		    }
		    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){
			return true;
		    }
		    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){
			return true;
		    }
		    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){
			    return true;
			}
		    }
		break;
	    }
	    
	    return false;
	}
}

@


1.1.2.2
log
@general clean up
@
text
@d1 1
a1 3
#include <antichess_board.h>

bool antichess_board::valid_moves_avail(int player_num) const {
a4 4
    bool top_right_loop = true;
    bool top_left_loop = true;
    bool bottom_right_loop = true;
    bool bottom_left_loop = true;
d8 1
a8 1
    if (player_num=0){
d13 1
a13 1
    if (player_num=1){
a146 2

		
a147 2
		    

d149 2
a150 3
			top_right_loop = false;
		    if (top_right_loop &&
			(b(y1+x,x1+x).piece_color != this_color)){
d154 3
a156 3
			top_right_loop = false;


d158 2
a159 3
			bottom_right_loop = false;
		    if (top_left_loop &&
			(b(y1-x,x1+x).piece_color != this_color)){
d163 3
a165 2
			bottom_right_loop = false;
		    
d167 2
a168 3
			top_left_loop = false;
		    if (top_left_loop &&
			(b(y1+x,x1-x).piece_color != this_color)){
d172 3
a174 2
			top_left_loop = false;
		    
d176 2
a177 3
			bottom_left_loop = false;
		    if (bottom_left_loop &&
			(b(y1-x,x1-x).piece_color != this_color)){
d181 1
a181 1
			bottom_left_loop = false;
d183 1
@
