// The constructor for the game simulation Input, that sets all of the game simulation input parameters.
        public GameSimulationInput(PlayerStrategy player_strategy, decimal balance, decimal bet_amount, DealerStrategy dealer_strategy,
                                   int number_of_decks, int deal_percentage, int number_of_simulation_hands, EnumDoubleOn double_on, bool double_after_split,
                                   EnumSurrender surrender_option, int number_of_replit_option, bool cannot_split_aces, bool hit_split_aces,
                                   bool cannot_split_4s_5s_10s, bool shuffle_after_each_hand, EnumCardBonus card_bonus_option,
                                   bool lucky_777, EnumBlackJackPays bj_pays_option, bool suited_bj_pays_2to1)
        {
            _PLAYER_STRATEGY = player_strategy;
            _BALANCE         = balance;
            _BET_AMOUNT      = bet_amount;

            _DEALERS_STRATEGY           = dealer_strategy;
            _NUMBER_OF_DECKS            = number_of_decks;
            _DEAL_PERCENTAGE            = deal_percentage;
            _NUMBER_OF_SIMULATION_HANDS = number_of_simulation_hands;

            _DOUBLE_ON_OPTION        = double_on;
            _DOUBLE_AFTER_SPLIT      = double_after_split;
            _SURRENDER_OPTION        = surrender_option;
            _NUMBER_OF_SPLIT_OPTION  = number_of_replit_option;
            _CANNOT_SPLIT_ACES       = cannot_split_aces;
            _HIT_SPLIT_ACES          = hit_split_aces;
            _CANNOT_SPLIT_4s_5s_10s  = cannot_split_4s_5s_10s;
            _SHUFFLE_AFTER_EACH_HAND = shuffle_after_each_hand;
            _CARD_BONUS_OPTION       = card_bonus_option;
            _LUCKY_777           = lucky_777;
            _BJ_PAYS_OPTION      = bj_pays_option;
            _SUITED_BJ_PAYS_2to1 = suited_bj_pays_2to1;
        }
Example #2
0
        public bool IsDouble(PlayerStrategy strategy, Card showCard)
        {
            var playerValue = this.Value();
            var dealerValue = showCard.Value;

            if (playerValue == 11 && !showCard.IsAce)
            {
                return(true);
            }
            if (playerValue == 10)
            {
                return(dealerValue != 10 && !showCard.IsAce);
            }
            if (playerValue == 9)
            {
                return(dealerValue == 3 || dealerValue == 4 || dealerValue == 5 || dealerValue == 6);
            }
            if ((playerValue == 18 || playerValue == 17) && IsSoft())
            {
                return(dealerValue == 3 || dealerValue == 4 || dealerValue == 5 || dealerValue == 6);
            }
            if ((playerValue == 16 || playerValue == 15) && IsSoft())
            {
                return(dealerValue == 4 || dealerValue == 5 || dealerValue == 6);
            }
            if ((playerValue == 14 || playerValue == 13) && IsSoft())
            {
                return(dealerValue == 5 || dealerValue == 6);
            }

            return(false);
        }
Example #3
0
        public bool IsComplete(PlayerStrategy strategy, Card dealerCard)
        {
            var playerValue     = Value();
            var dealerShowValue = dealerCard.Value;

            if (!IsSoft() && playerValue >= 17)
            {
                return(true);
            }

            if (IsSoft() && playerValue == 17)
            {
                return(!strategy.HitSoftSeventeen);
            }

            if (dealerShowValue >= 2 && dealerShowValue <= 6)
            {
                if (playerValue >= 12)
                {
                    return(true);
                }
            }


            return(false);
        }
Example #4
0
 public Player()
 {
     setStats(1);
     RockDamage     = 2;
     PaperDamage    = 2;
     ScissorsDamage = 2;
     Strategy       = new PlayerStrategy();
 }
Example #5
0
 public Player(string name, PlayerStrategy strategy)
 {
     this.Strategy = strategy;
     this.Name = name;
     IsActive = false;
     ScoreSheet = new ScoreSheet();
     ScoreSheet.setupGame("Yahtzee");
     this.StrategyDescription = strategy.ToString();
 }
Example #6
0
        public Result CalculateResult(PlayerStrategy strategy, int numberOfWins, int numberOfRuns)
        {
            System.Console.WriteLine($"Number of wins is {numberOfWins}");
            System.Console.WriteLine($"Number of runs is {numberOfRuns}");
            double percentage = (double)numberOfWins / numberOfRuns;

            System.Console.WriteLine($"% is {percentage:N2}");
            return(new Result(strategy, percentage));
        }
Example #7
0
    public void UpdateStrategy(PlayerStrategy _strategy)
    {
        Transform slot = transform.parent;

        slot.GetComponent <SquadSlotView>().Player.Strategy = _strategy;

        arrows = GetComponentsInChildren <SquadSelectionArrowView>();
        foreach (SquadSelectionArrowView arrow in arrows)
        {
            arrow.Select(arrow.Strategy == _strategy);
        }
    }
Example #8
0
        public static Strategy GetPlayerStrategy(string socketId)
        {
            Iterator i    = playersStrategies.CreateIterator();
            object   item = i.First();

            while (item != null)
            {
                PlayerStrategy tmp = (PlayerStrategy)item;
                if (tmp.socketId == socketId)
                {
                    return(tmp.activeStrategy);
                }
                item = i.Next();
            }
            return(null);
        }
