public List <EngineConfigurationWithAdaptor> FindEngines(Game game) { List <EngineConfigurationWithAdaptor> supportingEngines = new List <EngineConfigurationWithAdaptor>(); foreach (EngineConfiguration engine in engines) { if (game.GameAttribute.XBoardName != null && engine.SupportedVariants.Contains(game.GameAttribute.XBoardName)) { // this engine directly supports this variant supportingEngines.Add(new EngineConfigurationWithAdaptor(engine, null)); } else { // check with the Game class to see if engine can be adapted EngineGameAdaptor adaptor = game.TryCreateAdaptor(engine); if (adaptor != null) { adaptor.Initialize(game); supportingEngines.Add(new EngineConfigurationWithAdaptor(engine, adaptor)); } } } return(supportingEngines); }
// *** WINBOARD ENGINE SUPPORT *** // #region TryCreateAdaptor public override EngineGameAdaptor TryCreateAdaptor(EngineConfiguration config) { if (config.SupportedVariants.Contains("normal") && config.SupportedFeatures.Contains("setboard")) { EngineGameAdaptor adaptor = new EngineGameAdaptor("normal"); adaptor.IssueSetboard = true; return(adaptor); } return(null); }
public EngineConfigurationWithAdaptor AdaptEngine(Game game, EngineConfiguration engine) { if (game.GameAttribute.XBoardName != null && engine.SupportedVariants.Contains(game.GameAttribute.XBoardName)) { return(new EngineConfigurationWithAdaptor(engine, null)); } EngineGameAdaptor adaptor = game.TryCreateAdaptor(engine); if (adaptor != null) { return(new EngineConfigurationWithAdaptor(engine, adaptor)); } return(null); }
// *** XBOARD ENGINE SUPPORT *** // #region TryCreateAdaptor public override EngineGameAdaptor TryCreateAdaptor(EngineConfiguration config) { if (config.SupportedVariants.Contains("capablanca") && config.SupportedFeatures.Contains("setboard") && Castling.Value == "Standard") { // It is possible that this engine might be adaptable ... // Verify the basics. If pawn moves are different, forget it if (PawnDoubleMove == true && EnPassant == true) { EngineGameAdaptor adaptor = new EngineGameAdaptor("capablanca"); adaptor.IssueSetboard = true; // Do we need to translate piece notations? if (Chancellor.Notation[0] != "C") { adaptor.TranslatePieceNotation(Chancellor.Notation[0], "C"); } if (Chancellor.Notation[1] != "c") { adaptor.TranslatePieceNotation(Chancellor.Notation[1], "c"); } if (Archbishop.Notation[0] != "A") { adaptor.TranslatePieceNotation(Archbishop.Notation[0], "A"); } if (Archbishop.Notation[1] != "a") { adaptor.TranslatePieceNotation(Archbishop.Notation[0], "a"); } // If the Kings are on the "f" file, we're good with what we have if (StartingPieces["f1"] == new GenericPiece(0, King)) { return(adaptor); } // If the Kings are on the "e" file, we can do it, but we need // to mirror the board (make the engine think we are playing a // mirror image.) if (StartingPieces["e1"] == new GenericPiece(0, King)) { adaptor.MirrorBoard = true; return(adaptor); } } } return(null); }