head	1.11;
access;
symbols
	tonic_4:1.11
	tonic_3:1.11
	tonic_2:1.11
	demo:1.10.0.2
	design_report:1.9
	oral_presentation_freeze:1.1.0.4
	DAVEG_CDP:1.1.0.2;
locks; strict;
comment	@ * @;


1.11
date	95.12.14.09.07.17;	author jered;	state Exp;
branches;
next	1.10;

1.10
date	95.12.12.14.39.47;	author hartmans;	state Exp;
branches;
next	1.9;

1.9
date	95.12.11.09.24.10;	author hartmans;	state Exp;
branches;
next	1.8;

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

1.7
date	95.12.03.19.58.06;	author hartmans;	state Exp;
branches;
next	1.6;

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

1.5
date	95.12.03.01.18.54;	author hartmans;	state Exp;
branches;
next	1.4;

1.4
date	95.12.01.13.59.14;	author daveg;	state Exp;
branches;
next	1.3;

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

1.2
date	95.11.30.10.27.00;	author daveg;	state Exp;
branches;
next	1.1;

1.1
date	95.11.25.05.09.04;	author daveg;	state Exp;
branches;
next	;


desc
@@


1.11
log
@top_node, chess_capture_move, etc fixes, machine_player speedups.
@
text
@// This is -*- c++ -*- code

#ifndef __CHESS_CAPTURE_MOVE_H__
#define __CHESS_CAPTURE_MOVE_H__

#include "move.h"
#include "chess_display_board.h"
#include <typeinfo.h>

class chess_capture_move : public move {
    
    // Overview: an move passed between  board and player and
    // chess game that results in the capture of a piece.  A
    // chess_capture_move is an immutable stack/heap abstraction. 

  public:
    
    // Constlructors and Destructors:

    chess_capture_move (int from_x, int from_y, int to_x, int to_y,
			chess_display_board::chess_piece piece,
			chess_display_board::color c,
			bool promotion);
    // Requires: 0 <= from_x, from_y, to_x, to_y <=7.  That the square
    // on the board this move belongs to at from_x,from_y is not
    // empty.
    // Effects: creates an new chess_capture_move.
    
    chess_capture_move (const chess_capture_move &m);
    // Effects: copies a chess_move.

    chess_capture_move(int x1, int y1, int x2, int y2, const chess_display_board *brd);
    // Effects: creates a chess_capture_move appropriate for moving
    // from x1, y1 to x2, y2 on the given board.
    
    virtual ~chess_capture_move();
    // Frees any state associated with chess_move.
    
    // Methods:

    virtual void display(extensions *ext, ostream &body);
    // Effects: returns an html representation of this move for inclusion
    // in a move list.  The headers in extensions (if extensions is non-null)
    // can be used to determine the capabilities of the web client.
    // Effects:  Return a textual representation of the move for inclusion
    // in a move list.
    
    virtual bool operator == (move &m);
    // Effects: returns true if two moves are equal, else returns
    // false.  Move equality means that the effect of applying one
    // move to any board will be indistinguishable from the effect of
    // applying the other move to the same board.

    virtual chess_display_board::path get_path() const;
    // Effects: reurns the path of this move.
    
    virtual move * copy();
    //Effects: returns a copy of this such that
    // this->copy() == this.

    chess_display_board::chess_piece get_piece_taken() const;
    // Effects: Returns the piece taken.

    chess_display_board::color get_color_taken() const;
    // Effects: Returns the color of the piece taken.
    
    bool was_promotion() const;
    // Effects: Returns true if this move resulted in the piece being
    // promoted, else returns false.

    static typeinfo_t typeinfo;
    
    virtual void * force ( typeinfo_t &type);
    
    chess_capture_move & operator = (const chess_capture_move & m );
    // Modifies: this
    // Effects: this becomes m


    chess_capture_move ();
    // Effects: returns a new chess capture move.

  private:

    chess_display_board::path p;
    chess_display_board::color c;
    chess_display_board::chess_piece piecetaken;
    bool promoted;
};

inline chess_capture_move &chess_capture_move::operator = 
(const chess_capture_move &m) {
promoted = m.promoted;
c = m.c;
piecetaken = m.piecetaken;
p = m.p;

    return *this;
}

inline chess_capture_move::chess_capture_move() {}



inline chess_display_board::path chess_capture_move::get_path() const{
    return p;
}

inline chess_display_board::chess_piece chess_capture_move::get_piece_taken() const {
    return piecetaken;
}
inline chess_display_board::color chess_capture_move::get_color_taken() const {
    return c;
}

inline bool chess_capture_move::was_promotion() const{
    return promoted;
}

char piecetoc(chess_display_board::chess_piece p,
	      chess_display_board::color pc);
	      
#endif
@


1.10
log
@Don't inline destructor; potential template problems.

  CVS:
----------------------------------------------------------------------
automatically CVS: CVS: Committing in base CVS: CVS: Modified Files:
----------------------------------------------------------------------
@
text
@d32 1
a32 1
    chess_capture_move(int x1, int y1, int x2, int y2, chess_display_board *brd);
@


1.9
log
@bug fixes
@
text
@d18 1
a18 1
    // Constructors and Destructors:
a102 1
inline chess_capture_move::~chess_capture_move() {}
d104 1
@


1.8
log
@added piecetoc dec
@
text
@d57 1
a57 1
    virtual chess_capture_move * copy();
@


1.7
log
@Rearrange constructors for chess_capture_move,
provide method to find out who has active turn
@
text
@d120 3
@


1.6
log
@minor details
@
text
@d8 1
d79 1
a79 1
  protected:
d93 5
@


1.5
log
@Include changes to support:
* New syntax for game::game
* New constructor for chess_capture_move that takes chess_display_board instead of piece_taken
* parse_square
@
text
@d21 2
a22 1
			chess_display_board::color c);
d66 4
d87 1
a87 1
    
d108 4
@


1.4
log
@finished evaluate
@
text
@d29 4
@


1.3
log
@cleanup
@
text
@a17 2
    chess_capture_move ();
    // Effects: creates a new chess_capture_move
d20 2
a21 1
			chess_display_board::chess_piece piece);
d55 1
a55 1
    chess_display_board::chess_piece get_piece_taken();
d57 3
d69 4
d74 1
a74 1
    
d76 1
d94 1
a94 1
inline chess_display_board::chess_piece chess_capture_move::get_piece_taken() {
d97 3
a99 1

@


1.2
log
@changed stuff
@
text
@d18 2
d43 1
a43 1
    virtual bool operator == (chess_capture_move &m);
d63 1
a63 3
  protected:
    
    chess_capture_move & operator = (const move & m );
d74 2
a75 1
inline chess_capture_move &chess_capture_move::operator = (const move &m) {
d78 2
@


1.1
log
@version 1.0 of chess_capture_move.h
@
text
@d19 3
a21 2
    chess_capture_move (int from_x, int from_y, int to_x, int to_y);
    // Checks: 0 <= from_x, from_y, to_x, to_y <=7.  That the square
d23 1
a23 1
    // empty, and that the square at to_x,to_y is empty.
a33 7
    struct path {
	int x1;
	int y1;
	int x2;
	int y2;
    };
            
d47 1
a47 1
    virtual path &get_path();
d63 1
a63 1
    chess_capture_move & operator = (const chess_capture_move & m );
d68 2
a69 2

    path p;
d74 3
a76 2
inline chess_capture_move &chess_capture_move::operator = (const move &m)
 {return *this;}
d80 1
a80 1
inline path &chess_capture_move::get_path(){
d87 1
@
