Beispiel #1
0
        //----------------------------------------------------------------------//
        internal bool IsMatchingFlip(Board.Tile i_FirstTile, Board.Tile i_SecondTile)
        {
            bool isMatchingSet    = false;
            bool openedFirstTile  = false;
            bool openedSecondTile = false;

            if (!i_FirstTile.IsOpen)
            {
                i_FirstTile.OpenTile();
                openedFirstTile = true;
            }

            if (!i_SecondTile.IsOpen)
            {
                i_SecondTile.OpenTile();
                openedSecondTile = true;
            }

            isMatchingSet = i_FirstTile.ContentOfTile == i_SecondTile.ContentOfTile;

            if (openedFirstTile)
            {
                i_FirstTile.CloseTile();
            }

            if (openedSecondTile)
            {
                i_SecondTile.CloseTile();
            }

            return(isMatchingSet);
        }
Beispiel #2
0
 //----------------------------------------------------------------------//
 internal void OpenAndPrintBoard(Board.Tile i_FirstTile, Board.Tile i_SecondTile, UserInterface i_UI, Player i_Player)
 {
     i_FirstTile.OpenTile();
     i_UI.ClearScreenShowBoard(i_Player);
     System.Threading.Thread.Sleep(2000);
     i_SecondTile.OpenTile();
     i_UI.ClearScreenShowBoard(i_Player);
 }
Beispiel #3
0
        //----------------------------------------------------------------------//
        private void userInputMove(out Board.Tile io_Tile, Player i_Player)
        {
            string userMoveInput = Console.ReadLine();

            this.m_Game.DidUserQuit(userMoveInput);

            while (!this.m_Game.CheckForValidGameMove(userMoveInput, out io_Tile) || (io_Tile != null && io_Tile.IsOpen == true))
            {
                if ((io_Tile != null && io_Tile.IsOpen == true))
                {
                    Console.Write("Tile already open, please re-enter another tile to flip: ");
                }
                else
                {
                    Console.Write("Invalid tile, please re-enter another tile to flip: ");
                }

                userMoveInput = Console.ReadLine();
                this.m_Game.DidUserQuit(userMoveInput);
            }

            io_Tile.OpenTile();
            this.ClearScreenShowBoard(i_Player);
        }