Exemplo n.º 1
0
        public Weapon GetNextWeaponChoice()
        {
            if (currentDrawStreak == 0)
            {
                return((Weapon)rand.Next(3));
            }
            var outputs = network.Forward(new double[1, 5] {
                { currentDrawStreak / 5, MyWinsLeft / 1000, EnemyWinsLeft / 1000, DynamiteLeft / 100, EnemyDynamiteLeft / 100 }
            });
            var probs = new probVector(outputs[0, 0], outputs[0, 1], outputs[0, 2]);

            probs = probs.Normalise();
            var weaponChoice = rand.NextDouble();

            if (weaponChoice < probs.watProb)
            {
                if (EnemyDynamiteLeft > 0)
                {
                    return(Weapon.WaterBallon);
                }
            }
            if (weaponChoice < probs.watProb + probs.dynProb)
            {
                if (DynamiteLeft > 0)
                {
                    return(Weapon.Dynamite);
                }
            }

            return((Weapon)rand.Next(3));// returns rock, paper, scissors randomly.
        }