예제 #1
0
파일: UI.cs 프로젝트: Roy-44/Concentration
        private static void computerTurn(Player io_PlayingPlayer, Player io_Player2, Board io_Board, ref bool o_KeepPlaying)
        {
            Card.CardCoordinate cardsToChoose = io_PlayingPlayer.OptionalChoices.ChooseCardFromMemmory();
            if (cardsToChoose == null)
            {
                cardsToChoose = io_PlayingPlayer.OptionalChoices.ChooseRandomCards(io_Board);
            }

            revealCard(cardsToChoose.FirstCoordinate.Value, io_Board, io_PlayingPlayer, io_Player2);
            io_PlayingPlayer.OptionalChoices.Memmorize(io_Board.Matrix[cardsToChoose.FirstCoordinate.Value.X, cardsToChoose.FirstCoordinate.Value.Y], cardsToChoose.FirstCoordinate.Value);
            Thread.Sleep(k_RevealWaitingTime);
            revealCard(cardsToChoose.SecondCoordinate.Value, io_Board, io_PlayingPlayer, io_Player2);
            io_PlayingPlayer.OptionalChoices.Memmorize(io_Board.Matrix[cardsToChoose.SecondCoordinate.Value.X, cardsToChoose.SecondCoordinate.Value.Y], cardsToChoose.SecondCoordinate.Value);
            Thread.Sleep(k_RevealWaitingTime);
            if (io_Board.Matrix[cardsToChoose.FirstCoordinate.Value.X, cardsToChoose.FirstCoordinate.Value.Y].Value == io_Board.Matrix[cardsToChoose.SecondCoordinate.Value.X, cardsToChoose.SecondCoordinate.Value.Y].Value)
            {
                io_PlayingPlayer.AddPoint();
                o_KeepPlaying = true;
                io_PlayingPlayer.OptionalChoices.Forget(io_Board.Matrix[cardsToChoose.FirstCoordinate.Value.X, cardsToChoose.FirstCoordinate.Value.Y]);
            }
            else
            {
                Screen.Clear();
                io_Board.Matrix[cardsToChoose.FirstCoordinate.Value.X, cardsToChoose.FirstCoordinate.Value.Y].IsVisable   = false;
                io_Board.Matrix[cardsToChoose.SecondCoordinate.Value.X, cardsToChoose.SecondCoordinate.Value.Y].IsVisable = false;
                PrintBoard(io_Board, io_PlayingPlayer, io_Player2);
            }
        }
예제 #2
0
            public Card.CardCoordinate ChooseCardFromMemmory()
            {
                Card.CardCoordinate retCard = null;
                foreach (Card.CardCoordinate cardInMemmory in m_OptionalChoices)
                {
                    if (cardInMemmory != null && cardInMemmory.Appearance == 2)
                    {
                        retCard = cardInMemmory;
                    }
                }

                return(retCard);
            }