Esempio n. 1
0
 public void Should_Have_To_Fill_In_Final_Slot_On_Fifth()
 {
     Randomizer.Seed(0);
     TakeTurns(4);
     PlayerA.TakeTurn();
     Approvals.Verify(Board.Ascii());
 }
Esempio n. 2
0
        public void PlayGame()
        {
            switch (GameMode)
            {
            case GameMode.PlayerVsComputer:
                PlayerVsComputer();
                break;

            default:
                ComputerVsComputer();
                break;
            }


            PlayerA.ShowBoards();
            PlayerB.ShowBoards();

            if (PlayerA.HasLost)
            {
                Console.WriteLine(PlayerB.Name + " has won the game!");
            }
            else if (PlayerB.HasLost)
            {
                Console.WriteLine(PlayerA.Name + " has won the game!");
            }
        }
Esempio n. 3
0
 private void PlayerVsComputer()
 {
     PlayerA.ShowBoards();
     while (!PlayerA.HasLost && !PlayerB.HasLost)
     {
         Round();
         PlayerA.ShowBoards();
     }
 }
Esempio n. 4
0
        public void Should_Attempt_Open_Line_On_Fourth_Move(int seed, int expectedX, int expectedY)
        {
            Randomizer.Seed(seed);

            TakeTurns(3);
            Board.Dump();
            PlayerA.TakeTurn();

            VerifyCell(expectedX, expectedY, 'X');
            using (ApprovalResults.ForScenario(seed))
            {
                Approvals.Verify(Board.Ascii());
            }
        }
Esempio n. 5
0
        public void Always_Chooses_Spot_With_Least_Opponents_On_Second_Move(int seed, int expectedX, int expectedY)
        {
            Randomizer.Seed(seed);

            TakeTurns(1);

            PlayerA.TakeTurn();

            VerifyCell(expectedX, expectedY, 'X');
            using (ApprovalResults.ForScenario(seed))
            {
                Approvals.Verify(Board.Ascii());
            }
        }
Esempio n. 6
0
        public async void MediatorTest()
        {
            PlayerMediator mediator = new PlayerMediator();
            PlayerA        playerA  = new PlayerA(mediator);
            PlayerB        playerB  = new PlayerB(mediator);

            mediator.playerA = playerA;
            mediator.playerb = playerB;

            playerA.Send("aa");
            playerB.Send("bb");

            Assert.True(playerA.GetChat().Count == 2);
        }
Esempio n. 7
0
        private void Round()
        {
            Point      shotPossition = PlayerA.FireShot();
            ShotResult result        = PlayerB.ProcessShot(shotPossition);

            PlayerA.ProcessShotResult(shotPossition, result);

            if (!PlayerB.HasLost)
            {
                shotPossition = PlayerB.FireShot();
                result        = PlayerA.ProcessShot(shotPossition);
                PlayerB.ProcessShotResult(shotPossition, result);
            }
        }
    void Start()
    {
        test1 = FindObjectOfType <test>();

        oyuncu  = FindObjectOfType <Player>();
        oyuncuA = FindObjectOfType <PlayerA>();
        oyuncuB = FindObjectOfType <PlayerB>();
        oyuncuC = FindObjectOfType <PlayerC>();
        oyuncuD = FindObjectOfType <PlayerD>();
        ld      = FindObjectOfType <LoadScene>();
        StartCoroutine(Text());
        UnityEngine.PlayerPrefs.SetInt("FirstSituation", oyuncu.MevcutAltin);

        UnityEngine.PlayerPrefs.Save();
    }
Esempio n. 9
0
        public void Should_Always_Fill_Gap_On_Second_Move(int seed, int expectedX, int expectedY)
        {
            Randomizer.Seed(seed);

            TakeTurns(1);
            PlayerA.TakeTurn();
            Board.Dump();
            PlayerB.TakeTurn();

            VerifyCell(expectedX, expectedY, 'O');
            using (ApprovalResults.ForScenario(seed))
            {
                Approvals.Verify(Board.Ascii());
            }
        }
Esempio n. 10
0
        private void btnPlayer(object sender, MouseButtonEventArgs e)
        {
            var wnd = new vwPlayer();

            wnd.Owner        = this;
            wnd.PlayerA.Text = PlayerAName.Text;
            wnd.PlayerB.Text = PlayerBName.Text;
            wnd.ShowDialog();
            if (wnd.Reset)
            {
                PlayerA.ResetCount();
                PlayerB.ResetCount();
                this.Hauptschlag.SetHauptschlag(null);
            }
            PlayerAName.Text = wnd.PlayerAName;
            PlayerBName.Text = wnd.PlayerBName;
        }
        public static void Start()
        {
            PlayerBase playerA = new PlayerA();

            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            PlayerBase playerB = new PlayerB();

            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();

            Console.WriteLine("-------------With Decorators-----------");

            playerA = new Tiger(playerA);
            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            playerA = new Cheetah(playerA);
            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            playerB = new Kangaroo(playerB);
            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();

            playerB = new Tiger(playerB);
            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();
        }
    public SoldierController getSoilderByID(string id)
    {
        SoldierController s = PlayerB.getSoilderByID(id);

        if (s != null)
        {
            int pos = PlayerB.getSoildersPos(id);
            pos = 4 - pos;
            s   = PlayerA.getSoilderByPos(pos);
            return(s);
        }

        SoldierController s2 = PlayerA.getSoilderByID(id);

        if (s2 != null)
        {
            int pos = PlayerA.getSoildersPos(id);
            pos = 4 - pos;
            s2  = PlayerB.getSoilderByPos(pos);
            return(s2);
        }
        return(null);
    }
Esempio n. 13
0
    public void Split()
    {
        if (split)
        {
        }
        else
        {
            // Player A
            Camera[] playerACameras = PlayerA.GetComponentsInChildren <Camera>();
            foreach (Camera camera in playerACameras)
            {
                camera.rect = new Rect(0, 0, 0.5f, 1);
            }

            // Player B
            Camera[] playerBCameras = PlayerB.GetComponentsInChildren <Camera>();
            foreach (Camera camera in playerBCameras)
            {
                camera.rect = new Rect(0.5f, 0, 0.5f, 1);
            }

            split = true;
        }
    }
Esempio n. 14
0
 // Start is called before the first frame update
 void Start()
 {
     playera = FindObjectOfType <PlayerA>();
 }