static int zippyConsecGames;
static time_t zippyLastGameEnd;
+extern void mysrandom(unsigned int seed);
+extern int myrandom(void);
+
void ZippyInit()
{
char *p;
if ( p != NULL ) {
appData.zippyAcceptOnly = p;
}
-
+
/* Should Zippy use "i" command? */
/* Defaults to 1=true */
p = getenv("ZIPPYUSEI");
*/
-char *swifties[] = {
+char *swifties[] = {
"i acclaims:", "i admonishes:", "i advertises:", "i advises:",
"i advocates:", "i affirms:", "i alleges:", "i anathematizes:",
"i animadverts:", "i announces:", "i apostrophizes:",
"i enthuses:", "i entreats:", "i enunciates:", "i eulogizes:",
"i exclaims:", "i execrates:", "i exhorts:", "i expatiates:",
"i explains:", "i explicates:", "i explodes:", "i exposes:",
- "i exposits:", "i expounds:", "i expresses:", "i extols:",
+ "i exposits:", "i expostulates: ",
+ "i expounds:", "i expresses:", "i extols:",
"i exults:", "i fantasizes:", "i fibs:", "i filibusters:",
"i flatters:", "i flutes:", "i fools:", "i free-associates:",
"i fulminates:", "i gabbles:", "i gabs:", "i gasps:",
"i hosannas:", "i howls:", "i hums:", "i hypothecates:",
"i hypothesizes:", "i imagines:", "i implies:", "i implores:",
"i imprecates:", "i indicates:", "i infers:",
- "i informs everyone:", "i instructs:", "i interjects:",
+ "i informs everyone:", "i instructs:", "i interjects:",
"i interposes:", "i intimates:", "i intones:", "i introspects:",
"i inveighs:", "i jabbers:", "i japes:", "i jests:", "i jibes:",
"i jives:", "i jokes:", "i joshes:", "i keens:", "i laments:",
#define MAX_SPEECH 250
-void Speak(how, whom)
+void Speak(how, whom)
char *how, *whom;
{
static FILE *zipfile = NULL;
char *p;
int c, speechlen;
Boolean done;
-
+
if (strcmp(how, "shout") == 0) {
now = time((time_t *) NULL);
if (now - lastShout < 1*60) return;
}
fstat(fileno(zipfile), &zipstat);
}
-
+
for (;;) {
fseek(zipfile, (unsigned) random() % zipstat.st_size, 0);
do {
/* If this is a computer, save the name. Then later, once the */
/* game is really started, we will send the "computer" notice to */
- /* the engine. */
+ /* the engine. */
if (appData.zippyPlay &&
looking_at(buf, i, "* is in the computer list")) {
int i;
}
/* Tells and says */
- if (appData.zippyPlay &&
+ if (appData.zippyPlay &&
(looking_at(buf, i, "* offers to be your bughouse partner") ||
looking_at(buf, i, "* tells you: [automatic message] I chose you"))) {
player = StripHighlightAndTitle(star_match[0]);
SendToICS(reply);
Speak("tell", player);
}
- }
+ }
if (looking_at(buf, i, "Notification: * has departed")) {
if (((unsigned) random() % 3) == 0) {
sprintf(reply, "farewell %s\n", player);
SendToICS(reply);
}
- }
+ }
if (looking_at(buf, i, "Not sent -- * is censoring you")) {
char *player = StripHighlightAndTitle(star_match[0]);
sprintf(reply, "%s-notify %s\n", ics_prefix, player);
SendToICS(reply);
}
- }
+ }
if (looking_at(buf, i, "command is currently turned off")) {
appData.zippyUseI = 0;
base = atoi(sbase);
increment = atoi(sincrement);
+ /* If icsAnalyzeEngine active
+ we don't accept automatic games */
+ if (appData.icsActive)
+ if (appData.icsEngineAnalyze) return;
+
/* If desired, you can insert more code here to decline matches
based on rated, variant, base, and increment, but it is
easier to use the ICS formula feature instead. */
/* Yes, and this isn't him. Ignore challenge. */
return;
}
-
+
/* Too many consecutive games with same opponent? If so, make him
wait until someone else has played or a timeout has elapsed. */
if (appData.zippyMaxGames &&
return TRUE;
}
- if (looking_at(buf, i, "offers you a draw")) {
- if (first.sendDrawOffers && first.initDone) {
- SendToProgram("draw\n", &first);
+ if (ics_type == ICS_ICC) {
+ if (looking_at(buf, i, "Your opponent offers you a draw")) {
+ if (first.sendDrawOffers && first.initDone)
+ SendToProgram("draw\n", &first);
+ return TRUE;
+ }
+ } else {
+ if (looking_at(buf, i, "offers you a draw")) {
+ if (first.sendDrawOffers && first.initDone) {
+ SendToProgram("draw\n", &first);
+ }
+ return TRUE;
+ }
}
- return TRUE;
- }
if (looking_at(buf, i, "requests that the game be aborted") ||
looking_at(buf, i, "would like to abort")) {
return FALSE;
}
-/* Initialize chess program with data from the first board
+/* Initialize chess program with data from the first board
* of a new or resumed game.
*/
void ZippyFirstBoard(moveNum, basetime, increment)
message from ICS." Send 0 in that case */
w = (gameInfo.whiteRating >= 0) ? gameInfo.whiteRating : 0;
b = (gameInfo.blackRating >= 0) ? gameInfo.blackRating : 0;
-
+
firstMove = FALSE;
if (gameMode == IcsPlayingWhite) {
if (first.sendName) {
} else {
/* Position not sent above, move list might be sent later */
/* Nothing needs to be done here */
- }
+ }
}
}