public static string simplyCalculateMove(string sFEN) { bool w2m = sFEN.Contains(" w "); CuckComp = new ComputerPlayer(); CuckHumn = new HumanPlayer(); if (w2m) { CuckGM = new Game(CuckComp, CuckHumn); } else { CuckGM = new Game(CuckHumn, CuckComp); } CuckGM.handleCommand("setpos " + sFEN); Position pos = CuckGM.getPos(); CuckComp.maxTimeMillis = 1 * 100; CuckComp.maxTimeMillis = 6 * 100; CuckComp.maxDepth = 8; string CurrentPositionFEN = TextIO.toFEN(pos); string cmd = CuckComp.getCommand(new Position(pos), CuckGM.haveDrawOffer(), CuckGM.getHistory()); string a = cmd; if ((a.Length > 1) && (("NBRQK").IndexOf(a[0]) >= 0)) { a = a.Substring(1); } if (a[0] == 'O') { a = (a.Length == 3 ? (w2m?"e1g1":"e8g8") : (w2m?"e1c1":"e8c8")); } else { a = ((a.Length > 4) ? a.Substring(0, 2) + a.Substring(3) : ""); } return(a); }
private void Sample() { CuckComp = new ComputerPlayer(); CuckHumn = new HumanPlayer(); CuckBK = new Book(false); CuckGM = new Game(CuckHumn, CuckComp); Position pos = CuckGM.getPos(); // e4(102) d4(31) ... string CurrentBookMoves = CuckBK.getAllBookMoves(pos); // Nb1-a3;Nb1-c3;...;a2-a3;a2-a4;... string CurrentValidMoves = TextIO.AllMovesTostring(pos, true); // RNB...w KQkq... string CurrentPositionFEN = TextIO.toFEN(pos); // Display board to console TextIO.DispBoard(pos); // Swap & move CuckGM.whitePlayer = CuckComp; CuckGM.blackPlayer = CuckHumn; //CuckComp.bookEnabled = false; CuckComp.maxTimeMillis = 1 * 100; CuckComp.maxTimeMillis = 6 * 100; //CuckComp.maxDepth = 6; // Ng1-f3 string CommandFromComp = CuckComp.getCommand(new Position(pos), CuckGM.haveDrawOffer(), CuckGM.getHistory()); }
public static string simplyCalculateMove(string sFEN) { bool w2m = sFEN.Contains(" w "); CuckComp = new ComputerPlayer(); CuckHumn = new HumanPlayer(); if(w2m) CuckGM = new Game(CuckComp, CuckHumn); else CuckGM = new Game(CuckHumn, CuckComp); CuckGM.handleCommand("setpos " + sFEN); Position pos = CuckGM.getPos(); CuckComp.maxTimeMillis = 1 * 100; CuckComp.maxTimeMillis = 6 * 100; CuckComp.maxDepth = 8; string CurrentPositionFEN = TextIO.toFEN(pos); string cmd = CuckComp.getCommand(new Position(pos), CuckGM.haveDrawOffer(), CuckGM.getHistory()); string a = cmd; if ((a.Length > 1) && (("NBRQK").IndexOf(a[0]) >= 0)) a = a.Substring(1); if (a[0]=='O') a=(a.Length==3 ? (w2m?"e1g1":"e8g8") : (w2m?"e1c1":"e8c8")); else a = ((a.Length > 4) ? a.Substring(0, 2) + a.Substring(3) : ""); return a; }