public HistoryShot(int playerShooting, ShotCoord from, ShotCoord to, ShotType type)
 {
     this.playerShooting = playerShooting;
     this.from           = from;
     this.to             = to;
     this.type           = type;
 }
Exemple #2
0
 public HistoryPoint(int playerWinning, int numberOfShots, HistoryShot lastShot)
 {
     this.playerWinning = playerWinning;
     this.numberOfShots = numberOfShots;
     this.lastShotFrom  = lastShot.from;
     this.lastShotTo    = lastShot.to;
     this.lastShotType  = lastShot.type;
 }
Exemple #3
0
 //Constructor to be used by ShotMaker
 public Shot(int playerShooting, ShotType type, ShotCoord from, ShotCoord to, ShotResultProbabilities shotResultProbabilities, bool isServe, float shotTime)
 {
     this.playerShooting          = playerShooting;
     this.type                    = type;
     this.from                    = from;
     this.to                      = to;
     this.shotResultProbabilities = shotResultProbabilities;
     this.shotTime                = shotTime;
 }
 private static ShotCoord[] GetRandomDefendedCoords()
 {
     ShotCoord[] result = new ShotCoord[3];
     int[]       tiles  = TileZoneHelper.GetRandomZone();
     for (int i = 0; i < 3; i++)
     {
         result[i] = new ShotCoord(tiles[i]);
     }
     return(result);
 }
Exemple #5
0
        public static Shot CreateShot(int playerShooting, Shot previousShot, Advantage advantage, ShotType previousShotType)
        {
            PlayerMatchInstance     player = MatchEngine.Instance.GetPlayer(playerShooting);
            ShotType                type   = GenerateShotTypeProbabilities(previousShot.type, player).Calculate();
            ShotCoord               from   = previousShot.to;
            ShotCoord               to     = CalculateShotCoord(GenerateShotCoordProbabilities(type, player));
            ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(to, playerShooting, type, advantage, previousShotType);
            float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences);

            return(new Shot(playerShooting, type, from, to, shotResultProbabilities, false, shotTime));
        }
Exemple #6
0
        private static ShotResultProbabilities GenerateShotResultProbabilities(ShotCoord to, int playerShooting, ShotType type, Advantage advantage, ShotType previousShotType)
        {
            ShotResultProbabilities probabilities = ShotResultProbabilities.GetShotTypeResultProbabilities(type);

            ShotResultAttributesModification(ref probabilities, MatchEngine.Instance.GetPlayer(playerShooting), MatchEngine.Instance.GetOtherPlayer(playerShooting), type, previousShotType);
            ShotResultAdvantageModification(ref probabilities, playerShooting, advantage);
            ShotResultOpposingPlayerModification(ref probabilities, MatchEngine.Instance.GetPlayer(playerShooting), type);



            return(probabilities);
        }
Exemple #7
0
        public static Serve CreateServe(int playerShooting, Score score)
        {
            PlayerMatchInstance player = MatchEngine.Instance.GetPlayer(playerShooting);
            int       points           = GetPlayerServingPoints(playerShooting, score);
            ShotCoord from             = GetFromForServing(points);
            ShotCoord to   = GetToForServing(points);
            ShotType  type = ShotType.LONG;
            ShotResultProbabilities shotResultProbabilities = GenerateShotResultProbabilities(playerShooting, type);
            float shotTime = ShotTime.GetTimeForType(type, MatchEngine.Instance.MatchPreferences);

            return(new Serve(playerShooting, type, from, to, shotResultProbabilities, shotTime));
        }
 public bool IsDefended(ShotCoord coord)
 {
     return(Array.Exists(defendedCoords, x => x == coord));
 }
 public Serve(int playerShooting, ShotType type, ShotCoord from, ShotCoord to, ShotResultProbabilities shotResultProbabilities, float shotTime)
     : base(playerShooting, type, from, to, shotResultProbabilities, true, shotTime)
 {
 }
 private void FieldShot(int playerShooting, ShotCoord from, ShotCoord to, ShotType type, float shotTime)
 {
     field.DoAShot(from.Index, to.Index, playerShooting, type, shotTime);
 }