Merge branch 'hgm/xboard/options'
[gnushogi.git] / gnushogi / pattern-common.c
blob3eb13dc9dbafdd7c7a66e3afe21aebc3b8531221
1 /*
2 * FILE: pattern-common.c
4 * ----------------------------------------------------------------------
5 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
6 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
7 * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
9 * GNU SHOGI is based on GNU CHESS
11 * Copyright (c) 1988, 1989, 1990 John Stanback
12 * Copyright (c) 1992 Free Software Foundation
14 * This file is part of GNU SHOGI.
16 * GNU Shogi is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 3 of the License,
19 * or (at your option) any later version.
21 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
22 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
26 * You should have received a copy of the GNU General Public License along
27 * with GNU Shogi; see the file COPYING. If not, see
28 * <http://www.gnu.org/licenses/>.
29 * ----------------------------------------------------------------------
32 #include "gnushogi.h"
33 #include "pattern.h"
35 short
36 ValueOfOpeningName (char *name)
38 short i;
39 i = (name[0] == 'C') ? 0 : 100;
41 switch (name[7])
43 case 'S':
44 i += 10;
45 break;
47 case 'R':
48 i += 20;
49 break;
51 case 'U':
52 i += 30;
53 break;
55 default:
56 i += 40;
57 break;
60 switch (name[9])
62 case 'S':
63 i += 1;
64 break;
66 case 'R':
67 i += 2;
68 break;
70 case 'U':
71 i += 3;
72 break;
74 default:
75 i += 4;
76 break;
79 return i;