5 ** Copyright (C) 1998 Kurt Van den Branden
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "win_human.h"
23 #include "callbacks.h"
27 void chartocolour (char c
, char * str
);
34 void * human_new (char colour
, int game
)
38 me
= (human_info
*) malloc (sizeof (human_info
));
46 void human_move (board
* oboard
, void * self
, float timeleft
,
47 char * type
, char * from
, char * to
)
50 human_info
* me
= (human_info
*) self
;
57 printf ("player %c, do you want to add a GIPF (y/n): ", me
->colour
);
59 if ((buffer
[0] != 'y') && (buffer
[0] != 'Y'))
67 while (strlen (buffer
) < 5)
70 printf ("player %c, please enter your move (ex. h6-g6): ",
84 char human_gipf (board
* oboard
, void * self
, float timeleft
, char * pos
)
86 human_info
* me
= (human_info
*) self
;
92 chartocolour (me
->colour
, player
);
93 sprintf (line1
, "%s player, do you want to remove", player
);
94 sprintf (line2
, "the gipf at %s ?", pos
);
95 value
= gf1_question (line1
, line2
);
108 char human_row (board
* oboard
, void * self
, float timeleft
,
109 char * start
, char * end
)
111 human_info
* me
= (human_info
*) self
;
117 chartocolour (me
->colour
, player
);
118 sprintf (line1
, "%s player, do you want to remove", player
);
119 sprintf (line2
, "the row from %s to %s ?", start
, end
);
120 value
= gf1_question (line1
, line2
);
133 void human_end (void * self
)
135 human_info
* me
= (human_info
*) self
;
142 void chartocolour (char c
, char * str
)
145 strcpy (str
, "white");
147 strcpy (str
, "black");