public void StartGameToPlay() { byte indexMoves = 0; // // rember to erase one day /* * Ai comp; * * if (vsComp == true) * { * comp = new Ai(); * * } * else * { * * P2 name2 = "Hello"; * } */ while (m_ActiveGame.GameOn() == true) { string[] gameMoveLazy = {}; // rember to erase one day string moveInString; m_UiOfGame.PrintBoardGame(); if (indexMoves < gameMoveLazy.Length) { // some legal move/eat of the computer. return . moveInString = gameMoveLazy[indexMoves]; // the move done. indexMoves++; } else { moveInString = Console.ReadLine(); } // string moveInString = Console.ReadLine(); // replace to method m_ActiveGame.PlayingVessel(moveInString); if (m_ActiveGame.IsTurnPass) { /* * if (m_ActiveGame.IsEated == true) * { * * * } */ // moveInBoard moveInBoard(moveInString); } m_UiOfGame.PrintBoardGame(); } }
// yosi end public void StartGameToPlay() { byte indexMoves = 0; // // rember to erase one day string[] gameMoveLazy = /* "Dc>Ed", "Ef>Fe", "Cb>Dc", "Fe>Gd", * "Fc>He","Gf>Fe","Ed>Gf","Hg>Fe","He>Gf","Fg>Ef","Gf>Hg" ,"Gh>Fg"*/ { }; // rember to erase one day string moveInString = null; string lastMove = null; while (m_ActiveGame.GameOn() == true && m_WantToPlay == true) { m_UiOfGame.PrintBoardGame(); if (lastMove != null) { Console.WriteLine("{2} move was {1}{0}", Environment.NewLine, lastMove, m_ActiveGame.NowPlaying == player1 ? m_player2.Name + " (x)": m_player1.Name + " (o)"); } Console.WriteLine("{0}Playing now -> {1}{0}", Environment.NewLine, m_ActiveGame.NowPlaying == player1 ? m_player1.Name + "(o)": m_player2.Name + "(x)"); // yosi start if (indexMoves < gameMoveLazy.Length) { // some legal move/eat of the computer. return . moveInString = gameMoveLazy[indexMoves]; // the move done. indexMoves++; } else { if (m_ActiveGame.NowPlaying == player1) { // replace that // moveInString = matricxChekers.AiForDamka.TheBestMoveToDoForPlayer1(m_ActiveGame); moveInString = InputChecking(); } else { if (m_player2.Name == null) { moveInString = matricxChekers.AiForDamka.TheBestMoveToDoForPlayer2(m_ActiveGame); } else { //replace that // moveInString = matricxChekers.AiForDamka.TheBestMoveToDoForPlayer2(m_ActiveGame); moveInString = InputChecking(); } } } const byte lengthToQuit = 1, legalLengthInput = 5; if (moveInString != null && moveInString.Length == legalLengthInput) { m_ActiveGame.PlayingVessel(moveInString); if (m_ActiveGame.IsTurnPass) { moveInBoard(moveInString); if (m_ActiveGame.IsEated) { multiEatingByPlayer(moveInString); } m_ActiveGame.ChangePlayer(); lastMove = moveInString; } } else if (moveInString != null && moveInString.Length == lengthToQuit) { gameOver(1); lastMove = null; } } if (m_ActiveGame.GameOn() == false) { gameOver(); } }