Exemplo n.º 1
0
        // yosi end

        public static void PlayingTestLogic()
        {
            CheckersLogic Board = new CheckersLogic(8);

            Board.PrintBoard();

            string str = Console.ReadLine();

            while (char.ToUpper(str[0]) != 'Q')
            {
                Board.PlayingVessel(str);
                Board.PrintBoard();
                str = Console.ReadLine();
            }
        }
Exemplo n.º 2
0
        public static void Playing()
        {
            CheckersLogic Board = new CheckersLogic(8);

            // Board.PrintBoard();

            Board.PlayingVessel("Ac>Bd"); // Bf>Ce
            Board.PlayingVessel("Bf>Ce");
            Board.PlayingVessel("Cc>Dd");
            Board.PlayingVessel("Hf>Ge");
            Board.PlayingVessel("Dd>Ee");
            Board.PlayingVessel("Df>Fd");
            Board.PlayingVessel("Ec>Dd");
            Board.PlayingVessel("Fd>Ec");
            Board.PlayingVessel("Bb>Cc");
            //Board.PlayingVessel("Ce>Ec"); // didnt work and it is Good!!!
            Board.PlayingVessel("Ce>Ac");
            Board.PlayingVessel("Ca>Bb");
            Board.PlayingVessel("Ac>Ca"); // should become to King by number 1King(3), 2King(4)
            Board.PlayingVessel("Dd>Ce");
            Board.PlayingVessel("Ca>Bb");
            Board.PlayingVessel("Ce>Bf");
            Board.PlayingVessel("Ff>Ee");
            Board.PlayingVessel("Cc>Bd");
            Board.PlayingVessel("Ag>Ce");
            Board.PlayingVessel("Ce>Ac");
            Board.PlayingVessel("Db>Fd");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            // -- from  here to
            //Board.PlayingVessel("Db>Fd");
            //Board.PlayingVessel("Cg>Df");
            //Board.PlayingVessel("Fd>Ee");
            //Board.PlayingVessel("Bb>Ac");
            //Board.PlayingVessel("Gc>Hd");
            //Board.PlayingVessel("Ff>Dd");
            // -- to here its just to see if all work back and front eating.
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");
            //Board.PlayingVessel("");

            //Board.PrintBoard();

            string str = Console.ReadLine();

            while (char.ToUpper(str[0]) != 'Q')
            {
                Board.PlayingVessel(str);
                Board.PrintBoard();
                str = Console.ReadLine();
            }
        }
Exemplo n.º 3
0
        public static void Playing2()
        {
            Console.Title = "Damka , Good Luck";

            CheckersLogic Board = new CheckersLogic(8);

            Board.PlayingVessel("Ac>Bd"); // Bf>Ce
            Board.PlayingVessel("Bf>Ce");
            Board.PlayingVessel("Cc>Dd");
            Board.PlayingVessel("Hf>Ge");
            Board.PlayingVessel("Dd>Ee");
            Board.PlayingVessel("Df>Fd");
            Board.PlayingVessel("Ec>Dd");
            Board.PlayingVessel("Fd>Ec");
            Board.PlayingVessel("Bb>Cc");

            Board.PlayingVessel("Gg>Hf");
            Board.PlayingVessel("Aa>Bb");
            Board.PlayingVessel("Fh>Gg");


            //// ------- Multi eat
            Board.PlayingVessel("Db>Fd");
            Board.PlayingVessel("Ge>Ec");
            Board.PlayingVessel("Gc>Hd");
            Board.PlayingVessel("Hf>Ge");
            Board.PlayingVessel("Bd>Df");
            //// ------ end.

            //Board.PlayingVessel("");
            //Board.PlayingVessel("");

            Board.PrintBoard();



            string str = Console.ReadLine();

            while (char.ToUpper(str[0]) != 'Q')
            {
                Board.PlayingVessel(str);
                Board.PrintBoard();
                str = Console.ReadLine();
            }
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        // 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();
            }
        }