Example #9
0
    private void Awake()
    {
        shootControl = GetComponent <PlayerShootController>();
        moveControl  = GetComponent <MoveController>();

        _normalStrategy            = new NormalStrategy(this, 20, 70, 2, 5, 0.35f);
        _agressiveUltimateStrategy = new AgressiveUltimate(this, 30, 50, 5, 8, 0.2f);
        _precisionUltimateStrategy = new PrecisionUltimate(this, 80, 70, 10, 15, 0.5f);
        _rewindUltimateStrategy    = new RewindUltimate(this, 20, 70, 3, 5, 0.2f);

        _allStrategies.Add(_normalStrategy);
        _allStrategies.Add(_agressiveUltimateStrategy);
        _allStrategies.Add(_precisionUltimateStrategy);
        _allStrategies.Add(_rewindUltimateStrategy);
        ChangeStrategy(Strategy.Normal);
    }
Example #10
0
        public static void ChangeActiveStrategy(string socketId, Strategy strategy)
        {
            Iterator i    = playersStrategies.CreateIterator();
            object   item = i.First();

            while (item != null)
            {
                PlayerStrategy tmp = (PlayerStrategy)item;
                if (tmp.socketId.Equals(socketId))
                {
                    tmp.activeStrategy = strategy;
                    Console.WriteLine("=========================================================== STRATEGY UPDATED TO -> " + tmp.activeStrategy.ToString());
                    break;
                }
                item = i.Next();
            }
        }
Example #11
0
    public void ChangeStrategy(PlayerStartegy strategy)
    {
        m_playerStrategy = strategy;
        switch (strategy)
        {
        case PlayerStartegy.Main:
            //Set camera
            Camera.main.transform.parent.GetComponent <FollowTarget>().Target = transform;

            m_strategy = new PlayerMain(this);
            m_gridMain = FindObjectOfType <GridMain>();
            GetPlayerMain().SetGetterCallbacks(
                delegate {
                return(this.m_gridMain);
            }
                );
            GetPlayerMain().Start();
            break;

        case PlayerStartegy.Fight:
            m_strategy  = new PlayerFight(this);
            m_gridFight = FindObjectOfType <GridFight>();
            if (m_gridFight == null)
            {
                Debug.Log("player mana : grid fight null");
            }
            GetPlayerFight().SetGetterCallbacks(
                () => {
                return(m_gridFight);
            },
                () => {
                return(m_spellTree);
            }
                );
            GetPlayerFight().Start();
            break;
        }
    }
Example #12
0
    public void RealShoot(PlayerStrategy actualUsedStrategy)
    {
        if (!canShoot)
        {
            return;
        }

        switch (actualUsedStrategy.strategyType)
        {
        case Strategy.Normal:
            break;

        case Strategy.AgressiveUlti:
            for (int i = 0; i < spawnBulletsTransforms.Length; i++)
            {
                Transform originalTransform = spawnBulletsTransforms[i];
                BulletSpawner.Instance.GetBulletAt(originalTransform);
                originalTransform.Rotate(Vector3.up, 10);
                BulletSpawner.Instance.GetBulletAt(originalTransform);
                originalTransform.Rotate(Vector3.up, -20);
                BulletSpawner.Instance.GetBulletAt(originalTransform);
                originalTransform.Rotate(Vector3.up, 10);
            }
            return;     //return para que no vaya al otro for que sigue

        case Strategy.PrecisionUlti:
            //TODO: Pensar y hacer que cambie el tiro
            break;

        case Strategy.RewindUlti:
            //TODO: Hacer que las balas vayan mas lentas, etc.
            break;
        }
        for (int i = 0; i < spawnBulletsTransforms.Length; i++)
        {
            BulletSpawner.Instance.GetBulletAt(spawnBulletsTransforms[i]);
        }
    }
Example #13
0
 public Player(PlayerStrategy strat)
 {
     Strategy = strat;
 }
Example #14
0
 public ComputerPlayer(string name, PlayerStrategy strategy)
     : base(name, strategy)
 {
     this.PlayerType = "Computer";
 }
Example #15
0
 public Player(PlayerStrategy strategy, string name = "Unknown", decimal startingBalance = 0)
 {
     Strategy = strategy;
     Name     = name;
     BankRoll = startingBalance;
 }
Example #16
0
 public NetworkPlayer(string name, PlayerStrategy strategy)
     : base(name, strategy)
 {
     this.PlayerType = "Network";
 }
Example #17
0
 public Result(PlayerStrategy strategy, double winningPercentage)
 {
     Strategy          = strategy;
     WinningPercentage = winningPercentage;
 }
Example #18
0
 public HumanPlayer(string name, PlayerStrategy strategy)
     : base(name, strategy)
 {
     this.PlayerType = "Human";
 }
Example #19
0
 public void ChangeStrategy(Strategy strategyID)
 {
     actualStrategy = _allStrategies[(int)strategyID];
     actualStrategy.Enter();
 }
Example #20
0
 public BJPlayer(string _name, PlayerStrategy _strategy)
 {
     name     = _name;
     strategy = _strategy;
     hand     = new BJHand();
 }
 public void SetPlayerStrategy(PlayerStrategy strategy)
 {
     _PLAYER_STRATEGY = strategy;
 }