#import #import "Board.h" @interface Piece : NSObject { int owner; /* * Specifies the owner of the piece, * 0 == white * 1 == black */ BOOL moved; // Has the piece moved? BOOL diagonal; // Allows the piece to move diagonally. BOOL horizontal; BOOL vertical; BOOL forward_only; // Restricts the piece to forward movement only BOOL special; // Used for moves like castling, en passant int max_diagonal; // Use to set restrictions on diagonal movement int max_horizontal; int max_vertical; int x; // Stores the current location x of the piece on the board int y; BOOL selected; int mover_int; BOOL can_jump; // Since most pieces can't jump, this is set to NO by default in // Piece.m, call -(void) set_can_jump to set to YES. } // init variables -(void) initVar; // Getters -(BOOL) can_jump; -(BOOL) selected; -(int) owner; -(BOOL) moved; -(BOOL) diagonal; -(BOOL) horizontal; -(BOOL) vertical; -(BOOL) forward_only; -(BOOL) special; -(int) max_diagonal; -(int) max_horizontal; -(int) max_vertical; -(int) x; -(int) y; // Setters -(void) set_can_jump; -(void) set_selected; -(void) set_deselected; -(void) set_owner: (int) new_owner; -(void) set_moved; -(void) set_diagonal: (BOOL) yn; -(void) set_horizontal: (BOOL) yn; -(void) set_vertical: (BOOL) yn; -(void) set_forward_only: (BOOL) yn; -(void) set_special: (BOOL) yn; -(void) set_max_diagonal: (int) max; -(void) set_max_horizontal: (int) max; -(void) set_max_vertical: (int) max; -(void) set_x: (int) new_x and_y: (int) new_y; // Do'ers -(id) init_with_owner: (int) own and_diag: (BOOL) diag and_hoz: (BOOL) hoz and_vert: (BOOL) vert and_fonly: (BOOL) fonly and_specl: (BOOL) specl and_maxd: (BOOL) maxd and_maxh: (BOOL) maxh and_maxv: (BOOL) maxv and_x: (BOOL) newx and_y: (BOOL) newy; -(BOOL) move_diagonal_x: (int) new_x and_y: (int) new_y; -(BOOL) move_horizontal_x: (int) new_x and_y: (int) new_y; -(BOOL) move_vertical_x: (int) new_x and_y: (int) new_y; -(BOOL) move_x: (int) new_x // Method does nothing until over-ride and_y: (int) new_y; -(void) print; -(void) piece_usage; // Method does nothing until over-ride -(*Path) find_diagonal_path_x: (int) newx and_y: (int) newy; -(*Path) find_horizontal_path_x: (int) newx and_y: (int) newy; -(*Path) find_vertical_path_x: (int) newx and_y: (int) newy; -(*Path) find_path_x: (int) newx and_y: (int) newy; @end