summaryrefslogtreecommitdiff
path: root/games/Phalanx/patches/setboard.patch
blob: 10b3bd259280cb460416b29aa82e33360a1abd13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
diff -ur Phalanx-XXII/io.c Phalanx-XXII-scid/io.c
--- Phalanx-XXII/io.c	2005-10-03 00:29:22.000000000 +0200
+++ Phalanx-XXII-scid/io.c	2008-02-03 12:07:09.000000000 +0100
@@ -984,11 +984,11 @@
 	if( Inp[0] == '\0' )
 	if( fgets(Inp,255,stdin) == NULL ) strcpy(Inp,"quit\n");
 
-	if( strncmp(Inp,"exit\n",5) == 0 && Flag.analyze )
+	if( strncmp(Inp,"exit",4) == 0 && Flag.analyze )
 	{ Flag.machine_color = Flag.analyze = 0; Inp[0]='\0'; return 1; }
 
-	if( strncmp(Inp,"quit\n",5) == 0
-	 || strncmp(Inp,"exit\n",5) == 0 )
+	if( strncmp(Inp,"quit",4) == 0
+	 || strncmp(Inp,"exit",4) == 0 )
 	{
 		if( Flag.ponder < 2 ) return 0;
 		else
@@ -1007,7 +1007,7 @@
 	}
 
 /* COMMAND: analyze */
