Page 1 of 1

Winboard variants online

Posted: Wed Mar 22, 2017 11:04 pm
by zenpawn
When using Winboard to connect to an ICS with variants specified as different wild #s, how does it interpret those into, say, a "variant fischerandom" command to the engine?

Thanks,
-Erin

Re: Winboard variants online

Posted: Wed Mar 22, 2017 11:26 pm
by hgm
It knows the wild numbers:

Code: Select all

    if (!found) {
      if ((StrCaseStr(e, "fischer") && StrCaseStr(e, "random"))
	  || StrCaseStr(e, "wild/fr")
	  || StrCaseStr(e, "frc") || StrCaseStr(e, "960")) {
        v = VariantFischeRandom;
      } else if ((i = 4, p = StrCaseStr(e, "wild")) ||
		 (i = 1, p = StrCaseStr(e, "w"))) {
	p += i;
	while (*p && (isspace(*p) || *p == '(' || *p == '/')) p++;
	if (isdigit(*p)) {
	  wnum = atoi(p);
	} else {
	  wnum = -1;
	}
	switch (wnum) {
	case 0: /* FICS only, actually */
	case 1:
	  /* Castling legal even if K starts on d-file */
	  v = VariantWildCastle;
	  break;
	case 2:
	case 3:
	case 4:
	  /* Castling illegal even if K & R happen to start in
	     normal positions. */
	  v = VariantNoCastle;
	  break;
	case 5:
	case 7:
	case 8:
	case 10:
	case 11:
	case 12:
	case 13:
	case 14:
	case 15:
	case 18:
	case 19:
	  /* Castling legal iff K & R start in normal positions */
	  v = VariantNormal;
	  break;
	case 6:
	case 20:
	case 21:
	  /* Special wilds for position setup; unclear what to do here */
	  v = VariantLoadable;
	  break;
	case 9:
	  /* Bizarre ICC game */
	  v = VariantTwoKings;
	  break;
	case 16:
	  v = VariantKriegspiel;
	  break;
	case 17:
	  v = VariantLosers;
	  break;
	case 22:
	  v = VariantFischeRandom;
	  break;
	case 23:
	  v = VariantCrazyhouse;
	  break;
	case 24:
	  v = VariantBughouse;
	  break;
	case 25:
	  v = Variant3Check;
	  break;
	case 26:
	  /* Not quite the same as FICS suicide! */
	  v = VariantGiveaway;
	  break;
	case 27:
	  v = VariantAtomic;
	  break;
	case 28:
	  v = VariantShatranj;
	  break;

	/* Temporary names for future ICC types.  The name *will* change in
	   the next xboard/WinBoard release after ICC defines it. */
	case 29:
	  v = Variant29;
	  break;
	case 30:
	  v = Variant30;
	  break;
	case 31:
	  v = Variant31;
	  break;
	case 32:
	  v = Variant32;
	  break;
	case 33:
	  v = Variant33;
	  break;
	case 34:
	  v = Variant34;
	  break;
	case 35:
	  v = Variant35;
	  break;
	case 36:
	  v = Variant36;
	  break;
        case 37:
          v = VariantShogi;
	  break;
        case 38:
          v = VariantXiangqi;
	  break;
        case 39:
          v = VariantCourier;
	  break;
        case 40:
          v = VariantGothic;
	  break;
        case 41:
          v = VariantCapablanca;
	  break;
        case 42:
          v = VariantKnightmate;
	  break;
        case 43:
          v = VariantFairy;
          break;
        case 44:
          v = VariantCylinder;
	  break;
        case 45:
          v = VariantFalcon;
	  break;
        case 46:
          v = VariantCapaRandom;
	  break;
        case 47:
          v = VariantBerolina;
	  break;
        case 48:
          v = VariantJanus;
	  break;
        case 49:
          v = VariantSuper;
	  break;
        case 50:
          v = VariantGreat;
	  break;
	case -1:
	  /* Found "wild" or "w" in the string but no number;
	     must assume it's normal chess. */
	  v = VariantNormal;
	  break;
	default:
	  len = snprintf(buf, MSG_SIZ, _("Unknown wild type %d"), wnum);
	  if( (len >= MSG_SIZ) && appData.debugMode )
	    fprintf(debugFP, "StringToVariant: buffer truncated.\n");

	  DisplayError(buf, 0);
	  v = VariantUnknown;
	  break;
	}
      }
    }

Re: Winboard variants online

Posted: Thu Mar 23, 2017 10:53 am
by zenpawn
Thanks. I hadn't noticed the same numbers are used on different sites. That's good. One of the sites also allows fischerandom to be sought with "wild fr". I see you have frc and wild/fr in the checks before the switch. Do they end up sending it to you as one of those in the "wild fr" case or is it safer to seek with wild 22?

Re: Winboard variants online

Posted: Thu Mar 23, 2017 11:36 am
by hgm
I think at least some ICS use these combinations, or WinBoard would not test for them. I think the ICS hard-codes abbreviations for the most common variants, like fr or zh, so it knows they are the same as wild/22 etc. The name in the form with a slash actually corresponds to a filename in the boards directory of the ICS install (the contents of the file describing the game parameters).

Re: Winboard variants online

Posted: Thu Mar 23, 2017 11:37 am
by zenpawn
Ah, so there's somewhere else that it checks for simply "fr" ?

Re: Winboard variants online

Posted: Thu Mar 23, 2017 11:48 am
by hgm
Well, there is some code before the section I posted that checks the character string for a sub-string corresponding to one of the CECP variant names. But 'fr' would not be recognized by that.

So I suppose that ICS just never indicate the variant as plain 'fr' in places where WinBoard would be interested to know what the variant is. Note that WinBoard is only interested in the variant when it receives the start message for a game that it is going to play, or in the header of a move list that it requested.

Re: Winboard variants online

Posted: Sat Mar 25, 2017 9:10 pm
by zenpawn
It's FICS that seems to indicate Fischer Random with "fr" rather than a number:

http://www.freechess.org/Help/HelpFiles/wild.html

though it's possible they pass it on to you as "fischerandom" (?)

Re: Winboard variants online

Posted: Sat Mar 25, 2017 10:05 pm
by hgm
I don't think the name "fischerandom" is known to any ICS.

If you type "boards" on FICS it will show you there is a category "uwild", and is you type "board uwild", the variants in there are all nombers. One of the numbers is 22. So I would not be surprised if "match XXX uwild 22" would be an alternative way to start a ICS game. FICS probably prefers to use the name "fr" itself.