Пример #1
0
        public void Init()
        {
            score     = 0;
            roundType = 0;
            president = 0;

            fourburn  = false;
            passTimes = 0;

            leftWin   = false;
            rightWin  = false;
            playerWin = false;
            won       = false;

            playerCards = new List <Card>();
            rightCards  = new List <Card>();
            leftCards   = new List <Card>();
            deckLogic   = new DeckLogic();
            for (int i = 0; i < 52; i++)
            {
                if (i <= 17)
                {
                    playerCards.Add(deckLogic.getdeck.cardsA[i]);
                }
                else if (i <= 34)
                {
                    rightCards.Add(deckLogic.getdeck.cardsA[i]);
                }
                else if (i <= 51)
                {
                    leftCards.Add(deckLogic.getdeck.cardsA[i]);
                }
            }



            KupaUI kupaUI = gameBoard.KupaUI;

            kupaLogic = new KupaLogic(kupaUI);

            ComputerHand computerHandRight = gameBoard.RightHand;

            compLogicRight = new ComputerLogic(computerHandRight);
            compLogicRight.AddCardsToComputerHand(rightCards);


            ComputerHand computerHandLeft = gameBoard.LeftHand;

            compLogicLeft = new ComputerLogic(computerHandLeft);
            compLogicLeft.AddCardsToComputerHand(leftCards);

            PlayerHand playerHand = gameBoard.PlayerHand;

            playerLogic = new PlayerLogic(playerHand);
            playerLogic.AddCardsToPlayerHand(playerCards);

            playerLogic.PlayerCardsClickable = false;
            playerLogic.HighestCardType      = Card.CardTypeEnum.Ace;
        }
Пример #2
0
        public ComputerLogicTest()
        {
            Board board = new Board();

            board.SetMarkers("X", "O");
            WinConditions winConditions = new WinConditions();

            this.computerLogic = new ComputerLogic(winConditions);
        }
        public void CreateAvailableButtons_ExistingBoardGiven_ReturnNineButtonList()
        {
            board = InitializeListTestData("?");
            List <Button> availableButtons = ComputerLogic.CreateAvailableButtons(board);
            int           expectedValue    = board.buttonList.Count;
            int           actualValue      = availableButtons.Count;

            Assert.AreEqual(expected: expectedValue, actual: actualValue);
        }
Пример #4
0
        /// <summary>
        /// Constructor for Game class, prepares board for gameplay
        /// </summary>
        /// <param name="gameScreen">RichTextBox for a playing board</param>
        /// <param name="playerCursor">Run for player cursor</param>
        /// <param name="computerText">Run for computer sayings</param>
        /// <param name="mainMenu">RichTextBox of main menu</param>
        /// <param name="information">RichTextBox of information screen</param>
        public Game(RichTextBox gameScreen, Run playerCursor, Run computerText, RichTextBox mainMenu, RichTextBox information)
        {
            GameScreen   = gameScreen;
            MainMenu     = mainMenu;
            ComputerText = computerText;
            Information  = information;

            PlayerBoard   = new Board();
            ComputerBoard = new Board(true, true);
            PlayerCursor  = new Cursor(playerCursor);
            ComputerBrain = new ComputerLogic();

            UpdateScreen();
        }
Пример #5
0
 /// <summary>
 /// Reset the game after round ends
 /// </summary>
 private void ResetGame()
 {
     PlayerBoard    = new Board();
     ComputerBoard  = new Board(true, true);
     ComputerBrain  = new ComputerLogic();
     PlayerCursor.X = PlayerCursor.Y = 0;
     ChangePhase(GamePhase.BoardPlanning);
     currentShipLength      = 4;
     currentShipOrientation = false;
     currentPlacementViable = false;
     shipsLeftToPlace       = 1;
     playerScore            = 0;
     computerScore          = 0;
     UpdateScreen();
     PostComputerMessage("No cóż, czas na kolejną rozgrywkę, ustawiaj statki!");
 }
Пример #6
0
        /// <summary>
        /// Constructor of single player mode
        /// </summary>
        /// <param name="difficult">Difficult of game</param>
        /// <param name="humanName">Name of human</param>
        /// <param name="locale">Locale</param>
        public SinglePlayer(Enum difficult, string humanName, Locale locale)
        {
            GameType  = GameTypes.Single;
            Difficult = difficult;
            switch (Difficult)
            {
            case Game.Difficults.Low:
                logic = LowDifficultLogic;
                break;

            case Game.Difficults.Hard:
                logic = HardDifficultLogic;
                break;
            }
            BotName = locale.GetBotNameText();
            SelectPlayers(humanName);
            ClearGameField();
        }
Пример #7
0
        private void ResetBoard()
        {
            gameBoard.btnShowHide.Enabled = false;
            won       = false;
            roundType = 0; //save

            president = 0;

            fourburn  = false; //save
            passTimes = 0;     //save

            leftWin   = false;
            rightWin  = false;
            playerWin = false;

            playerCards = new List <Card>(); //save
            rightCards  = new List <Card>(); //save
            leftCards   = new List <Card>(); //save
            deckLogic   = new DeckLogic();   //save

            gameBoard.btnStart.Enabled      = true;
            gameBoard.btnPlayerDone.Enabled = false;

            for (int i = 0; i < 52; i++)
            {
                if (i <= 17)
                {
                    playerCards.Add(deckLogic.getdeck.cardsA[i]);
                }
                else if (i <= 34)
                {
                    rightCards.Add(deckLogic.getdeck.cardsA[i]);
                }
                else if (i <= 51)
                {
                    leftCards.Add(deckLogic.getdeck.cardsA[i]);
                }
            }

            kupaLogic.DeleteAllKupaCards();
            KupaUI kupaUI = gameBoard.KupaUI;

            kupaLogic = new KupaLogic(kupaUI);

            ComputerHand computerHandRight = gameBoard.RightHand;

            compLogicRight = new ComputerLogic(computerHandRight);
            compLogicRight.AddCardsToComputerHand(rightCards);


            ComputerHand computerHandLeft = gameBoard.LeftHand;

            compLogicLeft = new ComputerLogic(computerHandLeft);
            compLogicLeft.AddCardsToComputerHand(leftCards);

            PlayerHand playerHand = gameBoard.PlayerHand;

            playerLogic = new PlayerLogic(playerHand);
            playerLogic.AddCardsToPlayerHand(playerCards);

            playerLogic.PlayerCardsClickable = false;

            gameBoard.txtMessages.Text        = "";
            gameBoard.lblPlayerNameLabel.Text = "";

            gameBoard.Refresh();
        }