head	1.14;
access;
symbols
	tonic_4:1.14
	tonic_3:1.12
	tonic_2:1.11
	demo:1.10.0.2
	design_report:1.9
	alpha_beta:1.7.0.2
	oral_presentation_freeze:1.2.0.2;
locks; strict;
comment	@ * @;


1.14
date	95.12.15.19.27.48;	author hartmans;	state Exp;
branches;
next	1.13;

1.13
date	95.12.15.14.00.49;	author jered;	state Exp;
branches;
next	1.12;

1.12
date	95.12.15.11.25.23;	author jered;	state Exp;
branches;
next	1.11;

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

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

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

1.8
date	95.12.11.11.27.27;	author jered;	state Exp;
branches;
next	1.7;

1.7
date	95.12.10.01.36.04;	author jered;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	95.12.10.01.19.47;	author jered;	state Exp;
branches;
next	1.5;

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

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

1.3
date	95.11.30.10.34.52;	author hartmans;	state Exp;
branches;
next	1.2;

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

1.1
date	95.11.30.05.04.06;	author jered;	state Exp;
branches;
next	;

1.7.2.1
date	95.12.11.08.18.24;	author jered;	state Exp;
branches;
next	1.7.2.2;

1.7.2.2
date	95.12.11.11.20.34;	author jered;	state Exp;
branches;
next	;


desc
@@


1.14
log
@Back out caching stuff
@
text
@//  This is -*- c++ -*- code
// $Id: machine_player.h,v 1.12 1995/12/15 11:25:23 jered Exp $


#ifndef __MACHINE_PLAYER_H__
#define __MACHINE_PLAYER_H__

#include <6170.h>
#include "board.h"
#include "player.h"
class move;

class http_response;

class machine_player : public player {
    // Overview: A machine_player is an automated  participant in a game, 
    //played upon a board.
public:
    // Constructors:

    machine_player(long total_time, bool can_i_go);
    // Checks: total_time >= 0;
    // Effects:  Creates a new machine_player, not associated with
    // any game which will have have up total_time seconds to complete
    // all moves. Assigns a name to the new machine_player. 
    // Methods:
    virtual void display(extensions *ext, ostream &body, int point_of_view) const;

    virtual http_response *get(string request, extensions *ext);

    virtual void you_moved(move &m);

    virtual void opponent_moved (move &m, int p);

    virtual void state_changed(void);

protected:
    virtual void associate(game *g);
    
private:
    void try_move(void);
    // Try to make a move now.

    struct mnode;
    struct mgnode {
      move_generator *mg;
      int mg_index;
      mnode *mn;
	mgnode *next;
    };
    struct mnode {
      move *nmove;
      board::value nval;
	mgnode *nnode;
      mnode *next;
    };
    void try_simple(void);
    void del_mgtree(mgnode *mgtop);
    void del_mtree(mnode *mtop);
    void try_alpha(void);
    void  do_level(mnode *curr_mnode, board *cbrd, 
		   board::value currval, board::value &bestval, 
		   board::value maxval, move *&bestmove, 
		   move *topmove, bool istop, long &nmoves);
    bool descend(mnode *curr_mnode, board *curr_board, 
		 int this_depth, board::value currval, 
		 board::value &bval, board::value mval, 
		 move *&bmove, bool istop, move *topmove,
		 long start_time, long time_to_move, 
		 long &nmoves);
    // Specific move strategies.

    machine_player();
    // Disable default constructor

    void operator= (machine_player &);
    // Disable equality operator

    bool can_go;
    // Can I go immediately, or must I wait to be allowed to take
    // my turn?
    int my_index;
    // My player index
};

#endif
@


1.13
log
@Break lots of things
@
text
@d49 1
a49 1
      mgnode *next;
a52 1
      move *successor;
d54 1
a54 1
      mgnode *nnode;
a56 2
    mnode *top_mnode;     // Top game mnode
    int levels_cached;