-	if( strncmp( Inp, "analyze\n", 8 ) == 0 )
+	if( strncmp( Inp, "analyze", 7 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		puts("analyze mode, type 'exit' to terminate");
@@ -1017,7 +1017,7 @@
 	}
 
 /* COMMAND: force */
-	if( strncmp( Inp, "force\n", 6 ) == 0 )
+	if( strncmp( Inp, "force", 5 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		puts("you play both");
@@ -1027,8 +1027,8 @@
 	}
 
 /* COMMANDS: white, black */
-	if(  strncmp( Inp, "white\n", 6 ) == 0
-	  || strncmp( Inp, "black\n", 6 ) == 0 )
+	if(  strncmp( Inp, "white", 5 ) == 0
+	  || strncmp( Inp, "black", 5 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		puts("you do not play both");
@@ -1038,7 +1038,7 @@
 	}
 
 /* COMMAND: both */
-	if( strncmp( Inp, "both\n", 5 ) == 0 )
+	if( strncmp( Inp, "both", 4 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		puts("machine plays both");
@@ -1047,7 +1047,7 @@
 	}
 
 /* COMMAND: new */
-	if( strncmp( Inp, "new\n", 4 ) == 0 )
+	if( strncmp( Inp, "new", 3 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		setfen("rnbqkbnr/pppppppp/////PPPPPPPP/RNBQKBNR/w");
@@ -1062,7 +1062,7 @@
 	}
 
 /* COMMAND: go */
-	if( strncmp( Inp, "go\n", 3 ) == 0 )
+	if( strncmp( Inp, "go", 2 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		Flag.machine_color = Color;
@@ -1070,11 +1070,11 @@
 	}
 
 /* COMMAND: bd */
-	if( strncmp( Inp, "bd\n", 3 ) == 0 || strncmp( Inp, "d\n", 2 ) == 0 )
+	if( strncmp( Inp, "bd", 2 ) == 0 || strncmp( Inp, "d\n", 2 ) == 0 )
 	{ printboard(NULL); Inp[0]='\0'; return 1; }
 
 /* COMMAND: bk */
-	if( strncmp( Inp, "bk\n", 3 ) == 0 )
+	if( strncmp( Inp, "bk", 2 ) == 0 )
 	{
 		tmove m[256]; int n;
 		extern void bk(tmove *, int );
@@ -1086,7 +1086,7 @@
 	}
 
 /* COMMAND: post */
-	if( strncmp( Inp, "post\n", 5 ) == 0 )
+	if( strncmp( Inp, "post", 4 ) == 0 )
 	{
 		Flag.post = 1;
 		puts("post on");
@@ -1094,7 +1094,7 @@
 	}
 
 /* COMMAND: nopost */
-	if( strncmp( Inp, "nopost\n", 7 ) == 0 )
+	if( strncmp( Inp, "nopost", 6 ) == 0 )
 	{
 		Flag.post = 0;
 		puts("post off");
@@ -1139,7 +1139,7 @@
 
 
 /* COMMAND: hard */
-	if( strncmp( Inp, "hard\n", 5 ) == 0 )
+	if( strncmp( Inp, "hard", 4 ) == 0 )
 	{
 		if( Flag.ponder==0 && Flag.easy==0 )
 		Flag.ponder = 1;
@@ -1148,7 +1148,7 @@
 	}
 
 /* COMMAND: easy */
-	if( strncmp( Inp, "easy\n", 5 ) == 0 )
+	if( strncmp( Inp, "easy", 4 ) == 0 )
 	{
 		if( Flag.ponder != 0 )
 		{
@@ -1189,7 +1189,7 @@
 	}
 
 /* COMMAND: book */
-	if( strncmp( Inp, "book\n", 5 ) == 0 )
+	if( strncmp( Inp, "book", 4 ) == 0 )
 	{
 		Flag.book = ! Flag.book;
 		if( Flag.book ) puts("book on");
@@ -1198,15 +1198,15 @@
 	}
 
 /* COMMAND: about */
-	if( strncmp( Inp, "about\n", 6 ) == 0 )
+	if( strncmp( Inp, "about", 5 ) == 0 )
 	{ about(); Inp[0]='\0'; return 1; }
 
 /* COMMAND: fen */
-	if( strncmp( Inp, "fen\n", 3 ) == 0 )
+	if( strncmp( Inp, "fen", 3 ) == 0 )
 	{ printpositionfen(); Inp[0]='\0'; return 1; }
 
 /* COMMAND: help */
-	if( strncmp( Inp, "help\n", 5 ) == 0 )
+	if( strncmp( Inp, "help", 4 ) == 0 )
 	{
 puts("COMMAND SUMMARY: about (shows settings), bd (displays position - same");
 puts("as 'd'), bk (shows book info), book (enables/disables book), both");
@@ -1240,7 +1240,7 @@
 	}
 
 /* COMMAND: xboard */
-	if( strncmp( Inp, "xboard\n", 7 ) == 0 )
+	if( strncmp( Inp, "xboard", 6 ) == 0 )
 	{
 		Flag.xboard = 2;
 		puts("xboard mode on");
@@ -1267,7 +1267,7 @@
 	}
 
 /* COMMAND: undo (xboard) */
-	if( strncmp( Inp, "undo\n", 5 ) == 0 || strncmp( Inp, "u\n", 2 ) == 0 )
+	if( strncmp( Inp, "undo", 4 ) == 0 || strncmp( Inp, "u\n", 2 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		if( Counter != 0 )
@@ -1283,7 +1283,7 @@
 	}
 
 /* COMMAND: remove (xboard) */
-	if( strncmp( Inp, "remove\n", 7 ) == 0 )
+	if( strncmp( Inp, "remove", 6 ) == 0 )
 	{
 		if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
 		if( Counter > 1 )
@@ -1309,6 +1309,15 @@
 		return 1;
 	}
 
+/* COMMAND: setboard <FEN> */
+/* added by Pascal Georges */
+	if( strncmp( Inp, "setboard ", 9 ) == 0 )
+	{
+		setfen(Inp+9);
+		Inp[0] = '\0';
+		return 1;
+	}
+
 /* COMMAND: test a position */
 	if( sevenslashes(Inp) ) /* test */
 	{

diff -ur Phalanx-XXII/phalanx.h Phalanx-XXII-scid/phalanx.h
--- Phalanx-XXII/phalanx.h	2005-10-03 00:41:14.000000000 +0200
+++ Phalanx-XXII-scid/phalanx.h	2008-07-14 10:45:41.000000000 +0200
@@ -1,7 +1,7 @@
 #ifndef PHALANX_INCLUDED
 #define PHALANX_INCLUDED
 
-#define VERSION "XXII"
+#define VERSION "XXII-pg"
 
 #ifdef GNUFUN
 # include <getopt.h>

diff -ur Phalanx-XXII/README Phalanx-XXII-scid/README
--- Phalanx-XXII/README	2005-09-21 02:38:39.000000000 +0200
+++ Phalanx-XXII-scid/README	2008-02-03 12:07:09.000000000 +0100
@@ -1,2 +1,6 @@
+*********************************************************
+[December 2006 : added setboard option - Pascal Georges ]
+*********************************************************
+
 Phalanx is a chess playing program
 Copyright (c) 1997, 1998, 1999, 2000 Dusan Dobes