~ml-launchpad/ubuntu/natty/gcompris/fix-for-777349

« back to all changes in this revision

Viewing changes to src/chess_computer-activity/gnuchess/ponder.c

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2010-06-27 22:51:30 UTC
  • mfrom: (1.1.16 upstream) (5.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100627225130-mf7h4m5r8m7bd9fb
Tags: 9.3-1
* New upstream release.
* Drop GTK_DISABLE_DEPRECATED patch, useless for now.
* Provide RELEASE_NOTE_9.3.txt downloaded from sourceforge.
* New voice package for Asturian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GNU Chess 5.0 - ponder.c - Pondering
 
2
   Copyright (c) 2002 Free Software Foundation, Inc.
 
3
 
 
4
   GNU Chess is based on the two research programs 
 
5
   Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
 
6
 
 
7
   GNU Chess 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, or (at your option)
 
10
   any later version.
 
11
 
 
12
   GNU Chess 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.
 
16
 
 
17
   You should have received a copy of the GNU General Public License
 
18
   along with GNU Chess; see the file COPYING.  If not, write to
 
19
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
20
   Boston, MA 02111-1307, USA.
 
21
 
 
22
   Contact Info: 
 
23
     bug-gnu-chess@gnu.org
 
24
     cracraft@ai.mit.edu, cracraft@stanfordalumni.org, cracraft@earthlink.net
 
25
     lukas@debian.org
 
26
*/
 
27
 
 
28
#include <config.h>
 
29
#include "common.h"
 
30
#include <stdlib.h>
 
31
#include <unistd.h>
 
32
 
 
33
/*
 
34
 * Pondering has to check for input_status == INPUT_NONE regularly,
 
35
 * that is what Iterate() is supposed to do when the PONDER flag is
 
36
 * set.  Output should only be generated if the xboard flag is
 
37
 * set. (Otherwise stdout gets messed up.)
 
38
 */
 
39
void ponder(void)
 
40
{
 
41
   /* Save flags and clear the time control bit for pondering */
 
42
   const unsigned int saved_flags = flags;
 
43
 
 
44
   /* Save number of moves out of book */
 
45
   const int nmfb = nmovesfrombook;
 
46
 
 
47
   CLEAR(flags, TIMECTL);
 
48
   SET(flags, PONDER);
 
49
 
 
50
   dbg_printf("Pondering, GameCnt = %d\n", GameCnt);
 
51
   Iterate();
 
52
   dbg_printf("Pondering ended, GameCnt = %d\n", GameCnt);
 
53
 
 
54
   /* Restore flags, will also clear the PONDER flag */
 
55
   flags=saved_flags;
 
56
 
 
57
   nmovesfrombook = nmfb;
 
58
}