a59 1
    void del_level(move &m, int pl);
d64 1
a64 2
		   move *topmove, bool istop, long &nmoves,
		   move *&blev);
d70 1
a70 1
		 long &nmoves, move *&blev);
@


1.12
log
@Various changes, machine player name, explicit deletion, etc. WARNING: it _may_ not be safe to delete the game tree after an unapply fails. I can't see why, though.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.11 1995/12/14 09:07:17 jered Exp $
d53 1
d58 2
d63 1
d68 2
a69 1
		   move *topmove, bool istop, long &nmoves);
d75 1
a75 1
		 long &nmoves);
@


1.11
log
@top_node, chess_capture_move, etc fixes, machine_player speedups.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.10 1995/12/12 23:29:32 hartmans Exp $
d58 2
@


1.10
log
@Change prototypes for player::display
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.9 1995/12/11 18:43:37 hartmans Exp $
d62 1
a62 1
		   move *topmove, bool istop);
d67 2
a68 1
		 long start_time, long time_to_move);
@


1.9
log
@Merge in machine player.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.7.2.2 1995/12/11 11:20:34 jered Exp $
d27 1
a27 1
    virtual void display(extensions *ext, ostream &body) const;
@


1.8
log
@Merged good new machine player.
@
text
@d4 1
@


1.7
log
@Fixed many bogosities.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.6 1995/12/10 01:19:47 jered Exp $
d42 14
d58 9
a66 2
    board::value alpha_beta(board *, board::value, int, 
                               board::value, board::value);
@


1.7.2.1
log
@Miscellany
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.7 1995/12/10 01:36:04 jered Exp $
a41 14

    struct mnode;
    struct mgnode {
      move_generator *mg;
      int mg_index;
      mnode *mn;
      mgnode *next;
    };
    struct mnode {
      move *nmove;
      board::value nval;
      mgnode *nnode;
      mnode *next;
    };
d44 2
a45 8
    void  do_level(mnode *curr_mnode, board *cbrd, 
		   board::value currval, board::value &bestval, 
		   board::value maxval, move *&bestmove, 
		   move *topmove, bool istop);
    bool descend(mnode *curr_mnode, board *curr_board, 
		 int this_depth, board::value currval, 
		 board::value &bval, board::value mval, 
		 move *&bmove, bool istop, move *topmove);
@


1.7.2.2
log
@A working breadth-first searcher
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.7.2.1 1995/12/11 08:18:24 jered Exp $
d65 1
a65 2
		 move *&bmove, bool istop, move *topmove,
		 long start_time, long time_to_move);
@


1.6
log
@New machine player.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.5 1995/12/03 05:00:43 hartmans Exp $
d44 1
a44 1
    board::value board::alpha_beta(board *, board::value, int, 
@


1.5
log
@Tidy up human_player,
implement machine_player::get

clarify associate specs.
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.4 1995/12/01 04:19:48 hartmans Exp $
d42 5
a61 3



@


1.4
log
@Fix typoi
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.3 1995/11/30 10:34:52 hartmans Exp $
d19 1
d24 1
a24 3
    // all moves. Assigns a name to the new machine_player. Sets
    // my_index to this player's player index.

d28 1
@


1.3
log
@aargh
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.2 1995/11/30 06:32:12 hartmans Exp $
d37 1
a37 1
    virtual voide associate(game *g);
@


1.2
log
@Fix bugs so it builds
@
text
@d2 1
a2 1
// $Id: machine_player.h,v 1.1 1995/11/30 05:04:06 jered Exp $
d29 1
d36 3
@


1.1
log
@Added machine_player.{h,C}. Other minor things.
@
text
@d2 1
a2 1
// $Id$
d9 2
a11 1
class move;
d13 1
d27 1
a27 1
    virtual void display(extensions *ext, ostream *body) const;
d31 1
a31 1
    virtual void opponent_moved (move &m, player *p);
@
